diff options
author | Pablo Dobarro <pablodp606@gmail.com> | 2020-07-08 19:10:31 +0300 |
---|---|---|
committer | Pablo Dobarro <pablodp606@gmail.com> | 2020-07-09 18:51:09 +0300 |
commit | 78b629a98f0c7c5c2c8f3b6b6d1081646cbe6fde (patch) | |
tree | b2655ac064677f945fe813dee495beaed046c5ac /source/blender/editors/sculpt_paint | |
parent | 1fb667da013f19124eb4440411c28996d97f67f8 (diff) |
Sculpt: Skip fully hidden nodes in sculpt tools
As tools iterators skip not visible vertices, fully hidden nodes can
also be skipped and considered as masked.
Reviewed By: sergey
Differential Revision: https://developer.blender.org/D8244
Diffstat (limited to 'source/blender/editors/sculpt_paint')
-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 |
3 files changed, 13 insertions, 9 deletions
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; |