real fix for booleans and face shading this time.
authorCampbell Barton <ideasman42@gmail.com>
Tue, 20 Mar 2012 01:33:24 +0000 (01:33 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 20 Mar 2012 01:33:24 +0000 (01:33 +0000)
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().

source/blender/blenkernel/intern/cdderivedmesh.c
source/blender/modifiers/intern/MOD_boolean_util.c

index c33e50cccc9786de6fa0fff31e34cd8bd19264f3..94741ec3b7807c81fc14898d959799e99fc27af6 100644 (file)
@@ -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;
index 04a2caf0cf83dcdb03611f5fab04b28bf99b1c5d..65ab6666220972f2c02d62a5b57939e8813b8ccf 100644 (file)
@@ -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: