Remove menu handler and refactor add/replace menu
This commit is contained in:
50
operators.py
50
operators.py
@ -39,53 +39,6 @@ class DSPL_OT_ConvertPoseLibrary(bpy.types.Operator):
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
# Operator to to draw a menu for new poses
|
||||
|
||||
|
||||
class DSPL_OT_DrawNewPoseMenu(bpy.types.Operator):
|
||||
bl_idname = "dspl.draw_new_pose_menu"
|
||||
bl_label = "New Pose Menu"
|
||||
bl_description = "New Pose Menu"
|
||||
bl_options = {'INTERNAL'}
|
||||
|
||||
def execute(self, context):
|
||||
return {'FINISHED'}
|
||||
|
||||
def invoke(self, context, event):
|
||||
return context.window_manager.invoke_popup(self, width=200)
|
||||
|
||||
def draw(self, context):
|
||||
dspl_create_popup_layout = self.layout
|
||||
dspl_new_pose_menu = dspl_create_popup_layout.box()
|
||||
|
||||
arm_object = getArmatureObject(context)
|
||||
pose_library = getPoseLib(context)
|
||||
dspl_new_pose_menu.prop(
|
||||
arm_object.dsplvars, "pose_new_name", text="Name")
|
||||
dspl_new_pose_menu.prop(
|
||||
arm_object.dsplvars,
|
||||
"only_selected", icon='GROUP_BONE', text="Selected", toggle=True)
|
||||
dspl_new_pose_menu.operator(
|
||||
"dspl.add_pose", icon='ADD', text="Add New Pose").posename = arm_object.dsplvars.pose_new_name
|
||||
|
||||
|
||||
# Operator to call up popup menus by ID
|
||||
|
||||
|
||||
class DSPL_OT_CallPopupMenu(bpy.types.Operator):
|
||||
bl_idname = "dspl.call_popup_menu"
|
||||
bl_label = "Popup menu"
|
||||
bl_description = "Popup menu"
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
menuID: bpy.props.StringProperty()
|
||||
|
||||
def execute(self, context):
|
||||
bpy.ops.wm.call_menu(name=self.menuID)
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
# Operator to manage the big menu buttons
|
||||
|
||||
|
||||
@ -174,7 +127,7 @@ class DSPL_OT_AddPose(bpy.types.Operator):
|
||||
action_object = getPoseLib(context)
|
||||
pose_markers = action_object.pose_markers
|
||||
active_marker = pose_markers.active
|
||||
new_name = active_marker.name
|
||||
new_name = self.posename
|
||||
counter = 1
|
||||
|
||||
for pm in pose_markers:
|
||||
@ -584,7 +537,6 @@ classes = (
|
||||
DSPL_OT_CreatePoseLibrary,
|
||||
DSPL_OT_ConvertPoseLibrary,
|
||||
DSPL_OT_CallPopupMenu,
|
||||
DSPL_OT_DrawNewPoseMenu,
|
||||
DSPL_OT_MenuButtonHandler,
|
||||
DSPL_OT_AddPose,
|
||||
DSPL_OT_RemovePose,
|
||||
|
Reference in New Issue
Block a user