From 2936ca5d044710b22666d6935e035c53c225d72b Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Wed, 7 Sep 2011 12:47:23 +0000 Subject: [PATCH] bmesh: proper sculpting on non-multires object 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 | 10 ++++++++-- source/blender/blenkernel/intern/cdderivedmesh.c | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index c463e43eef8..bd1490cf959 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -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); diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index f596085df51..b6a06cdae45 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -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)