[Bf-blender-cvs] [264ff51af89] temp-lanpr-cleanup2: Fix dyntopo sculpt not setting vertex indices dirty

Campbell Barton noreply at git.blender.org
Wed Nov 13 06:04:25 CET 2019


Commit: 264ff51af896fd538360ba85855c832b6efa068b
Author: Campbell Barton
Date:   Fri Nov 8 12:13:23 2019 +1100
Branches: temp-lanpr-cleanup2
https://developer.blender.org/rB264ff51af896fd538360ba85855c832b6efa068b

Fix dyntopo sculpt not setting vertex indices dirty

This is an old bug exposed by new cursor drawing
which uses vertex indices.

===================================================================

M	source/blender/blenkernel/BKE_pbvh.h
M	source/blender/blenkernel/intern/pbvh_bmesh.c
M	source/blender/editors/sculpt_paint/sculpt.c

===================================================================

diff --git a/source/blender/blenkernel/BKE_pbvh.h b/source/blender/blenkernel/BKE_pbvh.h
index 13adb868c01..570203081fe 100644
--- a/source/blender/blenkernel/BKE_pbvh.h
+++ b/source/blender/blenkernel/BKE_pbvh.h
@@ -280,7 +280,7 @@ bool BKE_pbvh_node_frustum_exclude_AABB(PBVHNode *node, void *frustum);
 struct GSet *BKE_pbvh_bmesh_node_unique_verts(PBVHNode *node);
 struct GSet *BKE_pbvh_bmesh_node_other_verts(PBVHNode *node);
 struct GSet *BKE_pbvh_bmesh_node_faces(PBVHNode *node);
-void BKE_pbvh_bmesh_node_save_orig(PBVHNode *node);
+void BKE_pbvh_bmesh_node_save_orig(struct BMesh *bm, PBVHNode *node);
 void BKE_pbvh_bmesh_after_stroke(PBVH *bvh);
 
 /* Update Bounding Box/Redraw and clear flags */
diff --git a/source/blender/blenkernel/intern/pbvh_bmesh.c b/source/blender/blenkernel/intern/pbvh_bmesh.c
index 6d38ae13994..d4115dc0080 100644
--- a/source/blender/blenkernel/intern/pbvh_bmesh.c
+++ b/source/blender/blenkernel/intern/pbvh_bmesh.c
@@ -413,7 +413,7 @@ static bool pbvh_bmesh_node_limit_ensure(PBVH *bvh, int node_index)
     /* so we can do direct lookups on 'bbc_array' */
     BM_elem_index_set(f, i); /* set_dirty! */
   }
-  /* likely this is already dirty */
+  /* Likely this is already dirty. */
   bvh->bm->elem_index_dirty |= BM_FACE;
 
   pbvh_bmesh_node_split(bvh, bbc_array, node_index);
@@ -1923,15 +1923,14 @@ void BKE_pbvh_build_bmesh(PBVH *bvh,
     nodeinfo[i] = f;
     BM_ELEM_CD_SET_INT(f, cd_face_node_offset, DYNTOPO_NODE_NONE);
   }
+  /* Likely this is already dirty. */
+  bm->elem_index_dirty |= BM_FACE;
 
   BMVert *v;
   BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
     BM_ELEM_CD_SET_INT(v, cd_vert_node_offset, DYNTOPO_NODE_NONE);
   }
 
-  /* likely this is already dirty */
-  bm->elem_index_dirty |= BM_FACE;
-
   /* setup root node */
   struct FastNodeBuildInfo rootnode = {0};
   rootnode.totface = bm->totface;
@@ -2036,7 +2035,7 @@ bool BKE_pbvh_bmesh_update_topology(PBVH *bvh,
  * (currently just raycast), store the node's triangles and vertices.
  *
  * Skips triangles that are hidden. */
-void BKE_pbvh_bmesh_node_save_orig(PBVHNode *node)
+void BKE_pbvh_bmesh_node_save_orig(BMesh *bm, PBVHNode *node)
 {
   /* Skip if original coords/triangles are already saved */
   if (node->bm_orco) {
@@ -2065,6 +2064,8 @@ void BKE_pbvh_bmesh_node_save_orig(PBVHNode *node)
     BM_elem_index_set(v, i); /* set_dirty! */
     i++;
   }
+  /* Likely this is already dirty. */
+  bm->elem_index_dirty |= BM_VERT;
 
   /* Copy the triangles */
   i = 0;
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 06fa03ccbc6..43f1bbb33f3 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -5211,7 +5211,7 @@ static void sculpt_topology_update(Sculpt *sd,
 
       if (BKE_pbvh_type(ss->pbvh) == PBVH_BMESH) {
         BKE_pbvh_node_mark_topology_update(nodes[n]);
-        BKE_pbvh_bmesh_node_save_orig(nodes[n]);
+        BKE_pbvh_bmesh_node_save_orig(ss->bm, nodes[n]);
       }
     }



More information about the Bf-blender-cvs mailing list