Skip to content

Commit

Permalink
feat: tidy up main menu by creating Replication and Deformation sub m…
Browse files Browse the repository at this point in the history
…enus to house appropriate operators
  • Loading branch information
tristan-hm committed May 7, 2022
1 parent 73aa1e7 commit 6cf9461
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 11 deletions.
6 changes: 4 additions & 2 deletions interface/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -33,7 +34,8 @@
boolean_menu,
bevel_menu,
extrude_menu,
array_menu,
replica_menu,
deform_menu,
viewport_menu
)

Expand Down
36 changes: 36 additions & 0 deletions interface/deform_menu.py
Original file line number Diff line number Diff line change
@@ -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)
5 changes: 2 additions & 3 deletions interface/main_menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
13 changes: 7 additions & 6 deletions interface/array_menu.py → interface/replica_menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,30 @@
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):
layout = self.layout
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')


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)

0 comments on commit 6cf9461

Please sign in to comment.