[Bf-blender-cvs] [098e807f9ef] blender2.8: Viewport collections visibility popover
Dalai Felinto
noreply at git.blender.org
Thu Nov 15 14:52:50 CET 2018
Commit: 098e807f9ef5f303a3da7a974bbff1614c6d2e1d
Author: Dalai Felinto
Date: Thu Nov 15 11:35:14 2018 -0200
Branches: blender2.8
https://developer.blender.org/rB098e807f9ef5f303a3da7a974bbff1614c6d2e1d
Viewport collections visibility popover
This brings the functionality currently in the H shortcut, to hide/show
individual collections.
In order to convey hierarchy, and to make justice to the originally
intended 1-10 shortcuts, we group the collections per siblings.
===================================================================
M release/scripts/startup/bl_ui/space_view3d.py
===================================================================
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index 095f1e73eac..236470af279 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -245,6 +245,13 @@ class VIEW3D_HT_header(Header):
layout.separator_spacer()
+ # Collection Visibility
+ layout.popover(
+ panel="VIEW3D_PT_collections",
+ icon='GROUP',
+ text="",
+ )
+
# Viewport Settings
layout.popover(
panel="VIEW3D_PT_object_type_visibility",
@@ -4000,6 +4007,57 @@ class VIEW3D_PT_view3d_cursor(Panel):
layout.column().prop(view, "cursor_location", text="Location")
+class VIEW3D_PT_collections(Panel):
+ bl_space_type = 'VIEW_3D'
+ bl_region_type = 'HEADER'
+ bl_label = "Collections Visibility"
+ bl_ui_units_x = 7
+
+ def _draw_collection(self, layout, view_layer, collection, index):
+ need_separator = index
+ for child in collection.children:
+ index += 1
+
+ if child.exclude:
+ continue
+
+ if child.collection.hide_viewport:
+ continue
+
+ if need_separator:
+ layout.separator()
+ need_separator = False
+
+ icon = 'BLANK1'
+ if child.has_selected_objects(view_layer):
+ icon = 'LAYER_ACTIVE'
+ elif child.has_objects():
+ icon = 'LAYER_USED'
+
+ row = layout.row()
+ row.alignment = 'LEFT'
+ row.active = child.has_visible_objects(view_layer)
+ row.operator("object.hide_collection", text=child.name, icon=icon, emboss=False).collection_index = index
+
+ for child in collection.children:
+ index = self._draw_collection(layout, view_layer, child, index)
+
+ return index
+
+ def draw(self, context):
+ layout = self.layout
+ layout.use_property_split = True
+
+ layout.label(text="Collections Visibility", icon='GROUP')
+ col = layout.column()
+
+ view_layer = context.view_layer
+ # We pass index 0 here beause 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)
+
+
class VIEW3D_PT_object_type_visibility(Panel):
bl_space_type = 'VIEW_3D'
bl_region_type = 'HEADER'
@@ -5362,6 +5420,7 @@ classes = (
VIEW3D_PT_view3d_properties,
VIEW3D_PT_view3d_camera_lock,
VIEW3D_PT_view3d_cursor,
+ VIEW3D_PT_collections,
VIEW3D_PT_object_type_visibility,
VIEW3D_PT_grease_pencil,
VIEW3D_PT_gpencil_multi_frame,
More information about the Bf-blender-cvs
mailing list