diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2019-08-19 20:25:29 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2019-09-13 18:37:35 +0300 |
commit | 92736a7b75920ffe4b8016a2d097ff8e36687c70 (patch) | |
tree | 33594ff97ce96124481ce9d898ea31158f91236c /release | |
parent | ce34a6b0d727bbde6ae373afa8ec6c42bc8980ce (diff) |
Per-Viewport Collection Visibility
Support per-viewport collection visibility options.
Note 1: There is no way to show a collection that was not visible before
due to depsgraph. Otherwise we would risk having all the collections in
the depsgraph and I believe this is not the idea.
An alternative would be to have a new depsgraph for viewports that are
not local. Something to keep in mind if we do per-viewport current frame
in the future.
So for now what we do is to only allow collections visibility to be
disabled/hidden in this mode.
Note 2: hide_viewport (the eye icon) doesn't really matter for
depsgraph. So after the merge we can still ignore it to show the
collections locally in a viewport with no problems for the depsgraph.
Reviewers: brecht, sergey
Subscribers: billreynish
Related task: T61327
Differential Revision: https://developer.blender.org/D5611
Diffstat (limited to 'release')
-rw-r--r-- | release/scripts/startup/bl_ui/space_view3d.py | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index e98a3684ddc..acb42e0545b 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -4997,7 +4997,7 @@ class VIEW3D_PT_collections(Panel): bl_label = "Collections" bl_options = {'DEFAULT_CLOSED'} - def _draw_collection(self, layout, view_layer, collection, index): + def _draw_collection(self, layout, view_layer, use_local_collections, collection, index): need_separator = index for child in collection.children: index += 1 @@ -5023,6 +5023,7 @@ class VIEW3D_PT_collections(Panel): pass row = layout.row() + row.use_property_decorate = False sub = row.split(factor=0.98) subrow = sub.row() subrow.alignment = 'LEFT' @@ -5033,11 +5034,21 @@ class VIEW3D_PT_collections(Panel): sub = row.split() subrow = sub.row(align=True) subrow.alignment = 'RIGHT' - subrow.active = collection.is_visible # Parent collection runtime visibility - subrow.prop(child, "hide_viewport", text="", emboss=False) + if not use_local_collections: + subrow.active = collection.is_visible # Parent collection runtime visibility + subrow.prop(child, "hide_viewport", text="", emboss=False) + elif not child.is_visible: + subrow.active = False + subrow.label(text="", icon='REMOVE') + else: + subrow.active = collection.visible_get() # Parent collection runtime visibility + icon = 'HIDE_OFF' if child.visible_get() else 'HIDE_ON' + props = subrow.operator("object.hide_collection", text="", icon=icon, emboss=False) + props.collection_index = index + props.toggle = True for child in collection.children: - index = self._draw_collection(layout, view_layer, child, index) + index = self._draw_collection(layout, view_layer, use_local_collections, child, index) return index @@ -5045,11 +5056,17 @@ class VIEW3D_PT_collections(Panel): layout = self.layout layout.use_property_split = False + view = context.space_data view_layer = context.view_layer + + layout.use_property_split = True + layout.prop(view, "use_local_collections") + layout.separator() + # We pass index 0 here because the index is increased # so the first real index is 1 # And we start with index as 1 because we skip the master collection - self._draw_collection(layout, view_layer, view_layer.layer_collection, 0) + self._draw_collection(layout, view_layer, view.use_local_collections, view_layer.layer_collection, 0) class VIEW3D_PT_object_type_visibility(Panel): |