diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2017-11-30 23:38:07 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2017-12-01 19:15:54 +0300 |
commit | f91e05778612712050ed6f19ce9a2223c0404653 (patch) | |
tree | 573e49186df2af01e2feb9bb09ad8513d7eeb8c9 /release/scripts/startup/bl_ui/properties_collection.py | |
parent | aeaf87bbeb011e9a571eefa12d81fa6fb2b8bd5b (diff) |
Groups and collection: editing group collections
Allow users to edit either the object group active collection or view layer one
We can't support users selecting the group collections from the outliner group
because that would be imply having an active group for the scene or workspace.
But the way it is now allows to see and edit the collection values after the
group is instanced.
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() |