diff options
Diffstat (limited to 'source/blender')
3 files changed, 41 insertions, 0 deletions
diff --git a/source/blender/editors/space_outliner/outliner_collections.c b/source/blender/editors/space_outliner/outliner_collections.c index b0446b97597..a07fe4b9e15 100644 --- a/source/blender/editors/space_outliner/outliner_collections.c +++ b/source/blender/editors/space_outliner/outliner_collections.c @@ -1253,6 +1253,45 @@ void OUTLINER_OT_hide(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } +static int outliner_unhide_all_exec(bContext *C, wmOperator *UNUSED(op)) +{ + Scene *scene = CTX_data_scene(C); + ViewLayer *view_layer = CTX_data_view_layer(C); + + /* Unhide all the collections. */ + LayerCollection *lc_master = view_layer->layer_collections.first; + for (LayerCollection *lc_iter = lc_master->layer_collections.first; lc_iter; lc_iter = lc_iter->next) { + lc_iter->flag &= ~LAYER_COLLECTION_RESTRICT_VIEW; + layer_collection_flag_recursive_set(lc_iter, LAYER_COLLECTION_RESTRICT_VIEW); + } + + /* Unhide all objects. */ + for (Base *base = view_layer->object_bases.first; base; base = base->next) { + base->flag &= ~BASE_HIDDEN; + } + + BKE_layer_collection_sync(scene, view_layer); + DEG_id_tag_update(&scene->id, ID_RECALC_BASE_FLAGS); + + WM_main_add_notifier(NC_SCENE | ND_LAYER_CONTENT, NULL); + return OPERATOR_FINISHED; +} + +void OUTLINER_OT_unhide_all(wmOperatorType *ot) +{ + /* identifiers */ + ot->name = "Unhide All"; + ot->idname = "OUTLINER_OT_unhide_all"; + ot->description = "Unhide all objects and collections"; + + /* api callbacks */ + ot->exec = outliner_unhide_all_exec; + ot->poll = outliner_view_layer_collections_editor_poll; + + /* flags */ + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; +} + /** * Populates the \param objects: ListBase with all the outliner selected objects * We store it as (Object *)LinkData->data diff --git a/source/blender/editors/space_outliner/outliner_intern.h b/source/blender/editors/space_outliner/outliner_intern.h index 52deda50c2a..80d734c77f2 100644 --- a/source/blender/editors/space_outliner/outliner_intern.h +++ b/source/blender/editors/space_outliner/outliner_intern.h @@ -337,6 +337,7 @@ void OUTLINER_OT_collection_disable(struct wmOperatorType *ot); void OUTLINER_OT_collection_enable_render(struct wmOperatorType *ot); void OUTLINER_OT_collection_disable_render(struct wmOperatorType *ot); void OUTLINER_OT_hide(struct wmOperatorType *ot); +void OUTLINER_OT_unhide_all(struct wmOperatorType *ot); /* outliner_utils.c ---------------------------------------------- */ diff --git a/source/blender/editors/space_outliner/outliner_ops.c b/source/blender/editors/space_outliner/outliner_ops.c index e1f82ad9cda..b296b9edcd6 100644 --- a/source/blender/editors/space_outliner/outliner_ops.c +++ b/source/blender/editors/space_outliner/outliner_ops.c @@ -115,6 +115,7 @@ void outliner_operatortypes(void) WM_operatortype_append(OUTLINER_OT_collection_hide_inside); WM_operatortype_append(OUTLINER_OT_collection_show_inside); WM_operatortype_append(OUTLINER_OT_hide); + WM_operatortype_append(OUTLINER_OT_unhide_all); } void outliner_keymap(wmKeyConfig *keyconf) |