diff options
author | Pablo Dobarro <pablodp606@gmail.com> | 2020-10-12 01:46:50 +0300 |
---|---|---|
committer | Pablo Dobarro <pablodp606@gmail.com> | 2020-10-15 20:39:11 +0300 |
commit | ef5f3070315ea130479c1c646ef889c98825b475 (patch) | |
tree | 1051df86e857bcbbbcb16766145b32f5ea4f8977 /source/blender/editors/sculpt_paint/sculpt_face_set.c | |
parent | 750e4e1158bb1bd40c1724e24693cb22c6910f86 (diff) |
Sculpt: Use mpoly flags to sync Face Sets visibility
Previously, all Face Set visibility logic was using mvert flags directly
to store the visibility state on the vertices while sculpting. As Face
Sets are a poly attribute, it is much simpler to use mpoly flags and let
BKE_mesh_flush_hidden_from_polys handle the vertex visibility, even for
Multires.
Now all operators that update the Face Set visibility state will always
copy the visibility to the mesh (using poly flags) and the grids, all
using the same code.
This should fix a lot of visibility glitches and bugs like the following:
- Sculpt visibility reset when changing multires levels.
- Multires visibility not updating in edit mode.
- Single face visibible when surrounded by visibile face set, even when
the face set was hidden.
Reviewed By: sergey
Differential Revision: https://developer.blender.org/D9175
Diffstat (limited to 'source/blender/editors/sculpt_paint/sculpt_face_set.c')
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt_face_set.c | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt_face_set.c b/source/blender/editors/sculpt_paint/sculpt_face_set.c index dae4b068e93..152d23dfa5b 100644 --- a/source/blender/editors/sculpt_paint/sculpt_face_set.c +++ b/source/blender/editors/sculpt_paint/sculpt_face_set.c @@ -720,7 +720,7 @@ static int sculpt_face_set_init_exec(bContext *C, wmOperator *op) SCULPT_undo_push_end(); /* Sync face sets visibility and vertex visibility as now all Face Sets are visible. */ - SCULPT_visibility_sync_all_face_sets_to_vertices(ss); + SCULPT_visibility_sync_all_face_sets_to_vertices(ob); for (int i = 0; i < totnode; i++) { BKE_pbvh_node_mark_update_visibility(nodes[i]); @@ -889,12 +889,6 @@ static int sculpt_face_sets_change_visibility_exec(bContext *C, wmOperator *op) if (mode == SCULPT_FACE_SET_VISIBILITY_SHOW_ACTIVE) { SCULPT_face_sets_visibility_all_set(ss, false); SCULPT_face_set_visibility_set(ss, active_face_set, true); - for (int i = 0; i < tot_vert; i++) { - SCULPT_vertex_visible_set(ss, - i, - SCULPT_vertex_visible_get(ss, i) && - SCULPT_vertex_has_face_set(ss, i, active_face_set)); - } } if (mode == SCULPT_FACE_SET_VISIBILITY_HIDE_ACTIVE) { @@ -918,7 +912,7 @@ static int sculpt_face_sets_change_visibility_exec(bContext *C, wmOperator *op) } /* Sync face sets visibility and vertex visibility. */ - SCULPT_visibility_sync_all_face_sets_to_vertices(ss); + SCULPT_visibility_sync_all_face_sets_to_vertices(ob); SCULPT_undo_push_end(); @@ -930,10 +924,6 @@ static int sculpt_face_sets_change_visibility_exec(bContext *C, wmOperator *op) MEM_SAFE_FREE(nodes); - if (BKE_pbvh_type(pbvh) == PBVH_FACES) { - BKE_mesh_flush_hidden_from_verts(ob->data); - } - ED_region_tag_redraw(region); DEG_id_tag_update(&ob->id, ID_RECALC_SHADING); @@ -1194,7 +1184,7 @@ static int sculpt_face_set_edit_invoke(bContext *C, wmOperator *op, const wmEven SCULPT_undo_push_end(); /* Sync face sets visibility and vertex visibility as now all Face Sets are visible. */ - SCULPT_visibility_sync_all_face_sets_to_vertices(ss); + SCULPT_visibility_sync_all_face_sets_to_vertices(ob); for (int i = 0; i < totnode; i++) { BKE_pbvh_node_mark_update_visibility(nodes[i]); |