diff options
-rw-r--r-- | source/blender/blenkernel/BKE_pbvh.h | 1 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/pbvh.c | 5 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt.c | 15 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt_filter_mesh.c | 2 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt_intern.h | 5 |
5 files changed, 19 insertions, 9 deletions
diff --git a/source/blender/blenkernel/BKE_pbvh.h b/source/blender/blenkernel/BKE_pbvh.h index 87875314aec..f5e2ea51927 100644 --- a/source/blender/blenkernel/BKE_pbvh.h +++ b/source/blender/blenkernel/BKE_pbvh.h @@ -264,6 +264,7 @@ void BKE_pbvh_node_mark_redraw(PBVHNode *node); void BKE_pbvh_node_mark_normals_update(PBVHNode *node); void BKE_pbvh_node_mark_topology_update(PBVHNode *node); void BKE_pbvh_node_fully_hidden_set(PBVHNode *node, int fully_hidden); +bool BKE_pbvh_node_fully_hidden_get(PBVHNode *node); void BKE_pbvh_node_fully_masked_set(PBVHNode *node, int fully_masked); bool BKE_pbvh_node_fully_masked_get(PBVHNode *node); void BKE_pbvh_node_fully_unmasked_set(PBVHNode *node, int fully_masked); diff --git a/source/blender/blenkernel/intern/pbvh.c b/source/blender/blenkernel/intern/pbvh.c index 77ff469a012..870a1f3d673 100644 --- a/source/blender/blenkernel/intern/pbvh.c +++ b/source/blender/blenkernel/intern/pbvh.c @@ -1772,6 +1772,11 @@ void BKE_pbvh_node_fully_hidden_set(PBVHNode *node, int fully_hidden) } } +bool BKE_pbvh_node_fully_hidden_get(PBVHNode *node) +{ + return (node->flag & PBVH_Leaf) && (node->flag & PBVH_FullyHidden); +} + void BKE_pbvh_node_fully_masked_set(PBVHNode *node, int fully_masked) { BLI_assert(node->flag & PBVH_Leaf); diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 7db6b07c911..14a66fb428e 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -2471,7 +2471,10 @@ bool SCULPT_search_sphere_cb(PBVHNode *node, void *data_v) } float t[3], bb_min[3], bb_max[3]; - if (data->ignore_fully_masked) { + if (data->ignore_fully_ineffective) { + if (BKE_pbvh_node_fully_hidden_get(node)) { + return false; + } if (BKE_pbvh_node_fully_masked_get(node)) { return false; } @@ -2507,7 +2510,7 @@ bool SCULPT_search_circle_cb(PBVHNode *node, void *data_v) SculptSearchCircleData *data = data_v; float bb_min[3], bb_max[3]; - if (data->ignore_fully_masked) { + if (data->ignore_fully_ineffective) { if (BKE_pbvh_node_fully_masked_get(node)) { return false; } @@ -2560,7 +2563,7 @@ static PBVHNode **sculpt_pbvh_gather_cursor_update(Object *ob, .sd = sd, .radius_squared = ss->cursor_radius, .original = use_original, - .ignore_fully_masked = false, + .ignore_fully_ineffective = false, .center = NULL, }; BKE_pbvh_search_gather(ss->pbvh, SCULPT_search_sphere_cb, &data, &nodes, r_totnode); @@ -2585,7 +2588,7 @@ static PBVHNode **sculpt_pbvh_gather_generic(Object *ob, .sd = sd, .radius_squared = square_f(ss->cache->radius * radius_scale), .original = use_original, - .ignore_fully_masked = brush->sculpt_tool != SCULPT_TOOL_MASK, + .ignore_fully_ineffective = brush->sculpt_tool != SCULPT_TOOL_MASK, .center = NULL, }; BKE_pbvh_search_gather(ss->pbvh, SCULPT_search_sphere_cb, &data, &nodes, r_totnode); @@ -2601,7 +2604,7 @@ static PBVHNode **sculpt_pbvh_gather_generic(Object *ob, ss->cursor_radius, .original = use_original, .dist_ray_to_aabb_precalc = &dist_ray_to_aabb_precalc, - .ignore_fully_masked = brush->sculpt_tool != SCULPT_TOOL_MASK, + .ignore_fully_ineffective = brush->sculpt_tool != SCULPT_TOOL_MASK, }; BKE_pbvh_search_gather(ss->pbvh, SCULPT_search_circle_cb, &data, &nodes, r_totnode); } @@ -5482,7 +5485,7 @@ static void do_brush_action(Sculpt *sd, Object *ob, Brush *brush, UnifiedPaintSe .sd = sd, .radius_squared = square_f(ss->cache->radius * (1.0 + brush->cloth_sim_limit)), .original = false, - .ignore_fully_masked = false, + .ignore_fully_ineffective = false, .center = ss->cache->initial_location, }; BKE_pbvh_search_gather(ss->pbvh, SCULPT_search_sphere_cb, &data, &nodes, &totnode); diff --git a/source/blender/editors/sculpt_paint/sculpt_filter_mesh.c b/source/blender/editors/sculpt_paint/sculpt_filter_mesh.c index 494588d0996..27dd0ab3e71 100644 --- a/source/blender/editors/sculpt_paint/sculpt_filter_mesh.c +++ b/source/blender/editors/sculpt_paint/sculpt_filter_mesh.c @@ -87,7 +87,7 @@ void SCULPT_filter_cache_init(Object *ob, Sculpt *sd, const int undo_type) .original = true, .center = center, .radius_squared = FLT_MAX, - .ignore_fully_masked = true, + .ignore_fully_ineffective = true, }; BKE_pbvh_search_gather(pbvh, diff --git a/source/blender/editors/sculpt_paint/sculpt_intern.h b/source/blender/editors/sculpt_paint/sculpt_intern.h index c7e07721eb7..90f27bf71a3 100644 --- a/source/blender/editors/sculpt_paint/sculpt_intern.h +++ b/source/blender/editors/sculpt_paint/sculpt_intern.h @@ -676,7 +676,8 @@ typedef struct { float radius_squared; const float *center; bool original; - bool ignore_fully_masked; + /* This ignores fully masked and fully hidden nodes. */ + bool ignore_fully_ineffective; } SculptSearchSphereData; typedef struct { @@ -684,7 +685,7 @@ typedef struct { struct SculptSession *ss; float radius_squared; bool original; - bool ignore_fully_masked; + bool ignore_fully_ineffective; struct DistRayAABB_Precalc *dist_ray_to_aabb_precalc; } SculptSearchCircleData; |