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:
-rw-r--r--source/blender/blenkernel/BKE_pbvh.h2
-rw-r--r--source/blender/blenkernel/intern/pbvh.c29
-rw-r--r--source/blender/blenkernel/intern/pbvh_intern.h4
-rw-r--r--source/blender/editors/sculpt_paint/paint_mask.c2
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c8
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_boundary.c12
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_brush_types.c48
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_cloth.c2
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_dyntopo.c1
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_expand.c4
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_face_set.c2
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_filter_color.c2
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_filter_mask.c4
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_filter_mesh.c2
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_mask_expand.c2
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_multiplane_scrape.c2
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_ops.c4
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_paint_color.c6
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_pose.c2
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_smooth.c6
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_transform.c2
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_undo.c17
-rw-r--r--source/blender/makesdna/DNA_meshdata_types.h1
23 files changed, 84 insertions, 80 deletions
diff --git a/source/blender/blenkernel/BKE_pbvh.h b/source/blender/blenkernel/BKE_pbvh.h
index 1ef1c98ce83..42dfd7f14ff 100644
--- a/source/blender/blenkernel/BKE_pbvh.h
+++ b/source/blender/blenkernel/BKE_pbvh.h
@@ -299,6 +299,8 @@ bool BKE_pbvh_node_fully_masked_get(PBVHNode *node);
void BKE_pbvh_node_fully_unmasked_set(PBVHNode *node, int fully_masked);
bool BKE_pbvh_node_fully_unmasked_get(PBVHNode *node);
+void BKE_pbvh_vert_mark_update(PBVH *pbvh, int index);
+
void BKE_pbvh_node_get_grids(PBVH *pbvh,
PBVHNode *node,
int **grid_indices,
diff --git a/source/blender/blenkernel/intern/pbvh.c b/source/blender/blenkernel/intern/pbvh.c
index bfedd4d3f49..c925942d810 100644
--- a/source/blender/blenkernel/intern/pbvh.c
+++ b/source/blender/blenkernel/intern/pbvh.c
@@ -610,7 +610,9 @@ void BKE_pbvh_build_mesh(PBVH *pbvh,
}
MEM_freeN(prim_bbc);
- MEM_freeN(pbvh->vert_bitmap);
+
+ /* Clear the bitmap so it can be used as an update tag later on. */
+ BLI_bitmap_set_all(pbvh->vert_bitmap, false, totvert);
}
void BKE_pbvh_build_grids(PBVH *pbvh,
@@ -714,6 +716,8 @@ void BKE_pbvh_free(PBVH *pbvh)
MEM_freeN(pbvh->prim_indices);
}
+ MEM_SAFE_FREE(pbvh->vert_bitmap);
+
MEM_freeN(pbvh);
}
@@ -1021,8 +1025,7 @@ static void pbvh_update_normals_clear_task_cb(void *__restrict userdata,
const int totvert = node->uniq_verts;
for (int i = 0; i < totvert; i++) {
const int v = verts[i];
- const MVert *mvert = &pbvh->verts[v];
- if (mvert->flag & ME_VERT_PBVH_UPDATE) {
+ if (BLI_BITMAP_TEST(pbvh->vert_bitmap, v)) {
zero_v3(vnors[v]);
}
}
@@ -1065,7 +1068,7 @@ static void pbvh_update_normals_accum_task_cb(void *__restrict userdata,
for (int j = sides; j--;) {
const int v = vtri[j];
- if (pbvh->verts[v].flag & ME_VERT_PBVH_UPDATE) {
+ if (BLI_BITMAP_TEST(pbvh->vert_bitmap, v)) {
/* NOTE: This avoids `lock, add_v3_v3, unlock`
* and is five to ten times quicker than a spin-lock.
* Not exact equivalent though, since atomicity is only ensured for one component
@@ -1094,13 +1097,12 @@ static void pbvh_update_normals_store_task_cb(void *__restrict userdata,
for (int i = 0; i < totvert; i++) {
const int v = verts[i];
- MVert *mvert = &pbvh->verts[v];
/* No atomics necessary because we are iterating over uniq_verts only,
* so we know only this thread will handle this vertex. */
- if (mvert->flag & ME_VERT_PBVH_UPDATE) {
+ if (BLI_BITMAP_TEST(pbvh->vert_bitmap, v)) {
normalize_v3(vnors[v]);
- mvert->flag &= ~ME_VERT_PBVH_UPDATE;
+ BLI_BITMAP_DISABLE(pbvh->vert_bitmap, v);
}
}
@@ -1117,7 +1119,7 @@ static void pbvh_faces_update_normals(PBVH *pbvh, PBVHNode **nodes, int totnode)
* bounding box of its adjacent faces will be as well.
* - However this is only true for the vertices that have actually been
* edited, not for all vertices in the nodes marked for update, so we
- * can only update vertices marked with ME_VERT_PBVH_UPDATE.
+ * can only update vertices marked in the `vert_bitmap`.
*/
PBVHUpdateData data = {
@@ -1826,6 +1828,12 @@ bool BKE_pbvh_node_fully_unmasked_get(PBVHNode *node)
return (node->flag & PBVH_Leaf) && (node->flag & PBVH_FullyUnmasked);
}
+void BKE_pbvh_vert_mark_update(PBVH *pbvh, int index)
+{
+ BLI_assert(pbvh->type == PBVH_FACES);
+ BLI_BITMAP_ENABLE(pbvh->vert_bitmap, index);
+}
+
void BKE_pbvh_node_get_verts(PBVH *pbvh,
PBVHNode *node,
const int **r_vert_indices,
@@ -1971,9 +1979,8 @@ bool BKE_pbvh_node_vert_update_check_any(PBVH *pbvh, PBVHNode *node)
for (int i = 0; i < totvert; i++) {
const int v = verts[i];
- const MVert *mvert = &pbvh->verts[v];
- if (mvert->flag & ME_VERT_PBVH_UPDATE) {
+ if (BLI_BITMAP_TEST(pbvh->vert_bitmap, v)) {
return true;
}
}
@@ -2827,7 +2834,7 @@ void BKE_pbvh_vert_coords_apply(PBVH *pbvh, const float (*vertCos)[3], const int
/* no need for float comparison here (memory is exactly equal or not) */
if (memcmp(mvert->co, vertCos[a], sizeof(float[3])) != 0) {
copy_v3_v3(mvert->co, vertCos[a]);
- mvert->flag |= ME_VERT_PBVH_UPDATE;
+ BKE_pbvh_vert_mark_update(pbvh, a);
}
}
diff --git a/source/blender/blenkernel/intern/pbvh_intern.h b/source/blender/blenkernel/intern/pbvh_intern.h
index 9562cda5f28..53379d8a032 100644
--- a/source/blender/blenkernel/intern/pbvh_intern.h
+++ b/source/blender/blenkernel/intern/pbvh_intern.h
@@ -153,8 +153,8 @@ struct PBVH {
int totgrid;
BLI_bitmap **grid_hidden;
- /* Only used during BVH build and update,
- * don't need to remain valid after */
+ /* Used during BVH build and later to mark that a vertex needs to update
+ * (its normal must be recalculated). */
BLI_bitmap *vert_bitmap;
#ifdef PERFCNTRS
diff --git a/source/blender/editors/sculpt_paint/paint_mask.c b/source/blender/editors/sculpt_paint/paint_mask.c
index e65d6ce2d48..693964b2860 100644
--- a/source/blender/editors/sculpt_paint/paint_mask.c
+++ b/source/blender/editors/sculpt_paint/paint_mask.c
@@ -1428,7 +1428,7 @@ static void project_line_gesture_apply_task_cb(void *__restrict userdata,
}
add_v3_v3(vd.co, disp);
if (vd.mvert) {
- vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
+ BKE_pbvh_vert_mark_update(sgcontext->ss->pbvh, vd.index);
}
any_updated = true;
}
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index ea3d694542c..5faf9271848 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -349,7 +349,7 @@ void SCULPT_vertex_visible_set(SculptSession *ss, int index, bool visible)
switch (BKE_pbvh_type(ss->pbvh)) {
case PBVH_FACES:
SET_FLAG_FROM_TEST(ss->mvert[index].flag, !visible, ME_HIDE);
- ss->mvert[index].flag |= ME_VERT_PBVH_UPDATE;
+ BKE_pbvh_vert_mark_update(ss->pbvh, index);
break;
case PBVH_BMESH:
BM_elem_flag_set(BM_vert_at_index(ss->bm, index), BM_ELEM_HIDDEN, !visible);
@@ -592,7 +592,7 @@ static void UNUSED_FUNCTION(sculpt_visibility_sync_vertex_to_face_sets)(SculptSe
ss->face_sets[vert_map->indices[i]] = -abs(ss->face_sets[vert_map->indices[i]]);
}
}
- ss->mvert[index].flag |= ME_VERT_PBVH_UPDATE;
+ BKE_pbvh_vert_mark_update(ss->pbvh, index);
}
void SCULPT_visibility_sync_all_vertex_to_face_sets(SculptSession *ss)
@@ -1398,7 +1398,7 @@ static void paint_mesh_restore_co_task_cb(void *__restrict userdata,
}
if (vd.mvert) {
- vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
+ BKE_pbvh_vert_mark_update(ss->pbvh, vd.index);
}
}
BKE_pbvh_vertex_iter_end;
@@ -2988,7 +2988,7 @@ static void do_gravity_task_cb_ex(void *__restrict userdata,
mul_v3_v3fl(proxy[vd.i], offset, fade);
if (vd.mvert) {
- vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
+ BKE_pbvh_vert_mark_update(ss->pbvh, vd.index);
}
}
BKE_pbvh_vertex_iter_end;
diff --git a/source/blender/editors/sculpt_paint/sculpt_boundary.c b/source/blender/editors/sculpt_paint/sculpt_boundary.c
index 1e41c5cdbdf..30b2562ecd9 100644
--- a/source/blender/editors/sculpt_paint/sculpt_boundary.c
+++ b/source/blender/editors/sculpt_paint/sculpt_boundary.c
@@ -688,7 +688,7 @@ static void do_boundary_brush_bend_task_cb_ex(void *__restrict userdata,
add_v3_v3(target_co, boundary->bend.pivot_positions[vd.index]);
if (vd.mvert) {
- vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
+ BKE_pbvh_vert_mark_update(ss->pbvh, vd.index);
}
}
BKE_pbvh_vertex_iter_end;
@@ -734,7 +734,7 @@ static void do_boundary_brush_slide_task_cb_ex(void *__restrict userdata,
strength);
if (vd.mvert) {
- vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
+ BKE_pbvh_vert_mark_update(ss->pbvh, vd.index);
}
}
BKE_pbvh_vertex_iter_end;
@@ -780,7 +780,7 @@ static void do_boundary_brush_inflate_task_cb_ex(void *__restrict userdata,
strength);
if (vd.mvert) {
- vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
+ BKE_pbvh_vert_mark_update(ss->pbvh, vd.index);
}
}
BKE_pbvh_vertex_iter_end;
@@ -823,7 +823,7 @@ static void do_boundary_brush_grab_task_cb_ex(void *__restrict userdata,
boundary->edit_info[vd.index].strength_factor * mask * automask * strength);
if (vd.mvert) {
- vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
+ BKE_pbvh_vert_mark_update(ss->pbvh, vd.index);
}
}
BKE_pbvh_vertex_iter_end;
@@ -877,7 +877,7 @@ static void do_boundary_brush_twist_task_cb_ex(void *__restrict userdata,
add_v3_v3(target_co, boundary->twist.pivot_position);
if (vd.mvert) {
- vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
+ BKE_pbvh_vert_mark_update(ss->pbvh, vd.index);
}
}
BKE_pbvh_vertex_iter_end;
@@ -936,7 +936,7 @@ static void do_boundary_brush_smooth_task_cb_ex(void *__restrict userdata,
target_co, vd.co, disp, boundary->edit_info[vd.index].strength_factor * mask * strength);
if (vd.mvert) {
- vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
+ BKE_pbvh_vert_mark_update(ss->pbvh, vd.index);
}
}
BKE_pbvh_vertex_iter_end;
diff --git a/source/blender/editors/sculpt_paint/sculpt_brush_types.c b/source/blender/editors/sculpt_paint/sculpt_brush_types.c
index 0d2c5641183..eba7cce84cb 100644
--- a/source/blender/editors/sculpt_paint/sculpt_brush_types.c
+++ b/source/blender/editors/sculpt_paint/sculpt_brush_types.c
@@ -334,7 +334,7 @@ static void do_draw_brush_task_cb_ex(void *__restrict userdata,
mul_v3_v3fl(proxy[vd.i], offset, fade);
if (vd.mvert) {
- vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
+ BKE_pbvh_vert_mark_update(ss->pbvh, vd.index);
}
}
BKE_pbvh_vertex_iter_end;
@@ -428,7 +428,7 @@ static void do_fill_brush_task_cb_ex(void *__restrict userdata,
mul_v3_v3fl(proxy[vd.i], val, fade);
if (vd.mvert) {
- vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
+ BKE_pbvh_vert_mark_update(ss->pbvh, vd.index);
}
}
BKE_pbvh_vertex_iter_end;
@@ -526,7 +526,7 @@ static void do_scrape_brush_task_cb_ex(void *__restrict userdata,
mul_v3_v3fl(proxy[vd.i], val, fade);
if (vd.mvert) {
- vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
+ BKE_pbvh_vert_mark_update(ss->pbvh, vd.index);
}
}
BKE_pbvh_vertex_iter_end;
@@ -644,7 +644,7 @@ static void do_clay_thumb_brush_task_cb_ex(void *__restrict userdata,
mul_v3_v3fl(proxy[vd.i], val, fade);
if (vd.mvert) {
- vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
+ BKE_pbvh_vert_mark_update(ss->pbvh, vd.index);
}
}
BKE_pbvh_vertex_iter_end;
@@ -795,7 +795,7 @@ static void do_flatten_brush_task_cb_ex(void *__restrict userdata,
mul_v3_v3fl(proxy[vd.i], val, fade);
if (vd.mvert) {
- vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
+ BKE_pbvh_vert_mark_update(ss->pbvh, vd.index);
}
}
}
@@ -952,7 +952,7 @@ static void do_clay_brush_task_cb_ex(void *__restrict userdata,
mul_v3_v3fl(proxy[vd.i], val, fade);
if (vd.mvert) {
- vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
+ BKE_pbvh_vert_mark_update(ss->pbvh, vd.index);
}
}
BKE_pbvh_vertex_iter_end;
@@ -1078,7 +1078,7 @@ static void do_clay_strips_brush_task_cb_ex(void *__restrict userdata,
mul_v3_v3fl(proxy[vd.i], val, fade);
if (vd.mvert) {
- vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
+ BKE_pbvh_vert_mark_update(ss->pbvh, vd.index);
}
}
BKE_pbvh_vertex_iter_end;
@@ -1278,7 +1278,7 @@ static void do_snake_hook_brush_task_cb_ex(void *__restrict userdata,
}
if (vd.mvert) {
- vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
+ BKE_pbvh_vert_mark_update(ss->pbvh, vd.index);
}
}
BKE_pbvh_vertex_iter_end;
@@ -1364,7 +1364,7 @@ static void do_thumb_brush_task_cb_ex(void *__restrict userdata,
mul_v3_v3fl(proxy[vd.i], cono, fade);
if (vd.mvert) {
- vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
+ BKE_pbvh_vert_mark_update(ss->pbvh, vd.index);
}
}
BKE_pbvh_vertex_iter_end;
@@ -1442,7 +1442,7 @@ static void do_rotate_brush_task_cb_ex(void *__restrict userdata,
sub_v3_v3(proxy[vd.i], orig_data.co);
if (vd.mvert) {
- vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
+ BKE_pbvh_vert_mark_update(ss->pbvh, vd.index);
}
}
BKE_pbvh_vertex_iter_end;
@@ -1557,7 +1557,7 @@ static void do_layer_brush_task_cb_ex(void *__restrict userdata,
SCULPT_clip(sd, ss, vd.co, final_co);
if (vd.mvert) {
- vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
+ BKE_pbvh_vert_mark_update(ss->pbvh, vd.index);
}
}
BKE_pbvh_vertex_iter_end;
@@ -1630,7 +1630,7 @@ static void do_inflate_brush_task_cb_ex(void *__restrict userdata,
mul_v3_v3v3(proxy[vd.i], val, ss->cache->scale);
if (vd.mvert) {
- vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
+ BKE_pbvh_vert_mark_update(ss->pbvh, vd.index);
}
}
BKE_pbvh_vertex_iter_end;
@@ -1689,7 +1689,7 @@ static void do_nudge_brush_task_cb_ex(void *__restrict userdata,
mul_v3_v3fl(proxy[vd.i], cono, fade);
if (vd.mvert) {
- vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
+ BKE_pbvh_vert_mark_update(ss->pbvh, vd.index);
}
}
BKE_pbvh_vertex_iter_end;
@@ -1781,7 +1781,7 @@ static void do_crease_brush_task_cb_ex(void *__restrict userdata,
add_v3_v3v3(proxy[vd.i], val1, val2);
if (vd.mvert) {
- vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
+ BKE_pbvh_vert_mark_update(ss->pbvh, vd.index);
}
}
BKE_pbvh_vertex_iter_end;
@@ -1900,7 +1900,7 @@ static void do_pinch_brush_task_cb_ex(void *__restrict userdata,
mul_v3_v3fl(proxy[vd.i], disp_center, fade);
if (vd.mvert) {
- vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
+ BKE_pbvh_vert_mark_update(ss->pbvh, vd.index);
}
}
BKE_pbvh_vertex_iter_end;
@@ -2009,7 +2009,7 @@ static void do_grab_brush_task_cb_ex(void *__restrict userdata,
mul_v3_v3fl(proxy[vd.i], grab_delta, fade);
if (vd.mvert) {
- vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
+ BKE_pbvh_vert_mark_update(ss->pbvh, vd.index);
}
}
BKE_pbvh_vertex_iter_end;
@@ -2117,7 +2117,7 @@ static void do_elastic_deform_brush_task_cb_ex(void *__restrict userdata,
copy_v3_v3(proxy[vd.i], final_disp);
if (vd.mvert) {
- vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
+ BKE_pbvh_vert_mark_update(ss->pbvh, vd.index);
}
}
BKE_pbvh_vertex_iter_end;
@@ -2190,7 +2190,7 @@ static void do_draw_sharp_brush_task_cb_ex(void *__restrict userdata,
mul_v3_v3fl(proxy[vd.i], offset, fade);
if (vd.mvert) {
- vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
+ BKE_pbvh_vert_mark_update(ss->pbvh, vd.index);
}
}
BKE_pbvh_vertex_iter_end;
@@ -2301,7 +2301,7 @@ static void do_topology_slide_task_cb_ex(void *__restrict userdata,
mul_v3_v3fl(proxy[vd.i], final_disp, fade);
if (vd.mvert) {
- vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
+ BKE_pbvh_vert_mark_update(ss->pbvh, vd.index);
}
}
BKE_pbvh_vertex_iter_end;
@@ -2427,7 +2427,7 @@ static void do_topology_relax_task_cb_ex(void *__restrict userdata,
SCULPT_relax_vertex(ss, &vd, fade * bstrength, false, vd.co);
if (vd.mvert) {
- vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
+ BKE_pbvh_vert_mark_update(ss->pbvh, vd.index);
}
}
BKE_pbvh_vertex_iter_end;
@@ -2507,7 +2507,7 @@ static void do_displacement_eraser_brush_task_cb_ex(void *__restrict userdata,
mul_v3_v3fl(proxy[vd.i], disp, fade);
if (vd.mvert) {
- vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
+ BKE_pbvh_vert_mark_update(ss->pbvh, vd.index);
}
}
BKE_pbvh_vertex_iter_end;
@@ -2619,7 +2619,7 @@ static void do_displacement_smear_brush_task_cb_ex(void *__restrict userdata,
interp_v3_v3v3(vd.co, vd.co, new_co, fade);
if (vd.mvert) {
- vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
+ BKE_pbvh_vert_mark_update(ss->pbvh, vd.index);
}
}
BKE_pbvh_vertex_iter_end;
@@ -2732,7 +2732,7 @@ static void do_topology_rake_bmesh_task_cb_ex(void *__restrict userdata,
SCULPT_clip(sd, ss, vd.co, val);
if (vd.mvert) {
- vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
+ BKE_pbvh_vert_mark_update(ss->pbvh, vd.index);
}
}
BKE_pbvh_vertex_iter_end;
@@ -2806,7 +2806,7 @@ static void do_mask_brush_draw_task_cb_ex(void *__restrict userdata,
*vd.mask = clamp_f(*vd.mask, 0.0f, 1.0f);
if (vd.mvert) {
- vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
+ BKE_pbvh_vert_mark_update(ss->pbvh, vd.index);
}
BKE_pbvh_vertex_iter_end;
}
diff --git a/source/blender/editors/sculpt_paint/sculpt_cloth.c b/source/blender/editors/sculpt_paint/sculpt_cloth.c
index 3ac57d73d37..1151f890ef1 100644
--- a/source/blender/editors/sculpt_paint/sculpt_cloth.c
+++ b/source/blender/editors/sculpt_paint/sculpt_cloth.c
@@ -814,7 +814,7 @@ static void do_cloth_brush_solve_simulation_task_cb_ex(
copy_v3_v3(vd.co, cloth_sim->pos[vd.index]);
if (vd.mvert) {
- vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
+ BKE_pbvh_vert_mark_update(ss->pbvh, vd.index);
}
}
BKE_pbvh_vertex_iter_end;
diff --git a/source/blender/editors/sculpt_paint/sculpt_dyntopo.c b/source/blender/editors/sculpt_paint/sculpt_dyntopo.c
index ae6dcbdbff4..051dc9f6837 100644
--- a/source/blender/editors/sculpt_paint/sculpt_dyntopo.c
+++ b/source/blender/editors/sculpt_paint/sculpt_dyntopo.c
@@ -240,7 +240,6 @@ static void SCULPT_dynamic_topology_disable_ex(
/* Sync the visibility to vertices manually as the pmap is still not initialized. */
for (int i = 0; i < me->totvert; i++) {
me->mvert[i].flag &= ~ME_HIDE;
- me->mvert[i].flag |= ME_VERT_PBVH_UPDATE;
}
}
diff --git a/source/blender/editors/sculpt_paint/sculpt_expand.c b/source/blender/editors/sculpt_paint/sculpt_expand.c
index 2ba03969f38..d332a6448d7 100644
--- a/source/blender/editors/sculpt_paint/sculpt_expand.c
+++ b/source/blender/editors/sculpt_paint/sculpt_expand.c
@@ -1253,7 +1253,7 @@ static void sculpt_expand_mask_update_task_cb(void *__restrict userdata,
*vd.mask = clamp_f(new_mask, 0.0f, 1.0f);
any_changed = true;
if (vd.mvert) {
- vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
+ BKE_pbvh_vert_mark_update(ss->pbvh, vd.index);
}
}
BKE_pbvh_vertex_iter_end;
@@ -1333,7 +1333,7 @@ static void sculpt_expand_colors_update_task_cb(void *__restrict userdata,
copy_v4_v4(vd.col, final_color);
any_changed = true;
if (vd.mvert) {
- vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
+ BKE_pbvh_vert_mark_update(ss->pbvh, vd.index);
}
}
BKE_pbvh_vertex_iter_end;
diff --git a/source/blender/editors/sculpt_paint/sculpt_face_set.c b/source/blender/editors/sculpt_paint/sculpt_face_set.c
index dc8cda964ea..a4c614e11d9 100644
--- a/source/blender/editors/sculpt_paint/sculpt_face_set.c
+++ b/source/blender/editors/sculpt_paint/sculpt_face_set.c
@@ -234,7 +234,7 @@ static void do_relax_face_sets_brush_task_cb_ex(void *__restrict userdata,
SCULPT_relax_vertex(ss, &vd, fade * bstrength, relax_face_sets, vd.co);
if (vd.mvert) {
- vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
+ BKE_pbvh_vert_mark_update(ss->pbvh, vd.index);
}
}
BKE_pbvh_vertex_iter_end;
diff --git a/source/blender/editors/sculpt_paint/sculpt_filter_color.c b/source/blender/editors/sculpt_paint/sculpt_filter_color.c
index a0062a98194..cb924259724 100644
--- a/source/blender/editors/sculpt_paint/sculpt_filter_color.c
+++ b/source/blender/editors/sculpt_paint/sculpt_filter_color.c
@@ -205,7 +205,7 @@ static void color_filter_task_cb(void *__restrict userdata,
copy_v3_v3(vd.col, final_color);
if (vd.mvert) {
- vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
+ BKE_pbvh_vert_mark_update(ss->pbvh, vd.index);
}
}
BKE_pbvh_vertex_iter_end;
diff --git a/source/blender/editors/sculpt_paint/sculpt_filter_mask.c b/source/blender/editors/sculpt_paint/sculpt_filter_mask.c
index cf45e25142b..e85fb19d259 100644
--- a/source/blender/editors/sculpt_paint/sculpt_filter_mask.c
+++ b/source/blender/editors/sculpt_paint/sculpt_filter_mask.c
@@ -179,7 +179,7 @@ static void mask_filter_task_cb(void *__restrict userdata,
update = true;
}
if (vd.mvert) {
- vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
+ BKE_pbvh_vert_mark_update(ss->pbvh, vd.index);
}
}
BKE_pbvh_vertex_iter_end;
@@ -403,7 +403,7 @@ static void dirty_mask_apply_task_cb(void *__restrict userdata,
*vd.mask = CLAMPIS(mask, 0.0f, 1.0f);
if (vd.mvert) {
- vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
+ BKE_pbvh_vert_mark_update(ss->pbvh, vd.index);
}
}
BKE_pbvh_vertex_iter_end;
diff --git a/source/blender/editors/sculpt_paint/sculpt_filter_mesh.c b/source/blender/editors/sculpt_paint/sculpt_filter_mesh.c
index 2d8bdc4e4ac..70fee4bac8d 100644
--- a/source/blender/editors/sculpt_paint/sculpt_filter_mesh.c
+++ b/source/blender/editors/sculpt_paint/sculpt_filter_mesh.c
@@ -468,7 +468,7 @@ static void mesh_filter_task_cb(void *__restrict userdata,
}
copy_v3_v3(vd.co, final_pos);
if (vd.mvert) {
- vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
+ BKE_pbvh_vert_mark_update(ss->pbvh, vd.index);
}
}
BKE_pbvh_vertex_iter_end;
diff --git a/source/blender/editors/sculpt_paint/sculpt_mask_expand.c b/source/blender/editors/sculpt_paint/sculpt_mask_expand.c
index b59d461bab5..89416687952 100644
--- a/source/blender/editors/sculpt_paint/sculpt_mask_expand.c
+++ b/source/blender/editors/sculpt_paint/sculpt_mask_expand.c
@@ -153,7 +153,7 @@ static void sculpt_expand_task_cb(void *__restrict userdata,
if (*vd.mask != final_mask) {
if (vd.mvert) {
- vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
+ BKE_pbvh_vert_mark_update(ss->pbvh, vd.index);
}
*vd.mask = final_mask;
BKE_pbvh_node_mark_update_mask(node);
diff --git a/source/blender/editors/sculpt_paint/sculpt_multiplane_scrape.c b/source/blender/editors/sculpt_paint/sculpt_multiplane_scrape.c
index 0fec7a9c4bd..67db996e743 100644
--- a/source/blender/editors/sculpt_paint/sculpt_multiplane_scrape.c
+++ b/source/blender/editors/sculpt_paint/sculpt_multiplane_scrape.c
@@ -216,7 +216,7 @@ static void do_multiplane_scrape_brush_task_cb_ex(void *__restrict userdata,
mul_v3_v3fl(proxy[vd.i], val, fade);
if (vd.mvert) {
- vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
+ BKE_pbvh_vert_mark_update(ss->pbvh, vd.index);
}
}
BKE_pbvh_vertex_iter_end;
diff --git a/source/blender/editors/sculpt_paint/sculpt_ops.c b/source/blender/editors/sculpt_paint/sculpt_ops.c
index f50775f8a32..509bad37b5c 100644
--- a/source/blender/editors/sculpt_paint/sculpt_ops.c
+++ b/source/blender/editors/sculpt_paint/sculpt_ops.c
@@ -873,7 +873,7 @@ static void do_mask_by_color_contiguous_update_nodes_cb(
}
update_node = true;
if (vd.mvert) {
- vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
+ BKE_pbvh_vert_mark_update(ss->pbvh, vd.index);
}
}
BKE_pbvh_vertex_iter_end;
@@ -980,7 +980,7 @@ static void do_mask_by_color_task_cb(void *__restrict userdata,
}
update_node = true;
if (vd.mvert) {
- vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
+ BKE_pbvh_vert_mark_update(ss->pbvh, vd.index);
}
}
BKE_pbvh_vertex_iter_end;
diff --git a/source/blender/editors/sculpt_paint/sculpt_paint_color.c b/source/blender/editors/sculpt_paint/sculpt_paint_color.c
index 936ebb7e8f7..e4f548bc07f 100644
--- a/source/blender/editors/sculpt_paint/sculpt_paint_color.c
+++ b/source/blender/editors/sculpt_paint/sculpt_paint_color.c
@@ -104,7 +104,7 @@ static void do_color_smooth_task_cb_exec(void *__restrict userdata,
blend_color_interpolate_float(vd.col, vd.col, smooth_color, fade);
if (vd.mvert) {
- vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
+ BKE_pbvh_vert_mark_update(ss->pbvh, vd.index);
}
}
BKE_pbvh_vertex_iter_end;
@@ -198,7 +198,7 @@ static void do_paint_brush_task_cb_ex(void *__restrict userdata,
CLAMP4(vd.col, 0.0f, 1.0f);
if (vd.mvert) {
- vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
+ BKE_pbvh_vert_mark_update(ss->pbvh, vd.index);
}
}
BKE_pbvh_vertex_iter_end;
@@ -436,7 +436,7 @@ static void do_smear_brush_task_cb_exec(void *__restrict userdata,
blend_color_interpolate_float(vd.col, ss->cache->prev_colors[vd.index], interp_color, fade);
if (vd.mvert) {
- vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
+ BKE_pbvh_vert_mark_update(ss->pbvh, vd.index);
}
}
BKE_pbvh_vertex_iter_end;
diff --git a/source/blender/editors/sculpt_paint/sculpt_pose.c b/source/blender/editors/sculpt_paint/sculpt_pose.c
index 3b939279bf9..37f3f75b95b 100644
--- a/source/blender/editors/sculpt_paint/sculpt_pose.c
+++ b/source/blender/editors/sculpt_paint/sculpt_pose.c
@@ -212,7 +212,7 @@ static void do_pose_brush_task_cb_ex(void *__restrict userdata,
copy_v3_v3(target_co, final_pos);
if (vd.mvert) {
- vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
+ BKE_pbvh_vert_mark_update(ss->pbvh, vd.index);
}
}
BKE_pbvh_vertex_iter_end;
diff --git a/source/blender/editors/sculpt_paint/sculpt_smooth.c b/source/blender/editors/sculpt_paint/sculpt_smooth.c
index c65489548b7..a306737ed0a 100644
--- a/source/blender/editors/sculpt_paint/sculpt_smooth.c
+++ b/source/blender/editors/sculpt_paint/sculpt_smooth.c
@@ -247,7 +247,7 @@ static void do_enhance_details_brush_task_cb_ex(void *__restrict userdata,
SCULPT_clip(sd, ss, vd.co, disp);
if (vd.mvert) {
- vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
+ BKE_pbvh_vert_mark_update(ss->pbvh, vd.index);
}
}
BKE_pbvh_vertex_iter_end;
@@ -337,7 +337,7 @@ static void do_smooth_brush_task_cb_ex(void *__restrict userdata,
SCULPT_clip(sd, ss, vd.co, val);
}
if (vd.mvert) {
- vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
+ BKE_pbvh_vert_mark_update(ss->pbvh, vd.index);
}
}
BKE_pbvh_vertex_iter_end;
@@ -494,7 +494,7 @@ static void SCULPT_do_surface_smooth_brush_laplacian_task_cb_ex(
ss, disp, vd.co, ss->cache->surface_smooth_laplacian_disp, vd.index, orig_data.co, alpha);
madd_v3_v3fl(vd.co, disp, clamp_f(fade, 0.0f, 1.0f));
if (vd.mvert) {
- vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
+ BKE_pbvh_vert_mark_update(ss->pbvh, vd.index);
}
}
BKE_pbvh_vertex_iter_end;
diff --git a/source/blender/editors/sculpt_paint/sculpt_transform.c b/source/blender/editors/sculpt_paint/sculpt_transform.c
index b91e05f226e..c0c3ae1b160 100644
--- a/source/blender/editors/sculpt_paint/sculpt_transform.c
+++ b/source/blender/editors/sculpt_paint/sculpt_transform.c
@@ -162,7 +162,7 @@ static void sculpt_transform_task_cb(void *__restrict userdata,
add_v3_v3v3(vd.co, orig_co, disp);
if (vd.mvert) {
- vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
+ BKE_pbvh_vert_mark_update(ss->pbvh, vd.index);
}
}
BKE_pbvh_vertex_iter_end;
diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c
index 0b64d1f8a35..1a1e21f328c 100644
--- a/source/blender/editors/sculpt_paint/sculpt_undo.c
+++ b/source/blender/editors/sculpt_paint/sculpt_undo.c
@@ -134,7 +134,7 @@ struct PartialUpdateData {
};
/**
- * A version of #update_cb that tests for 'ME_VERT_PBVH_UPDATE'
+ * A version of #update_cb that tests for the update tag in #PBVH.vert_bitmap.
*/
static void update_cb_partial(PBVHNode *node, void *userdata)
{
@@ -250,20 +250,20 @@ static bool sculpt_undo_restore_coords(bContext *C, Depsgraph *depsgraph, Sculpt
if (ss->deform_modifiers_active) {
for (int i = 0; i < unode->totvert; i++) {
sculpt_undo_restore_deformed(ss, unode, i, index[i], mvert[index[i]].co);
- mvert[index[i]].flag |= ME_VERT_PBVH_UPDATE;
+ BKE_pbvh_vert_mark_update(ss->pbvh, index[i]);
}
}
else {
for (int i = 0; i < unode->totvert; i++) {
swap_v3_v3(mvert[index[i]].co, unode->orig_co[i]);
- mvert[index[i]].flag |= ME_VERT_PBVH_UPDATE;
+ BKE_pbvh_vert_mark_update(ss->pbvh, index[i]);
}
}
}
else {
for (int i = 0; i < unode->totvert; i++) {
swap_v3_v3(mvert[index[i]].co, unode->co[i]);
- mvert[index[i]].flag |= ME_VERT_PBVH_UPDATE;
+ BKE_pbvh_vert_mark_update(ss->pbvh, index[i]);
}
}
}
@@ -307,7 +307,7 @@ static bool sculpt_undo_restore_hidden(bContext *C, SculptUndoNode *unode)
if ((BLI_BITMAP_TEST(unode->vert_hidden, i) != 0) != ((v->flag & ME_HIDE) != 0)) {
BLI_BITMAP_FLIP(unode->vert_hidden, i);
v->flag ^= ME_HIDE;
- v->flag |= ME_VERT_PBVH_UPDATE;
+ BKE_pbvh_vert_mark_update(ss->pbvh, unode->index[i]);
}
}
}
@@ -331,12 +331,11 @@ static bool sculpt_undo_restore_color(bContext *C, SculptUndoNode *unode)
if (unode->maxvert) {
/* regular mesh restore */
int *index = unode->index;
- MVert *mvert = ss->mvert;
MPropCol *vcol = ss->vcol;
for (int i = 0; i < unode->totvert; i++) {
copy_v4_v4(vcol[index[i]].color, unode->col[i]);
- mvert[index[i]].flag |= ME_VERT_PBVH_UPDATE;
+ BKE_pbvh_vert_mark_update(ss->pbvh, index[i]);
}
}
return true;
@@ -348,7 +347,6 @@ static bool sculpt_undo_restore_mask(bContext *C, SculptUndoNode *unode)
Object *ob = OBACT(view_layer);
SculptSession *ss = ob->sculpt;
SubdivCCG *subdiv_ccg = ss->subdiv_ccg;
- MVert *mvert;
float *vmask;
int *index;
@@ -356,13 +354,12 @@ static bool sculpt_undo_restore_mask(bContext *C, SculptUndoNode *unode)
/* Regular mesh restore. */
index = unode->index;
- mvert = ss->mvert;
vmask = ss->vmask;
for (int i = 0; i < unode->totvert; i++) {
if (vmask[index[i]] != unode->mask[i]) {
SWAP(float, vmask[index[i]], unode->mask[i]);
- mvert[index[i]].flag |= ME_VERT_PBVH_UPDATE;
+ BKE_pbvh_vert_mark_update(ss->pbvh, index[i]);
}
}
}
diff --git a/source/blender/makesdna/DNA_meshdata_types.h b/source/blender/makesdna/DNA_meshdata_types.h
index f2493bd5b85..66f59a78af9 100644
--- a/source/blender/makesdna/DNA_meshdata_types.h
+++ b/source/blender/makesdna/DNA_meshdata_types.h
@@ -51,7 +51,6 @@ enum {
ME_HIDE = (1 << 4),
ME_VERT_FACEDOT = (1 << 5),
/* ME_VERT_MERGED = (1 << 6), */
- ME_VERT_PBVH_UPDATE = (1 << 7),
};
/**