UI: Move Normal Edit and Weighted Normal modifiers to "Normals" menu

Though the whole modifier menu could use a reorganization, it probably doesn't
make sense to do that before we have a builtin library of node group assets.
We already have the "Normals" category though, so these two modifiers make
more sense there.

Pull Request: https://projects.blender.org/blender/blender/pulls/122168
This commit is contained in:
Hans Goudey
2024-05-23 18:28:31 +02:00
committed by Hans Goudey
parent 5a643cfa74
commit b0eb48c4dc
2 changed files with 20 additions and 3 deletions

View File

@@ -82,6 +82,8 @@ class OBJECT_MT_modifier_add(ModifierAddMenu, Menu):
layout.menu("OBJECT_MT_modifier_add_generate")
if ob_type in {'MESH', 'CURVE', 'FONT', 'SURFACE', 'LATTICE', 'VOLUME', 'GREASEPENCIL'}:
layout.menu("OBJECT_MT_modifier_add_deform")
if ob_type in {'MESH'}:
layout.menu("OBJECT_MT_modifier_add_normals")
if ob_type in {'MESH', 'CURVE', 'FONT', 'SURFACE', 'LATTICE'}:
layout.menu("OBJECT_MT_modifier_add_physics")
if ob_type in {'GREASEPENCIL'}:
@@ -105,8 +107,6 @@ class OBJECT_MT_modifier_add_edit(ModifierAddMenu, Menu):
if ob_type in {'MESH', 'CURVE', 'FONT', 'SURFACE'}:
self.operator_modifier_add(layout, 'MESH_SEQUENCE_CACHE')
if ob_type == 'MESH':
self.operator_modifier_add(layout, 'NORMAL_EDIT')
self.operator_modifier_add(layout, 'WEIGHTED_NORMAL')
self.operator_modifier_add(layout, 'UV_PROJECT')
self.operator_modifier_add(layout, 'UV_WARP')
self.operator_modifier_add(layout, 'VERTEX_WEIGHT_EDIT')
@@ -219,6 +219,19 @@ class OBJECT_MT_modifier_add_deform(ModifierAddMenu, Menu):
layout.template_modifier_asset_menu_items(catalog_path=self.bl_label)
class OBJECT_MT_modifier_add_normals(ModifierAddMenu, Menu):
bl_label = "Normals"
bl_options = {'SEARCH_ON_KEY_PRESS'}
def draw(self, context):
layout = self.layout
ob_type = context.object.type
if ob_type == 'MESH':
self.operator_modifier_add(layout, 'NORMAL_EDIT')
self.operator_modifier_add(layout, 'WEIGHTED_NORMAL')
layout.template_modifier_asset_menu_items(catalog_path=self.bl_label)
class OBJECT_MT_modifier_add_physics(ModifierAddMenu, Menu):
bl_label = "Physics"
bl_options = {'SEARCH_ON_KEY_PRESS'}
@@ -291,6 +304,7 @@ classes = (
OBJECT_MT_modifier_add_edit,
OBJECT_MT_modifier_add_generate,
OBJECT_MT_modifier_add_deform,
OBJECT_MT_modifier_add_normals,
OBJECT_MT_modifier_add_physics,
OBJECT_MT_modifier_add_color,
DATA_PT_gpencil_modifiers,

View File

@@ -219,7 +219,7 @@ static void root_catalogs_draw(const bContext *C, Menu *menu)
uiItemL(layout, IFACE_("Loading Asset Libraries"), ICON_INFO);
}
static Set<std::string> all_builtin_menus = [&]() {
Set<std::string> all_builtin_menus = [&]() {
Set<std::string> menus;
if (ELEM(object->type, OB_MESH, OB_CURVES_LEGACY, OB_FONT, OB_SURF, OB_LATTICE)) {
menus.add_new("Edit");
@@ -230,6 +230,9 @@ static void root_catalogs_draw(const bContext *C, Menu *menu)
if (ELEM(object->type, OB_MESH, OB_CURVES_LEGACY, OB_FONT, OB_SURF, OB_LATTICE, OB_VOLUME)) {
menus.add_new("Deform");
}
if (ELEM(object->type, OB_MESH)) {
menus.add_new("Normals");
}
if (ELEM(object->type, OB_MESH, OB_CURVES_LEGACY, OB_FONT, OB_SURF, OB_LATTICE)) {
menus.add_new("Physics");
}