diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2018-01-18 18:05:43 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2018-01-18 18:05:45 +0300 |
commit | 9398db07cce4ec8b6992e14358dcb840dbe46825 (patch) | |
tree | 131c03c4e0ac606b0db79238c8fb0fc3bea90595 /release/scripts/startup/bl_ui/space_outliner.py | |
parent | 539e170d79567752fe7e641637d4057a6e8ab583 (diff) |
Outliner: Keep header operator-free and edit menu cleanup
Headers should not have operators as much as possible. The exception here is
for datablocks mode when you want to see the active keyset.
Edit menus on the other hand should be clearly distinct from the RMB context
menus. Edit menu options should be only the ones that apply to the entire
outliner, regardless of the selected element.
Context (rmb) menus should be related to the element you RMB on to invoke the
menu. I'm also taking this opportunity to start bringing the context menus
to Python. There is little reason not to, and it helps editing them (In this
case I'm doing it only for the Scene Collection one).
Diffstat (limited to 'release/scripts/startup/bl_ui/space_outliner.py')
-rw-r--r-- | release/scripts/startup/bl_ui/space_outliner.py | 51 |
1 files changed, 31 insertions, 20 deletions
diff --git a/release/scripts/startup/bl_ui/space_outliner.py b/release/scripts/startup/bl_ui/space_outliner.py index 1af515b0a29..2f0406d6ee7 100644 --- a/release/scripts/startup/bl_ui/space_outliner.py +++ b/release/scripts/startup/bl_ui/space_outliner.py @@ -57,17 +57,6 @@ class OUTLINER_HT_header(Header): else: row = layout.row() row.label(text="No Keying Set Active") - elif space.display_mode == 'ORPHAN_DATA': - layout.operator("outliner.orphans_purge") - - elif space.display_mode == 'ACT_LAYER': - row = layout.row(align=True) - - row.operator("outliner.collection_new", text="", icon='NEW') - row.operator("outliner.collection_override_new", text="", icon='LINK_AREA') - row.operator("outliner.collection_link", text="", icon='LINKED') - row.operator("outliner.collection_unlink", text="", icon='UNLINKED') - row.operator("outliner.collections_delete", text="", icon='X') class OUTLINER_MT_editor_menus(Menu): @@ -87,8 +76,11 @@ class OUTLINER_MT_editor_menus(Menu): if space.display_mode == 'DATABLOCKS': layout.menu("OUTLINER_MT_edit_datablocks") - elif space.display_mode == 'COLLECTIONS': - layout.menu("OUTLINER_MT_edit_collections") + elif space.display_mode == 'ORPHAN_DATA': + layout.menu("OUTLINER_MT_edit_orphan_data") + + elif space.display_mode == 'ACT_LAYER': + layout.menu("OUTLINER_MT_edit_active_view_layer") class OUTLINER_MT_view(Menu): @@ -129,17 +121,13 @@ class OUTLINER_MT_search(Menu): layout.prop(space, "use_filter_complete") -class OUTLINER_MT_edit_collections(Menu): +class OUTLINER_MT_edit_active_view_layer(Menu): bl_label = "Edit" def draw(self, context): layout = self.layout - layout.operator("outliner.collection_nested_new", text="New Collection", icon='NEW') - layout.operator("outliner.collection_delete_selected", text="Delete Collections", icon='X') - layout.separator() - layout.operator("outliner.collection_objects_add", text="Add Selected", icon='ZOOMIN') - layout.operator("outliner.collection_objects_remove", text="Remove Selected", icon='ZOOMOUT') + layout.operator("outliner.collection_link", icon='LINKED') class OUTLINER_MT_edit_datablocks(Menu): @@ -157,13 +145,36 @@ class OUTLINER_MT_edit_datablocks(Menu): layout.operator("outliner.drivers_delete_selected") +class OUTLINER_MT_edit_orphan_data(Menu): + bl_label = "Edit" + + def draw(self, context): + layout = self.layout + layout.operator("outliner.orphans_purge") + + +class OUTLINER_MT_context_scene_collection(Menu): + bl_label = "Collection" + + def draw(self, context): + layout = self.layout + + layout.operator("outliner.collection_nested_new", text="New Collection", icon='NEW') + layout.operator("outliner.collection_delete_selected", text="Delete Collections", icon='X') + layout.separator() + layout.operator("outliner.collection_objects_add", text="Add Selected", icon='ZOOMIN') + layout.operator("outliner.collection_objects_remove", text="Remove Selected", icon='ZOOMOUT') + + classes = ( OUTLINER_HT_header, OUTLINER_MT_editor_menus, OUTLINER_MT_view, OUTLINER_MT_search, - OUTLINER_MT_edit_collections, + OUTLINER_MT_edit_active_view_layer, OUTLINER_MT_edit_datablocks, + OUTLINER_MT_edit_orphan_data, + OUTLINER_MT_context_scene_collection, ) if __name__ == "__main__": # only for live edit. |