UI: Tweaks to Object > Modifier menu

- Moved Modifier menu above Constraints, so that order matches Properties panel
- Added icons for Modifier and Constraints menu (same ones as Properties)
- Renamed "Add" to "Add Modifier", so that it's easier to search for it with F3
- Renamed "Copy Modifiers" operator to match similar operator in constraints menu
- "Add Modifier" operator now doesn't appear if active object type doesn't support
  modifiers. I completely removed it because otherwise it was showing menu with
  empty items even on greyed out

Lastly, I added check for legacy GPENCIL object type, because it doesn't support
new modifier menus, and instead when active object is grease pencil instead of
menu it shows old Add Modifier operator, same one that is in properties panel.

After legacy grease pencil is removed that check won't be necessary anymore and
can be removed, but for now it's needed, otherwise it shows empty menu for grease pencil.

Pull Request: https://projects.blender.org/blender/blender/pulls/121344
This commit is contained in:
Nika Kutsniashvili
2024-05-02 18:13:41 +02:00
committed by Hans Goudey
parent ec350a6115
commit a3627fe88e

View File

@@ -2893,8 +2893,8 @@ class VIEW3D_MT_object(Menu):
layout.menu("VIEW3D_MT_object_liboverride", icon='LIBRARY_DATA_OVERRIDE')
layout.menu("VIEW3D_MT_object_relations")
layout.menu("VIEW3D_MT_object_parent")
layout.menu("VIEW3D_MT_object_constraints")
layout.menu("VIEW3D_MT_object_modifiers")
layout.menu("VIEW3D_MT_object_modifiers", icon='MODIFIER')
layout.menu("VIEW3D_MT_object_constraints", icon='CONSTRAINT')
layout.menu("VIEW3D_MT_object_track")
layout.menu("VIEW3D_MT_make_links")
@@ -3367,10 +3367,17 @@ class VIEW3D_MT_object_modifiers(Menu):
bl_label = "Modifiers"
def draw(self, _context):
active_object = bpy.context.active_object
supported_types = {'MESH', 'CURVE', 'CURVES', 'SURFACE', 'FONT', 'VOLUME', 'GREASEPENCIL'}
layout = self.layout
layout.menu("OBJECT_MT_modifier_add", text="Add")
layout.operator("object.modifiers_copy_to_selected", text="Copy to Selected")
if active_object.type in supported_types:
layout.menu("OBJECT_MT_modifier_add", text="Add Modifier")
elif active_object.type == 'GPENCIL':
layout.operator("object.gpencil_modifier_add", text="Add Modifier")
layout.operator("object.modifiers_copy_to_selected", text="Copy Modifiers to Selected Objects")
layout.separator()