diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-03-20 05:33:24 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-03-20 05:33:24 +0400 |
commit | deea1f38b1ec0ccba283abeb63506cbc15e093d5 (patch) | |
tree | e68b4f80eef7a228e169ec19e57ffa2034c8b892 | |
parent | fcd5550a4248e00bbfb739352718d211b73259df (diff) |
real fix for booleans and face shading this time.
CDDM_tessfaces_to_faces wasbt updating the polyindex (missed incrementing the polyindex pointer).
also added an assert so non release builds will complain when CDDM_calc_edges_tessface() needs to run before CDDM_tessfaces_to_faces().
-rw-r--r-- | source/blender/blenkernel/intern/cdderivedmesh.c | 11 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_boolean_util.c | 4 |
2 files changed, 12 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index c33e50cccc9..94741ec3b78 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -2581,6 +2581,15 @@ void CDDM_tessfaces_to_faces(DerivedMesh *dm) #if 0 /* ensure we have all the edges we need */ CDDM_calc_edges_tessface(dm); +#else +# ifndef NDEBUG + { + /* ensure we have correct edges on non release builds */ + i = cddm->dm.numEdgeData; + CDDM_calc_edges_tessface(dm); + BLI_assert(cddm->dm.numEdgeData == i); + } +# endif #endif /*build edge hash*/ @@ -2620,7 +2629,7 @@ void CDDM_tessfaces_to_faces(DerivedMesh *dm) mp = cddm->mpoly; ml = cddm->mloop; l = 0; - for (i=0; i<cddm->dm.numTessFaceData; i++, mf++, mp++) { + for (i=0; i<cddm->dm.numTessFaceData; i++, mf++, mp++, polyindex++) { mp->flag = mf->flag; mp->loopstart = l; mp->mat_nr = mf->mat_nr; diff --git a/source/blender/modifiers/intern/MOD_boolean_util.c b/source/blender/modifiers/intern/MOD_boolean_util.c index 04a2caf0cf8..65ab6666220 100644 --- a/source/blender/modifiers/intern/MOD_boolean_util.c +++ b/source/blender/modifiers/intern/MOD_boolean_util.c @@ -354,9 +354,9 @@ static DerivedMesh *ConvertCSGDescriptorsToDerivedMesh( // create a new DerivedMesh result = CDDM_new(vertex_it->num_elements, 0, face_it->num_elements, 0, 0); - CustomData_merge(&dm1->faceData, &result->faceData, CD_MASK_DERIVEDMESH & ~CD_MASK_NORMAL, + CustomData_merge(&dm1->faceData, &result->faceData, CD_MASK_DERIVEDMESH & ~(CD_MASK_NORMAL | CD_MASK_POLYINDEX | CD_MASK_ORIGINDEX), CD_DEFAULT, face_it->num_elements); - CustomData_merge(&dm2->faceData, &result->faceData, CD_MASK_DERIVEDMESH & ~CD_MASK_NORMAL, + CustomData_merge(&dm2->faceData, &result->faceData, CD_MASK_DERIVEDMESH & ~(CD_MASK_NORMAL | CD_MASK_POLYINDEX | CD_MASK_ORIGINDEX), CD_DEFAULT, face_it->num_elements); // step through the vertex iterators: |