diff options
Diffstat (limited to 'release/scripts/startup/bl_ui/properties_collection.py')
-rw-r--r-- | release/scripts/startup/bl_ui/properties_collection.py | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/release/scripts/startup/bl_ui/properties_collection.py b/release/scripts/startup/bl_ui/properties_collection.py index dab9def37f4..cc6d606d27e 100644 --- a/release/scripts/startup/bl_ui/properties_collection.py +++ b/release/scripts/startup/bl_ui/properties_collection.py @@ -27,6 +27,16 @@ class CollectionButtonsPanel: bl_context = "collection" +def get_collection_from_context(context): + active_object = context.active_object + + if active_object and active_object.dupli_group and context.space_data.collection_context == 'GROUP': + group = active_object.dupli_group + return group.view_layer.collections.active + else: + return context.layer_collection + + class COLLECTION_PT_context_collection(CollectionButtonsPanel, Panel): bl_label = "" bl_options = {'HIDE_HEADER'} @@ -34,8 +44,14 @@ class COLLECTION_PT_context_collection(CollectionButtonsPanel, Panel): def draw(self, context): layout = self.layout space = context.space_data + active_object = context.active_object + + if active_object and active_object.dupli_group: + split = layout.split(percentage=0.2) + split.row().prop(space, "collection_context", expand=True) + layout = split - collection = context.layer_collection + collection = get_collection_from_context(context) name = collection.name if name == 'Master Collection': layout.label(text=name, icon='COLLAPSEMENU') @@ -54,7 +70,7 @@ class COLLECTION_PT_clay_settings(CollectionButtonsPanel, Panel): def draw(self, context): layout = self.layout scene_props = context.scene.collection_properties['BLENDER_CLAY'] - collection = context.layer_collection + collection = get_collection_from_context(context) collection_props = collection.engine_overrides['BLENDER_CLAY'] col = layout.column() @@ -81,7 +97,7 @@ class COLLECTION_PT_object_mode_settings(CollectionButtonsPanel, Panel): def draw(self, context): layout = self.layout scene_props = context.scene.collection_properties['ObjectMode'] - collection = context.layer_collection + collection = get_collection_from_context(context) collection_props = collection.engine_overrides['ObjectMode'] col = layout.column() @@ -100,7 +116,7 @@ class COLLECTION_PT_edit_mode_settings(CollectionButtonsPanel, Panel): def draw(self, context): layout = self.layout scene_props = context.scene.collection_properties['EditMode'] - collection = context.layer_collection + collection = get_collection_from_context(context) collection_props = collection.engine_overrides['EditMode'] col = layout.column() @@ -124,7 +140,7 @@ class COLLECTION_PT_paint_weight_mode_settings(CollectionButtonsPanel, Panel): def draw(self, context): layout = self.layout scene_props = context.scene.collection_properties['WeightPaintMode'] - collection = context.layer_collection + collection = get_collection_from_context(context) collection_props = collection.engine_overrides['WeightPaintMode'] col = layout.column() @@ -143,7 +159,7 @@ class COLLECTION_PT_paint_vertex_mode_settings(CollectionButtonsPanel, Panel): def draw(self, context): layout = self.layout scene_props = context.scene.collection_properties['VertexPaintMode'] - collection = context.layer_collection + collection = get_collection_from_context(context) collection_props = collection.engine_overrides['VertexPaintMode'] col = layout.column() |