Commit: 9398db07cce4ec8b6992e14358dcb840dbe46825 Author: Dalai Felinto Date: Thu Jan 18 13:05:43 2018 -0200 Branches: blender2.8 https://developer.blender.org/rB9398db07cce4ec8b6992e14358dcb840dbe46825
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). =================================================================== M release/scripts/startup/bl_ui/space_outliner.py M source/blender/editors/space_outliner/outliner_tools.c =================================================================== 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. diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c index 58605f3bec8..a7a2765f7a5 100644 --- a/source/blender/editors/space_outliner/outliner_tools.c +++ b/source/blender/editors/space_outliner/outliner_tools.c @@ -2097,7 +2097,7 @@ static int do_outliner_operation_event(bContext *C, ARegion *ar, SpaceOops *soop WM_operator_name_call(C, "OUTLINER_OT_collection_operation", WM_OP_INVOKE_REGION_WIN, NULL); } else if (datalevel == TSE_SCENE_COLLECTION) { - WM_menu_name_call(C, "OUTLINER_MT_edit_collections", WM_OP_INVOKE_REGION_WIN); + WM_menu_name_call(C, "OUTLINER_MT_context_scene_collection", WM_OP_INVOKE_REGION_WIN); } else { WM_operator_name_call(C, "OUTLINER_OT_data_operation", WM_OP_INVOKE_REGION_WIN, NULL); _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs