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/makesrna/intern/rna_layer.c | |
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/makesrna/intern/rna_layer.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_layer.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/source/blender/makesrna/intern/rna_layer.c b/source/blender/makesrna/intern/rna_layer.c index 82082ec6022..0fb48652c2c 100644 --- a/source/blender/makesrna/intern/rna_layer.c +++ b/source/blender/makesrna/intern/rna_layer.c @@ -196,7 +196,7 @@ int rna_LayerCollection_name_length(PointerRNA *ptr) return strlen(id->name + 2); } -static void rna_LayerCollection_use_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr) +static void rna_LayerCollection_exclude_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr) { Scene *scene = (Scene *)ptr->id.data; LayerCollection *lc = (LayerCollection *)ptr->data; @@ -209,6 +209,19 @@ static void rna_LayerCollection_use_update(Main *bmain, Scene *UNUSED(scene), Po WM_main_add_notifier(NC_SCENE | ND_LAYER_CONTENT, NULL); } +static void rna_LayerCollection_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) +{ + Scene *scene = (Scene *)ptr->id.data; + LayerCollection *lc = (LayerCollection *)ptr->data; + ViewLayer *view_layer = BKE_view_layer_find_from_collection(scene, lc); + + 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); +} + static bool rna_LayerCollection_has_objects(LayerCollection *lc) { return (lc->runtime_flag & LAYER_COLLECTION_HAS_OBJECTS) != 0; @@ -273,13 +286,13 @@ static void rna_def_layer_collection(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "flag", LAYER_COLLECTION_EXCLUDE); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Exclude", "Exclude collection from view layer"); - RNA_def_property_update(prop, NC_SCENE | ND_LAYER, "rna_LayerCollection_use_update"); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER, "rna_LayerCollection_exclude_update"); prop = RNA_def_property(srna, "holdout", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", LAYER_COLLECTION_HOLDOUT); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Holdout", "Mask out objects in collection from view layer"); - RNA_def_property_update(prop, NC_SCENE | ND_LAYER, "rna_LayerCollection_use_update"); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER, "rna_LayerCollection_update"); prop = RNA_def_property(srna, "indirect_only", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", LAYER_COLLECTION_INDIRECT_ONLY); @@ -287,14 +300,14 @@ static void rna_def_layer_collection(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Indirect Only", "Objects in collection only contribute indirectly (through shadows and reflections) " "in the view layer"); - RNA_def_property_update(prop, NC_SCENE | ND_LAYER, "rna_LayerCollection_use_update"); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER, "rna_LayerCollection_update"); prop = RNA_def_property(srna, "hide_viewport", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", LAYER_COLLECTION_RESTRICT_VIEW); RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); RNA_def_property_ui_icon(prop, ICON_HIDE_OFF, -1); RNA_def_property_ui_text(prop, "Disable Viewport", "Disable collection in viewport for this view layer"); - RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_LayerCollection_use_update"); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_LayerCollection_update"); prop = RNA_def_property(srna, "is_visible", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "runtime_flag", LAYER_COLLECTION_VISIBLE); |