diff options
author | Joseph Eagar <joeedh@gmail.com> | 2022-10-04 03:17:50 +0300 |
---|---|---|
committer | Joseph Eagar <joeedh@gmail.com> | 2022-10-04 03:19:50 +0300 |
commit | 22c3db72ca2f3d92852f463c184381ccf2998230 (patch) | |
tree | 1d0aebd9f7b912799ad8dbe1c2858aecc0a0fe59 /source/blender/editors/sculpt_paint/sculpt_face_set.cc | |
parent | 2cf21604c9130c56021525ed5af3f1fa59dcb19a (diff) |
Sculpt: Visibility bugfixes
* Unhide all is no longer part of face_set_change_visibility.
* Implemented a few visibility API methods for PBVH_BMESH
* Fixed bug with unhide all not freeing all multires grid_hidden
bitmaps.
Diffstat (limited to 'source/blender/editors/sculpt_paint/sculpt_face_set.cc')
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt_face_set.cc | 64 |
1 files changed, 2 insertions, 62 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt_face_set.cc b/source/blender/editors/sculpt_paint/sculpt_face_set.cc index 34717888966..894fa0a5d64 100644 --- a/source/blender/editors/sculpt_paint/sculpt_face_set.cc +++ b/source/blender/editors/sculpt_paint/sculpt_face_set.cc @@ -785,7 +785,6 @@ typedef enum eSculptFaceGroupVisibilityModes { SCULPT_FACE_SET_VISIBILITY_SHOW_ACTIVE = 1, SCULPT_FACE_SET_VISIBILITY_HIDE_ACTIVE = 2, SCULPT_FACE_SET_VISIBILITY_INVERT = 3, - SCULPT_FACE_SET_VISIBILITY_SHOW_ALL = 4, } eSculptFaceGroupVisibilityModes; static EnumPropertyItem prop_sculpt_face_sets_change_visibility_types[] = { @@ -817,13 +816,6 @@ static EnumPropertyItem prop_sculpt_face_sets_change_visibility_types[] = { "Invert Face Set Visibility", "Invert Face Set Visibility", }, - { - SCULPT_FACE_SET_VISIBILITY_SHOW_ALL, - "SHOW_ALL", - 0, - "Show All Face Sets", - "Show All Face Sets", - }, {0, nullptr, 0, nullptr, nullptr}, }; @@ -837,56 +829,13 @@ static int sculpt_face_sets_change_visibility_exec(bContext *C, wmOperator *op) BKE_sculpt_update_object_for_edit(depsgraph, ob, true, true, false); - /* Dyntopo not supported except for SCULPT_FACE_SET_VISIBILITY_SHOW_ALL. */ + /* Not supported for dyntopo. */ if (BKE_pbvh_type(ss->pbvh) == PBVH_BMESH) { - if (ss->pbvh && ss->bm && - RNA_enum_get(op->ptr, "mode") == SCULPT_FACE_SET_VISIBILITY_SHOW_ALL) { - PBVHNode **nodes; - int totnode; - - BKE_pbvh_search_gather(ss->pbvh, nullptr, nullptr, &nodes, &totnode); - - if (!totnode) { - return OPERATOR_CANCELLED; - } - - SCULPT_undo_push_begin(ob, op); - SCULPT_undo_push_node(ob, nodes[0], SCULPT_UNDO_COORDS); - - for (int i = 0; i < totnode; i++) { - BKE_pbvh_node_mark_update_visibility(nodes[i]); - } - - BMIter iter; - BMFace *f; - BMVert *v; - const int cd_mask = CustomData_get_offset(&ss->bm->vdata, CD_PAINT_MASK); - - BM_ITER_MESH (v, &iter, ss->bm, BM_VERTS_OF_MESH) { - BM_log_vert_before_modified(ss->bm_log, v, cd_mask); - } - BM_ITER_MESH (f, &iter, ss->bm, BM_FACES_OF_MESH) { - BM_log_face_modified(ss->bm_log, f); - } - - SCULPT_face_visibility_all_set(ss, true); - SCULPT_visibility_sync_all_from_faces(ob); - - SCULPT_undo_push_end(ob); - MEM_SAFE_FREE(nodes); - - return OPERATOR_FINISHED; - } - return OPERATOR_CANCELLED; } - if (!ss->face_sets) { - return OPERATOR_CANCELLED; - } - - const int tot_vert = SCULPT_vertex_count_get(ss); const int mode = RNA_enum_get(op->ptr, "mode"); + const int tot_vert = SCULPT_vertex_count_get(ss); const int active_face_set = SCULPT_active_face_set_get(ss); SCULPT_undo_push_begin(ob, op); @@ -940,15 +889,6 @@ static int sculpt_face_sets_change_visibility_exec(bContext *C, wmOperator *op) } } - if (mode == SCULPT_FACE_SET_VISIBILITY_SHOW_ALL) { - /* As an optimization, free the hide attribute when making all geometry visible. This allows - * reduced memory usage without manually clearing it later, and allows sculpt operations to - * avoid checking element's hide status. */ - CustomData_free_layer_named(&mesh->pdata, ".hide_poly", mesh->totpoly); - ss->hide_poly = nullptr; - BKE_pbvh_update_hide_attributes_from_mesh(pbvh); - } - if (mode == SCULPT_FACE_SET_VISIBILITY_SHOW_ACTIVE) { ss->hide_poly = BKE_sculpt_hide_poly_ensure(mesh); SCULPT_face_visibility_all_set(ss, false); |