bmesh: proper sculpting on non-multires object
authorSergey Sharybin <sergey.vfx@gmail.com>
Wed, 7 Sep 2011 12:47:23 +0000 (12:47 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Wed, 7 Sep 2011 12:47:23 +0000 (12:47 +0000)
Problem was caused by unneeded call of CDDM_calc_normals when
creating derived mesh for object which duplicated mvert array.

It shouldn't happen unless object has got shapekeys or deformation
modifiers on the top of stack.

source/blender/blenkernel/intern/DerivedMesh.c
source/blender/blenkernel/intern/cdderivedmesh.c

index c463e43eef864d87fb88ba8aaccac28baa2d6692..bd1490cf959ad5e6a1d928e77be4a504da8ec32f 100644 (file)
@@ -1354,16 +1354,22 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
        } else if(dm) {
                finaldm = dm;
        } else {
+               int recalc_normals= 0;
+
                finaldm = CDDM_from_mesh(me, ob);
                
-               if (build_shapekey_layers)
+               if(build_shapekey_layers) {
                        add_shapekey_layers(finaldm, me, ob);
+                       recalc_normals= 1;
+               }
                
                if(deformedVerts) {
                        CDDM_apply_vert_coords(finaldm, deformedVerts);
+                       recalc_normals= 1;
                }
 
-               CDDM_calc_normals(finaldm);
+               if(recalc_normals)
+                       CDDM_calc_normals(finaldm);
                
                if((dataMask & CD_MASK_WEIGHT_MCOL) && (ob->mode & OB_MODE_WEIGHT_PAINT))
                        add_weight_mcol_dm(ob, finaldm);
index f596085df5196b297a0716dd1326609cda5f6a77..b6a06cdae45554c7869fa5e5dc8b3780f7c88515 100644 (file)
@@ -239,7 +239,7 @@ static int can_pbvh_draw(Object *ob, DerivedMesh *dm)
        if(deformed)
                return 0;
 
-       return dm->deformedOnly || ob->sculpt->kb;
+       return cddm->mvert == me->mvert || ob->sculpt->kb;
 }
 
 static struct PBVH *cdDM_getPBVH(Object *ob, DerivedMesh *dm)