[Bf-blender-cvs] [ed19781a2a2] blender-v2.90-release: Fix T77951: Remove duplicate outliner menu entries

Nathan Craddock noreply at git.blender.org
Tue Jul 28 05:09:07 CEST 2020


Commit: ed19781a2a286540c1f4939258e3d7e96e9ab18c
Author: Nathan Craddock
Date:   Mon Jul 27 21:02:03 2020 -0600
Branches: blender-v2.90-release
https://developer.blender.org/rBed19781a2a286540c1f4939258e3d7e96e9ab18c

Fix T77951: Remove duplicate outliner menu entries

Move the common entries (View and Area) into a static method to be
called from other menus to avoid duplicating the New Collection and ID
Paste operators.

===================================================================

M	release/scripts/startup/bl_ui/space_outliner.py

===================================================================

diff --git a/release/scripts/startup/bl_ui/space_outliner.py b/release/scripts/startup/bl_ui/space_outliner.py
index aa4d0b94b7f..5a54d4ca2d8 100644
--- a/release/scripts/startup/bl_ui/space_outliner.py
+++ b/release/scripts/startup/bl_ui/space_outliner.py
@@ -107,6 +107,14 @@ class OUTLINER_MT_editor_menus(Menu):
 class OUTLINER_MT_context_menu(Menu):
     bl_label = "Outliner Context Menu"
 
+    @staticmethod
+    def draw_common_operators(layout):
+        layout.menu("OUTLINER_MT_context_menu_view")
+
+        layout.separator()
+
+        layout.menu("INFO_MT_area")
+
     def draw(self, context):
         space = context.space_data
 
@@ -116,11 +124,7 @@ class OUTLINER_MT_context_menu(Menu):
             OUTLINER_MT_collection_new.draw_without_context_menu(context, layout)
             layout.separator()
 
-        layout.menu("OUTLINER_MT_context_menu_view")
-
-        layout.separator()
-
-        layout.menu("INFO_MT_area")
+        OUTLINER_MT_context_menu.draw_common_operators(layout)
 
 
 class OUTLINER_MT_context_menu_view(Menu):
@@ -242,7 +246,7 @@ class OUTLINER_MT_collection(Menu):
 
         layout.separator()
 
-        OUTLINER_MT_context_menu.draw(self, context)
+        OUTLINER_MT_context_menu.draw_common_operators(layout)
 
 
 class OUTLINER_MT_collection_new(Menu):
@@ -250,7 +254,7 @@ class OUTLINER_MT_collection_new(Menu):
 
     @staticmethod
     def draw_without_context_menu(context, layout):
-        layout.operator("outliner.collection_new", text="New Collection").nested = False
+        layout.operator("outliner.collection_new", text="New Collection").nested = True
         layout.operator("outliner.id_paste", text="Paste Data-Blocks", icon='PASTEDOWN')
 
     def draw(self, context):
@@ -260,7 +264,7 @@ class OUTLINER_MT_collection_new(Menu):
 
         layout.separator()
 
-        OUTLINER_MT_context_menu.draw(self, context)
+        OUTLINER_MT_context_menu.draw_common_operators(layout)
 
 
 class OUTLINER_MT_object(Menu):
@@ -303,11 +307,15 @@ class OUTLINER_MT_object(Menu):
             layout.operator("outliner.id_operation", text="Unlink").type = 'UNLINK'
             layout.separator()
 
+        layout.operator("outliner.collection_new", text="New Collection").nested = True
+
+        layout.separator()
+
         layout.operator_menu_enum("outliner.id_operation", "type", text="ID Data")
 
         layout.separator()
 
-        OUTLINER_MT_context_menu.draw(self, context)
+        OUTLINER_MT_context_menu.draw_common_operators(layout)
 
 
 class OUTLINER_PT_filter(Panel):



More information about the Bf-blender-cvs mailing list