Fix dyntopo sculpt not setting vertex indices dirty

This is an old bug exposed by new cursor drawing
which uses vertex indices.
This commit is contained in:
2019-11-08 12:13:23 +11:00
parent 5c2670ca39
commit e9d7fddeb4
3 changed files with 8 additions and 7 deletions

View File

@@ -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 */

View File

@@ -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;

View File

@@ -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]);
}
}