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:
authorSergey Sharybin <sergey.vfx@gmail.com>2016-01-15 14:29:57 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2016-01-15 14:29:57 +0300
commit7776f03873e47c2327d1d2fdb980a12cb99407de (patch)
treebc6f94b058279da212b4df5d78dd7e15a24b1cab
parent2414832bf1ef45f487777ae09d721bd1e7e8c840 (diff)
Changes around update normals from PBVH to CDDM
- Only do this if PBVH is not used for display, this should correspond to whats' happening in sculpt.c now. - No need to do such synchronization for solid drawing, it supports optimal display from PBVH. In fact, such synchronization is only needed in the following case: Drawing callback does not support PBVH draw and sculpt session is configured to use PBVH for display and related operations.
-rw-r--r--source/blender/blenkernel/intern/cdderivedmesh.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c
index eacacddb333..245c846688f 100644
--- a/source/blender/blenkernel/intern/cdderivedmesh.c
+++ b/source/blender/blenkernel/intern/cdderivedmesh.c
@@ -343,8 +343,19 @@ static void cdDM_update_normals_from_pbvh(DerivedMesh *dm)
CDDerivedMesh *cddm = (CDDerivedMesh *) dm;
float (*face_nors)[3];
- /* constructive modifiers handle their own normals */
- if (!dm->deformedOnly) {
+ /* Some callbacks do not use optimal PBVH draw, so needs all the
+ * possible data (like normals) to be copied from PBVH back to DM.
+ *
+ * This is safe to do if PBVH and DM are representing the same mesh,
+ * which could be wrong when modifiers are enabled for sculpt.
+ * So here we only doing update when there's no modifiers applied
+ * during sculpt.
+ *
+ * It's safe to do nothing if there are modifiers, because in this
+ * case modifier stack is re-constructed from scratch on every
+ * update.
+ */
+ if(!cddm->pbvh_draw) {
return;
}
@@ -456,9 +467,6 @@ static void cdDM_drawFacesSolid(
glShadeModel(GL_FLAT);
return;
}
- else {
- cdDM_update_normals_from_pbvh(dm);
- }
}
GPU_vertex_setup(dm);