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.
This commit is contained in:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user