Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDalai Felinto <dfelinto@gmail.com>2019-02-09 00:52:28 +0300
committerDalai Felinto <dfelinto@gmail.com>2019-02-09 00:59:02 +0300
commite04d6794d017b82f33a893bfc959cebd909d3176 (patch)
tree236e66514a1c50dd5cbe8eda2a867b733b06ac9a /source/blender/editors/space_outliner
parent744223afbf4b99de167d4e36ee4783ac9754901e (diff)
Outliner Visibility: Alt+H operator to unhide all objects and collections
Diffstat (limited to 'source/blender/editors/space_outliner')
-rw-r--r--source/blender/editors/space_outliner/outliner_collections.c39
-rw-r--r--source/blender/editors/space_outliner/outliner_intern.h1
-rw-r--r--source/blender/editors/space_outliner/outliner_ops.c1
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)