UI: Notification When Hiding Objects

This shows a "2 object(s) hidden" notification on the status bar when
hiding objects, the same as we do when deleting objects.  Pressing "H"
can be done accidentally so this is at least some indication of what
happened, both on the status bar in Info Editor. Obviously does nothing
if nothing is selected when you press "H"

Pull Request: https://projects.blender.org/blender/blender/pulls/130617
This commit is contained in:
Harley Acheson
2024-11-20 20:10:51 +01:00
committed by Harley Acheson
parent cf1a3cb41f
commit bc5fcbe1c3

View File

@@ -334,6 +334,8 @@ static int object_hide_view_set_exec(bContext *C, wmOperator *op)
ViewLayer *view_layer = CTX_data_view_layer(C);
const bool unselected = RNA_boolean_get(op->ptr, "unselected");
bool changed = false;
const bool confirm = op->flag & OP_IS_INVOKE;
int hide_count = 0;
/* Hide selected or unselected objects. */
BKE_view_layer_synced_ensure(scene, view_layer);
@@ -346,6 +348,7 @@ static int object_hide_view_set_exec(bContext *C, wmOperator *op)
if (base->flag & BASE_SELECTED) {
base_select(base, BA_DESELECT);
base->flag |= BASE_HIDDEN;
hide_count++;
changed = true;
}
}
@@ -353,6 +356,7 @@ static int object_hide_view_set_exec(bContext *C, wmOperator *op)
if (!(base->flag & BASE_SELECTED)) {
base_select(base, BA_DESELECT);
base->flag |= BASE_HIDDEN;
hide_count++;
changed = true;
}
}
@@ -361,6 +365,10 @@ static int object_hide_view_set_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
if (hide_count > 0 && confirm) {
BKE_reportf(op->reports, RPT_INFO, "%u object(s) hidden", (hide_count));
}
BKE_view_layer_need_resync_tag(view_layer);
DEG_id_tag_update(&scene->id, ID_RECALC_BASE_FLAGS);
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);