diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2018-11-30 07:24:06 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2019-02-06 00:32:58 +0300 |
commit | 897e047374fa3d3ceef35aa2cdb3372b6a7cc64a (patch) | |
tree | 5554fb11f9bf40f55d78c88e7443a5b6b4999dae /source/blender/depsgraph | |
parent | e3f7f0c3ebd3c1aa546fa212c3d67d050fab2e41 (diff) |
Outliner visibility unification: Implement 3 levels of viewport visibility
Now collection and objects can be either:
* Disabled for all the view layers.
* Hidden for a view layer but not necessarily for all others.
* Visible for a view layer but not necessarily for all others.
Regarding icons: Whatever we decide to use for the "Hidden for all view
layers" needs to be a toggle-like icon. Because when viewing "Scenes"
instead of "View Layer" in the outliner we should be able to edit the
collection "Hidden for all the view layers" as an on/off option.
The operators are accessible via a Visibility context menu or shortcuts:
* Ctrl + Click: Isolate collection (use shift to extend).
* Alt + Click: Disable collection.
* Shift + Click: Hide/Show collection and its children (objects and collections)
Things yet to be tackled:
* Object outliner context menu can also get a Visibility sub-menu.
* Get better icons for viewport enable/disable.
Note:
* When using emulate 3 button mouse alt+click is used for 2d panning.
In this case users have to use the operator from the menu.
See T57857 for discussion.
Patch: https://developer.blender.org/D4011
Reviewers: brecht and sergey
Thanks to the reviewers and William Reynish and Julien Kasper in
particular for the feedback.
Diffstat (limited to 'source/blender/depsgraph')
3 files changed, 10 insertions, 20 deletions
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes_view_layer.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes_view_layer.cc index 00981d75665..cc2d58dbe51 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes_view_layer.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes_view_layer.cc @@ -64,11 +64,6 @@ void DepsgraphNodeBuilder::build_layer_collections(ListBase *lb) COLLECTION_RESTRICT_VIEW : COLLECTION_RESTRICT_RENDER; for (LayerCollection *lc = (LayerCollection *)lb->first; lc; lc = lc->next) { - if ((graph_->mode == DAG_EVAL_VIEWPORT) && - ((lc->flag & LAYER_COLLECTION_RESTRICT_VIEW) != 0)) - { - continue; - } if (lc->collection->flag & restrict_flag) { continue; } diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations_view_layer.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations_view_layer.cc index 7f4a388718f..c0fe5243e58 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations_view_layer.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations_view_layer.cc @@ -65,11 +65,6 @@ void DepsgraphRelationBuilder::build_layer_collections(ListBase *lb) COLLECTION_RESTRICT_VIEW : COLLECTION_RESTRICT_RENDER; for (LayerCollection *lc = (LayerCollection *)lb->first; lc; lc = lc->next) { - if ((graph_->mode == DAG_EVAL_VIEWPORT) && - ((lc->flag & LAYER_COLLECTION_RESTRICT_VIEW) != 0)) - { - continue; - } if ((lc->collection->flag & restrict_flag)) { continue; } diff --git a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc index ff3128a2fb6..c705026b640 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc @@ -359,23 +359,23 @@ void scene_remove_unused_view_layers(const Depsgraph *depsgraph, scene_cow->view_layers.last = view_layer_eval; } -/* Makes it so given view layer only has bases corresponding to a visible +/* Makes it so given view layer only has bases corresponding to enabled * objects. */ -void view_layer_remove_invisible_bases(const Depsgraph *depsgraph, - ViewLayer *view_layer) +void view_layer_remove_disabled_bases(const Depsgraph *depsgraph, + ViewLayer *view_layer) { - const int base_visible_flag = (depsgraph->mode == DAG_EVAL_VIEWPORT) ? + const int base_enabled_flag = (depsgraph->mode == DAG_EVAL_VIEWPORT) ? BASE_ENABLED_VIEWPORT : BASE_ENABLED_RENDER; - ListBase visible_bases = {NULL, NULL}; + ListBase enabled_bases = {NULL, NULL}; for (Base *base = reinterpret_cast<Base *>(view_layer->object_bases.first), *base_next; base != NULL; base = base_next) { base_next = base->next; - const bool is_object_visible = (base->flag & base_visible_flag); - if (is_object_visible) { - BLI_addtail(&visible_bases, base); + const bool is_object_enabled = (base->flag & base_enabled_flag); + if (is_object_enabled) { + BLI_addtail(&enabled_bases, base); } else { if (base == view_layer->basact) { @@ -384,13 +384,13 @@ void view_layer_remove_invisible_bases(const Depsgraph *depsgraph, MEM_freeN(base); } } - view_layer->object_bases = visible_bases; + view_layer->object_bases = enabled_bases; } void scene_cleanup_view_layers(const Depsgraph *depsgraph, Scene *scene_cow) { scene_remove_unused_view_layers(depsgraph, scene_cow); - view_layer_remove_invisible_bases( + view_layer_remove_disabled_bases( depsgraph, reinterpret_cast<ViewLayer *>(scene_cow->view_layers.first)); /* TODO(sergey): Remove objects from collections as well. |