Remove menu handler and refactor add/replace menu
This commit is contained in:
26
gui.py
26
gui.py
@ -127,7 +127,7 @@ class DATA_PT_DSPLPanel(bpy.types.Panel):
|
||||
# Pose operators
|
||||
pose_ops_layout = pose_list_entries_layout.column(align=True)
|
||||
pose_ops_layout.operator(
|
||||
"dspl.draw_new_pose_menu", icon='ADD', text="")
|
||||
"wm.call_menu", icon='ADD', text="").name = "OBJECT_MT_AddPoseMenu"
|
||||
if active_pose_library.pose_markers.active:
|
||||
pose_ops_layout.operator(
|
||||
"dspl.remove_pose", icon='REMOVE', text="")
|
||||
@ -159,15 +159,31 @@ class OBJECT_MT_AddPoseMenu(bpy.types.Menu):
|
||||
|
||||
dspl_add_menu_layout = self.layout
|
||||
dspl_add_menu_layout.operator(
|
||||
"dspl.draw_new_pose_menu", icon='DECORATE_DRIVER', text="Add New Pose")
|
||||
if action_object.pose_markers.active:
|
||||
dspl_add_menu_layout.operator(
|
||||
"dspl.add_pose", icon='DECORATE_OVERRIDE', text="Replace Existing Pose").replace = True
|
||||
"dspl.add_pose", icon='ADD', text="Add New Pose").posename = arm_object.dsplvars.pose_new_name
|
||||
if len(action_object.pose_markers):
|
||||
dspl_add_menu_layout.menu(
|
||||
"OBJECT_MT_ReplacePoseMenu", text="Replace Existing Pose", icon="DECORATE_OVERRIDE")
|
||||
|
||||
|
||||
class OBJECT_MT_ReplacePoseMenu(bpy.types.Menu):
|
||||
bl_idname = "OBJECT_MT_ReplacePoseMenu"
|
||||
bl_label = "Add Pose"
|
||||
|
||||
def draw(self, context):
|
||||
arm_object = getArmatureObject(context)
|
||||
action_object = getPoseLib(context)
|
||||
|
||||
dspl_replace_menu_layout = self.layout
|
||||
for pm in action_object.pose_markers:
|
||||
op = dspl_replace_menu_layout.operator("dspl.add_pose", text=pm.name, icon="PMARKER")
|
||||
op.replace = True
|
||||
op.posename = pm.name
|
||||
|
||||
|
||||
classes = (
|
||||
DATA_PT_DSPLPanel,
|
||||
OBJECT_MT_AddPoseMenu,
|
||||
OBJECT_MT_ReplacePoseMenu,
|
||||
)
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user