Sculpt: Remove redundant "reveal all" operator #115629

Merged
Hans Goudey merged 3 commits from HooglyBoogly/blender:sculpt-remove-hide-show into main 2023-12-01 17:32:18 +01:00
4 changed files with 8 additions and 96 deletions

View File

@ -5403,9 +5403,8 @@ def km_sculpt(params):
{"properties": [("mode", 'TOGGLE')]}),
("sculpt.face_set_change_visibility", {"type": 'H', "value": 'PRESS'},
{"properties": [("mode", 'HIDE_ACTIVE')]}),
("sculpt.reveal_all", {"type": 'H', "value": 'PRESS', "alt": True},
{"properties": []}),
("paint.hide_show", {"type": 'H', "value": 'PRESS', "alt": True},
{"properties": [("action", "SHOW"), ("area", "ALL")]}),
("sculpt.face_set_edit", {"type": 'W', "value": 'PRESS', "ctrl": True},
{"properties": [("mode", 'GROW')]}),
("sculpt.face_set_edit", {"type": 'W', "value": 'PRESS', "ctrl": True, "alt": True},

View File

@ -3702,8 +3702,6 @@ def km_sculpt(params):
{"properties": [("mode", 'TOGGLE')]}),
("paint.hide_show", {"type": 'H', "value": 'PRESS', "ctrl": True},
{"properties": [("action", 'HIDE'), ("area", 'MASKED')]}),
("sculpt.reveal_all", {"type": 'H', "value": 'PRESS', "alt": True},
{"properties": []}),
("paint.hide_show", {"type": 'H', "value": 'PRESS', "alt": True},
{"properties": [("action", 'SHOW'), ("area", 'ALL')]}),
# Subdivision levels

View File

@ -3785,7 +3785,9 @@ class VIEW3D_MT_face_sets(Menu):
layout.operator("sculpt.face_set_invert_visibility", text="Invert Visible Face Sets")
props = layout.operator("sculpt.reveal_all", text="Show All Face Sets")
props = layout.operator("paint.hide_show", text="Show All Face Sets")
props.action = "SHOW"
props.area = "ALL"
layout.separator()
@ -6138,7 +6140,9 @@ class VIEW3D_MT_sculpt_face_sets_edit_pie(Menu):
pie.operator("sculpt.face_set_invert_visibility", text="Invert Visible")
props = pie.operator("sculpt.reveal_all", text="Show All")
props = pie.operator("paint.hide_show", text="Show All")
props.action = "SHOW"
props.area = "ALL"
class VIEW3D_MT_wpaint_vgroup_lock_pie(Menu):

View File

@ -1262,94 +1262,6 @@ static void SCULPT_OT_mask_from_cavity(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "invert", false, "Cavity (Inverted)", "");
}
static int sculpt_reveal_all_exec(bContext *C, wmOperator *op)
{
Object *ob = CTX_data_active_object(C);
SculptSession *ss = ob->sculpt;
Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C);
Mesh *mesh = BKE_object_get_original_mesh(ob);
BKE_sculpt_update_object_for_edit(depsgraph, ob, true, true, false);
if (!ss->pbvh) {
return OPERATOR_CANCELLED;
}
bool with_bmesh = BKE_pbvh_type(ss->pbvh) == PBVH_BMESH;
blender::Vector<PBVHNode *> nodes = blender::bke::pbvh::search_gather(ss->pbvh, {});
if (nodes.is_empty()) {
return OPERATOR_CANCELLED;
}
/* Propagate face hide state to verts for undo. */
SCULPT_visibility_sync_all_from_faces(ob);
SCULPT_undo_push_begin(ob, op);
for (PBVHNode *node : nodes) {
BKE_pbvh_node_mark_update_visibility(node);
if (!with_bmesh) {
SCULPT_undo_push_node(ob, node, SCULPT_UNDO_HIDDEN);
}
}
SCULPT_topology_islands_invalidate(ss);
if (!with_bmesh) {
/* 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->face_data, ".hide_poly", mesh->faces_num);
ss->hide_poly = nullptr;
}
else {
SCULPT_undo_push_node(ob, nodes[0], SCULPT_UNDO_HIDDEN);
BMIter iter;
BMFace *f;
BMVert *v;
const int cd_mask = CustomData_get_offset_named(&ss->bm->vdata, CD_PROP_FLOAT, ".sculpt_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);
BKE_pbvh_update_visibility(ss->pbvh);
SCULPT_undo_push_end(ob);
SCULPT_tag_update_overlays(C);
DEG_id_tag_update(&ob->id, ID_RECALC_SHADING);
ED_region_tag_redraw(CTX_wm_region(C));
return OPERATOR_FINISHED;
}
static void SCULPT_OT_reveal_all(wmOperatorType *ot)
{
/* Identifiers. */
ot->name = "Reveal All";
ot->idname = "SCULPT_OT_reveal_all";
ot->description = "Unhide all geometry";
/* Api callbacks. */
ot->exec = sculpt_reveal_all_exec;
ot->poll = SCULPT_mode_poll;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
void ED_operatortypes_sculpt()
{
WM_operatortype_append(SCULPT_OT_brush_stroke);
@ -1385,7 +1297,6 @@ void ED_operatortypes_sculpt()
WM_operatortype_append(SCULPT_OT_expand);
WM_operatortype_append(SCULPT_OT_mask_from_cavity);
WM_operatortype_append(SCULPT_OT_reveal_all);
}
void ED_keymap_sculpt(wmKeyConfig *keyconf)