Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2015-09-23 15:57:00 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2015-09-23 17:02:27 +0300
commite24ea81d65416d778ded6c7b9698dd673e2ed6b9 (patch)
tree4ff5e4e97cdc9ceef493d24dbca66193d5d33903
parentf6445cd6aee171eca26cece0a4cb60466699a6c9 (diff)
Fix T46215: Explode modifier looses texturesv2.76-rc2
-rw-r--r--source/blender/blenkernel/BKE_DerivedMesh.h5
-rw-r--r--source/blender/blenkernel/BKE_cdderivedmesh.h12
-rw-r--r--source/blender/blenkernel/intern/DerivedMesh.c31
-rw-r--r--source/blender/blenkernel/intern/cdderivedmesh.c21
-rw-r--r--source/blender/blenkernel/intern/customdata.c13
-rw-r--r--source/blender/modifiers/intern/MOD_explode.c2
6 files changed, 62 insertions, 22 deletions
diff --git a/source/blender/blenkernel/BKE_DerivedMesh.h b/source/blender/blenkernel/BKE_DerivedMesh.h
index e6d5b89e6ef..2c6e37b9ed8 100644
--- a/source/blender/blenkernel/BKE_DerivedMesh.h
+++ b/source/blender/blenkernel/BKE_DerivedMesh.h
@@ -498,6 +498,11 @@ void DM_init(
DerivedMesh *dm, DerivedMeshType type, int numVerts, int numEdges,
int numFaces, int numLoops, int numPolys);
+void DM_from_template_ex(
+ DerivedMesh *dm, DerivedMesh *source, DerivedMeshType type,
+ int numVerts, int numEdges, int numTessFaces,
+ int numLoops, int numPolys,
+ CustomDataMask mask);
void DM_from_template(
DerivedMesh *dm, DerivedMesh *source,
DerivedMeshType type,
diff --git a/source/blender/blenkernel/BKE_cdderivedmesh.h b/source/blender/blenkernel/BKE_cdderivedmesh.h
index c7ad6419560..9948f21ba90 100644
--- a/source/blender/blenkernel/BKE_cdderivedmesh.h
+++ b/source/blender/blenkernel/BKE_cdderivedmesh.h
@@ -84,9 +84,15 @@ struct DerivedMesh *CDDM_copy_from_tessface(struct DerivedMesh *dm);
* given DerivedMesh and containing the requested numbers of elements.
* elements are initialized to all zeros
*/
-struct DerivedMesh *CDDM_from_template(struct DerivedMesh *source,
- int numVerts, int numEdges, int numFaces,
- int numLoops, int numPolys);
+struct DerivedMesh *CDDM_from_template_ex(
+ struct DerivedMesh *source,
+ int numVerts, int numEdges, int numFaces,
+ int numLoops, int numPolys,
+ CustomDataMask mask);
+struct DerivedMesh *CDDM_from_template(
+ struct DerivedMesh *source,
+ int numVerts, int numEdges, int numFaces,
+ int numLoops, int numPolys);
/* converts mfaces to mpolys. note things may break if there are not valid
* medges surrounding each mface.
diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c
index 62b74af1674..20dabbdc323 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.c
+++ b/source/blender/blenkernel/intern/DerivedMesh.c
@@ -328,21 +328,17 @@ void DM_init(
* Utility function to initialize a DerivedMesh for the desired number
* of vertices, edges and faces, with a layer setup copied from source
*/
-void DM_from_template(
+void DM_from_template_ex(
DerivedMesh *dm, DerivedMesh *source, DerivedMeshType type,
int numVerts, int numEdges, int numTessFaces,
- int numLoops, int numPolys)
+ int numLoops, int numPolys,
+ CustomDataMask mask)
{
- CustomData_copy(&source->vertData, &dm->vertData, CD_MASK_DERIVEDMESH,
- CD_CALLOC, numVerts);
- CustomData_copy(&source->edgeData, &dm->edgeData, CD_MASK_DERIVEDMESH,
- CD_CALLOC, numEdges);
- CustomData_copy(&source->faceData, &dm->faceData, CD_MASK_DERIVEDMESH,
- CD_CALLOC, numTessFaces);
- CustomData_copy(&source->loopData, &dm->loopData, CD_MASK_DERIVEDMESH,
- CD_CALLOC, numLoops);
- CustomData_copy(&source->polyData, &dm->polyData, CD_MASK_DERIVEDMESH,
- CD_CALLOC, numPolys);
+ CustomData_copy(&source->vertData, &dm->vertData, mask, CD_CALLOC, numVerts);
+ CustomData_copy(&source->edgeData, &dm->edgeData, mask, CD_CALLOC, numEdges);
+ CustomData_copy(&source->faceData, &dm->faceData, mask, CD_CALLOC, numTessFaces);
+ CustomData_copy(&source->loopData, &dm->loopData, mask, CD_CALLOC, numLoops);
+ CustomData_copy(&source->polyData, &dm->polyData, mask, CD_CALLOC, numPolys);
dm->cd_flag = source->cd_flag;
@@ -358,6 +354,17 @@ void DM_from_template(
dm->needsFree = 1;
dm->dirty = 0;
}
+void DM_from_template(
+ DerivedMesh *dm, DerivedMesh *source, DerivedMeshType type,
+ int numVerts, int numEdges, int numTessFaces,
+ int numLoops, int numPolys)
+{
+ DM_from_template_ex(
+ dm, source, type,
+ numVerts, numEdges, numTessFaces,
+ numLoops, numPolys,
+ CD_MASK_DERIVEDMESH);
+}
int DM_release(DerivedMesh *dm)
{
diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c
index 8b020226bca..fa0e6121093 100644
--- a/source/blender/blenkernel/intern/cdderivedmesh.c
+++ b/source/blender/blenkernel/intern/cdderivedmesh.c
@@ -2423,10 +2423,11 @@ DerivedMesh *CDDM_copy_from_tessface(DerivedMesh *source)
/* note, the CD_ORIGINDEX layers are all 0, so if there is a direct
* relationship between mesh data this needs to be set by the caller. */
-DerivedMesh *CDDM_from_template(
+DerivedMesh *CDDM_from_template_ex(
DerivedMesh *source,
int numVerts, int numEdges, int numTessFaces,
- int numLoops, int numPolys)
+ int numLoops, int numPolys,
+ CustomDataMask mask)
{
CDDerivedMesh *cddm = cdDM_create("CDDM_from_template dest");
DerivedMesh *dm = &cddm->dm;
@@ -2438,7 +2439,11 @@ DerivedMesh *CDDM_from_template(
source->getPolyDataArray(source, CD_ORIGINDEX);
/* this does a copy of all non mvert/medge/mface layers */
- DM_from_template(dm, source, DM_TYPE_CDDM, numVerts, numEdges, numTessFaces, numLoops, numPolys);
+ DM_from_template_ex(
+ dm, source, DM_TYPE_CDDM,
+ numVerts, numEdges, numTessFaces,
+ numLoops, numPolys,
+ mask);
/* now add mvert/medge/mface layers */
CustomData_add_layer(&dm->vertData, CD_MVERT, CD_CALLOC, NULL, numVerts);
@@ -2462,6 +2467,16 @@ DerivedMesh *CDDM_from_template(
return dm;
}
+DerivedMesh *CDDM_from_template(
+ DerivedMesh *source,
+ int numVerts, int numEdges, int numTessFaces,
+ int numLoops, int numPolys)
+{
+ return CDDM_from_template_ex(
+ source, numVerts, numEdges, numTessFaces,
+ numLoops, numPolys,
+ CD_MASK_DERIVEDMESH);
+}
void CDDM_apply_vert_coords(DerivedMesh *dm, float (*vertCoords)[3])
{
diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c
index ecd809304cd..815c18b9e70 100644
--- a/source/blender/blenkernel/intern/customdata.c
+++ b/source/blender/blenkernel/intern/customdata.c
@@ -1361,9 +1361,16 @@ const CustomDataMask CD_MASK_BMESH =
CD_MASK_CREASE | CD_MASK_BWEIGHT | CD_MASK_RECAST | CD_MASK_PAINT_MASK |
CD_MASK_GRID_PAINT_MASK | CD_MASK_MVERT_SKIN | CD_MASK_FREESTYLE_EDGE | CD_MASK_FREESTYLE_FACE |
CD_MASK_CUSTOMLOOPNORMAL;
-const CustomDataMask CD_MASK_FACECORNERS = /* XXX Not used anywhere! */
- CD_MASK_MTFACE | CD_MASK_MCOL | CD_MASK_MTEXPOLY | CD_MASK_MLOOPUV |
- CD_MASK_MLOOPCOL | CD_MASK_NORMAL | CD_MASK_MLOOPTANGENT;
+/**
+ * cover values copied by #BKE_mesh_loops_to_tessdata
+ */
+const CustomDataMask CD_MASK_FACECORNERS =
+ CD_MASK_MTFACE | CD_MASK_MTEXPOLY | CD_MASK_MLOOPUV |
+ CD_MASK_MCOL | CD_MASK_MLOOPCOL |
+ CD_MASK_PREVIEW_MCOL | CD_MASK_PREVIEW_MLOOPCOL |
+ CD_MASK_ORIGSPACE | CD_MASK_ORIGSPACE_MLOOP |
+ CD_MASK_TESSLOOPNORMAL | CD_MASK_NORMAL |
+ CD_MASK_TANGENT | CD_MASK_MLOOPTANGENT;
const CustomDataMask CD_MASK_EVERYTHING =
CD_MASK_MVERT | CD_MASK_MDEFORMVERT | CD_MASK_MEDGE | CD_MASK_MFACE |
CD_MASK_MTFACE | CD_MASK_MCOL | CD_MASK_ORIGINDEX | CD_MASK_NORMAL /* | CD_MASK_POLYINDEX */ | CD_MASK_PROP_FLT |
diff --git a/source/blender/modifiers/intern/MOD_explode.c b/source/blender/modifiers/intern/MOD_explode.c
index 82600421736..d57ace8d7fe 100644
--- a/source/blender/modifiers/intern/MOD_explode.c
+++ b/source/blender/modifiers/intern/MOD_explode.c
@@ -861,7 +861,7 @@ static DerivedMesh *explodeMesh(ExplodeModifierData *emd,
BLI_edgehashIterator_free(ehi);
/* the final duplicated vertices */
- explode = CDDM_from_template(dm, totdup, 0, totface - delface, 0, 0);
+ explode = CDDM_from_template_ex(dm, totdup, 0, totface - delface, 0, 0, CD_MASK_DERIVEDMESH | CD_MASK_FACECORNERS);
mtface = CustomData_get_layer_named(&explode->faceData, CD_MTFACE, emd->uvname);
/*dupvert = CDDM_get_verts(explode);*/