From 6cf9461a7623eb0b03f8b4a49f1380dd40a96afb Mon Sep 17 00:00:00 2001 From: Tristan Strathearn Date: Sat, 7 May 2022 14:20:55 +1000 Subject: [PATCH] feat: tidy up main menu by creating Replication and Deformation sub menus to house appropriate operators --- interface/__init__.py | 6 ++-- interface/deform_menu.py | 36 ++++++++++++++++++++ interface/main_menu.py | 5 ++- interface/{array_menu.py => replica_menu.py} | 13 +++---- 4 files changed, 49 insertions(+), 11 deletions(-) create mode 100644 interface/deform_menu.py rename interface/{array_menu.py => replica_menu.py} (73%) diff --git a/interface/__init__.py b/interface/__init__.py index dfe1381..a9894f8 100644 --- a/interface/__init__.py +++ b/interface/__init__.py @@ -17,7 +17,8 @@ from . import boolean_menu from . import bevel_menu from . import extrude_menu -from . import array_menu +from . import replica_menu +from . import deform_menu from . import viewport_menu from . import ops from . import common @@ -33,7 +34,8 @@ boolean_menu, bevel_menu, extrude_menu, - array_menu, + replica_menu, + deform_menu, viewport_menu ) diff --git a/interface/deform_menu.py b/interface/deform_menu.py new file mode 100644 index 0000000..206768e --- /dev/null +++ b/interface/deform_menu.py @@ -0,0 +1,36 @@ +# “Commons Clause” License Condition v1.0 +# +# See LICENSE for license details. If you did not receive a copy of the license, +# it may be obtained at https://github.com/hugemenace/nd/blob/main/LICENSE. +# +# Software: ND Blender Addon +# License: MIT +# Licensor: T.S. & I.J. (HugeMenace) + +import bpy +from .. import bl_info +from .. import lib + + +class ND_MT_deform_menu(bpy.types.Menu): + bl_label = "Deformation" + bl_idname = "ND_MT_deform_menu" + + + def draw(self, context): + layout = self.layout + layout.operator_context = 'INVOKE_DEFAULT' + layout.operator("nd.lattice", icon='MOD_LATTICE') + + +def draw_item(self, context): + layout = self.layout + layout.menu(ND_MT_deform_menu.bl_idname) + + +def register(): + bpy.utils.register_class(ND_MT_deform_menu) + + +def unregister(): + bpy.utils.unregister_class(ND_MT_deform_menu) diff --git a/interface/main_menu.py b/interface/main_menu.py index 3d7cf4c..81a7519 100644 --- a/interface/main_menu.py +++ b/interface/main_menu.py @@ -39,9 +39,8 @@ def draw(self, context): layout.menu("ND_MT_boolean_menu", icon='MOD_BOOLEAN') layout.menu("ND_MT_bevel_menu", icon='MOD_BEVEL') layout.menu("ND_MT_extrude_menu", icon='MOD_SOLIDIFY') - layout.menu("ND_MT_array_menu", icon='MOD_ARRAY') - layout.operator("nd.mirror", icon='MOD_MIRROR') - layout.operator("nd.lattice", icon='MOD_LATTICE') + layout.menu("ND_MT_replica_menu", icon='MOD_ARRAY') + layout.menu("ND_MT_deform_menu", icon='MOD_SIMPLEDEFORM') layout.separator() layout.operator("nd.recon_poly", icon='SURFACE_NCURVE') layout.operator("nd.screw_head", icon='CANCEL') diff --git a/interface/array_menu.py b/interface/replica_menu.py similarity index 73% rename from interface/array_menu.py rename to interface/replica_menu.py index 58420af..79ad23e 100644 --- a/interface/array_menu.py +++ b/interface/replica_menu.py @@ -12,9 +12,9 @@ from .. import lib -class ND_MT_array_menu(bpy.types.Menu): - bl_label = "Arrays" - bl_idname = "ND_MT_array_menu" +class ND_MT_replica_menu(bpy.types.Menu): + bl_label = "Replication" + bl_idname = "ND_MT_replica_menu" def draw(self, context): @@ -22,6 +22,7 @@ def draw(self, context): layout.operator_context = 'INVOKE_DEFAULT' layout.operator("nd.array_cubed", icon='PARTICLES') layout.operator("nd.circular_array", icon='DRIVER_ROTATIONAL_DIFFERENCE') + layout.operator("nd.mirror", icon='MOD_MIRROR') if lib.preferences.get_preferences().enable_deprecated_features: layout.operator("nd.square_array", icon='LIGHTPROBE_GRID') @@ -29,12 +30,12 @@ def draw(self, context): def draw_item(self, context): layout = self.layout - layout.menu(ND_MT_array_menu.bl_idname) + layout.menu(ND_MT_replica_menu.bl_idname) def register(): - bpy.utils.register_class(ND_MT_array_menu) + bpy.utils.register_class(ND_MT_replica_menu) def unregister(): - bpy.utils.unregister_class(ND_MT_array_menu) + bpy.utils.unregister_class(ND_MT_replica_menu)