Rename project to Yet Another Pose Library (for now)
This commit is contained in:
78
gui.py
78
gui.py
@ -2,9 +2,9 @@ import bpy
|
||||
from .common import *
|
||||
|
||||
|
||||
class DATA_PT_DSPLPanel(bpy.types.Panel):
|
||||
bl_label = "Damn Simple Pose Library"
|
||||
bl_id = "DATA_PT_DSPLPanel"
|
||||
class DATA_PT_YaplPanel(bpy.types.Panel):
|
||||
bl_label = "Yet Another Pose Library"
|
||||
bl_id = "DATA_PT_YaplPanel"
|
||||
bl_space_type = 'VIEW_3D'
|
||||
bl_region_type = 'UI'
|
||||
bl_category = 'Pose'
|
||||
@ -14,11 +14,11 @@ class DATA_PT_DSPLPanel(bpy.types.Panel):
|
||||
return len(bpy.context.selected_objects)
|
||||
|
||||
def draw(self, context):
|
||||
dspl_panel_layout = self.layout
|
||||
dsplsettings = bpy.context.scene.dsplSettings
|
||||
yapl_panel_layout = self.layout
|
||||
yaplsettings = bpy.context.scene.yaplSettings
|
||||
|
||||
# Detect Armature object and parent
|
||||
armature_layout = dspl_panel_layout.column(align=True)
|
||||
armature_layout = yapl_panel_layout.column(align=True)
|
||||
active_obj = context.active_object
|
||||
arm_object, pose_library = get_armature_data(context)
|
||||
pose_library_action = get_armature_action(context)
|
||||
@ -33,35 +33,35 @@ class DATA_PT_DSPLPanel(bpy.types.Panel):
|
||||
if pose_library or pose_library_action:
|
||||
if pose_library and not pose_library_action:
|
||||
armature_layout.template_ID(
|
||||
arm_object, "pose_library", new="dspl.create_pose_library", unlink="dspl.unlink_pose_library")
|
||||
arm_object, "pose_library", new="yapl.create_pose_library", unlink="yapl.unlink_pose_library")
|
||||
|
||||
elif pose_library_action and not pose_library:
|
||||
armature_layout.template_ID(
|
||||
arm_object.animation_data, "action", new="dspl.create_pose_library")
|
||||
arm_object.animation_data, "action", new="yapl.create_pose_library")
|
||||
armature_layout.label(
|
||||
text="Pose Library detected as Action")
|
||||
armature_layout.label(
|
||||
text="You should convert to avoid problems")
|
||||
armature_layout.operator(
|
||||
"dspl.convert_pose_library", icon='PLUGIN', text="Convert to Pose Library")
|
||||
"yapl.convert_pose_library", icon='PLUGIN', text="Convert to Pose Library")
|
||||
|
||||
elif pose_library and pose_library_action:
|
||||
armature_layout.template_ID(
|
||||
arm_object, "pose_library", new="dspl.create_pose_library")
|
||||
arm_object, "pose_library", new="yapl.create_pose_library")
|
||||
armature_layout.label(text="Pose Library is opened as Action")
|
||||
armature_layout.label(text="Keyframes will affect pose")
|
||||
armature_layout.operator(
|
||||
"dspl.convert_pose_library", icon='PLUGIN', text="Unlink from Action")
|
||||
"yapl.convert_pose_library", icon='PLUGIN', text="Unlink from Action")
|
||||
|
||||
|
||||
# List poses in pose library
|
||||
if pose_library:
|
||||
pose_box_layout = dspl_panel_layout.column()
|
||||
pose_box_layout = yapl_panel_layout.column()
|
||||
|
||||
# Menu switcher
|
||||
pose_box_menu_switcher_layout = pose_box_layout.row()
|
||||
pose_box_menu_switcher_layout.prop(
|
||||
dsplsettings, "new_menu", icon='PMARKER_ACT', text="New Menu", toggle=True)
|
||||
yaplsettings, "new_menu", icon='PMARKER_ACT', text="New Menu", toggle=True)
|
||||
|
||||
# Quick controls
|
||||
quick_pose_controls_layout = pose_box_layout.column()
|
||||
@ -71,16 +71,16 @@ class DATA_PT_DSPLPanel(bpy.types.Panel):
|
||||
quick_apply_layout = quick_pose_controls_layout.split(
|
||||
align=True)
|
||||
quick_apply_layout.operator(
|
||||
"dspl.browse_poses", icon='CON_ARMATURE', text="Browse")
|
||||
if dsplsettings.new_menu == False:
|
||||
"yapl.browse_poses", icon='CON_ARMATURE', text="Browse")
|
||||
if yaplsettings.new_menu == False:
|
||||
quick_apply_layout.operator(
|
||||
"dspl.apply_pose", icon='ARMATURE_DATA', text="Apply Pose").posename = pose_library.pose_markers.active.name
|
||||
"yapl.apply_pose", icon='ARMATURE_DATA', text="Apply Pose").posename = pose_library.pose_markers.active.name
|
||||
else:
|
||||
quick_apply_layout.prop(dsplsettings,
|
||||
quick_apply_layout.prop(yaplsettings,
|
||||
"edit_mode", icon='GREASEPENCIL', text="Edit", toggle=True)
|
||||
|
||||
# New menu
|
||||
if dsplsettings.new_menu == True:
|
||||
if yaplsettings.new_menu == True:
|
||||
pose_button_layout = pose_box_layout.row()
|
||||
pose_button_entries_layout = pose_button_layout.column(align=True)
|
||||
for pm in pose_library.pose_markers:
|
||||
@ -88,27 +88,27 @@ class DATA_PT_DSPLPanel(bpy.types.Panel):
|
||||
|
||||
# Selected indicator
|
||||
selected = pm.frame == pose_library.pose_markers.active.frame
|
||||
if dsplsettings.edit_mode == False:
|
||||
if yaplsettings.edit_mode == False:
|
||||
row.label(text="", icon='PMARKER_ACT' if selected else 'PMARKER_SEL')
|
||||
|
||||
# Pose operator buttons
|
||||
if dsplsettings.edit_mode == True:
|
||||
row.operator('dspl.rename_pose', text=pm.name).posename = pm.name
|
||||
if yaplsettings.edit_mode == True:
|
||||
row.operator('yapl.rename_pose', text=pm.name).posename = pm.name
|
||||
else:
|
||||
row.operator('dspl.apply_pose', text=pm.name).posename = pm.name
|
||||
row.operator('yapl.apply_pose', text=pm.name).posename = pm.name
|
||||
|
||||
if dsplsettings.edit_mode == True:
|
||||
movebuttondown = row.operator("dspl.move_pose", icon='TRIA_DOWN', text="")
|
||||
if yaplsettings.edit_mode == True:
|
||||
movebuttondown = row.operator("yapl.move_pose", icon='TRIA_DOWN', text="")
|
||||
movebuttondown.direction = "DOWN"
|
||||
movebuttondown.posename = pm.name
|
||||
movebuttonup = row.operator("dspl.move_pose", icon='TRIA_UP', text="")
|
||||
movebuttonup = row.operator("yapl.move_pose", icon='TRIA_UP', text="")
|
||||
movebuttonup.direction = "UP"
|
||||
movebuttonup.posename = pm.name
|
||||
|
||||
row.operator("dspl.remove_pose", icon='REMOVE', text="").posename = pm.name
|
||||
row.operator("yapl.remove_pose", icon='REMOVE', text="").posename = pm.name
|
||||
|
||||
# Old menu
|
||||
elif dsplsettings.new_menu == False:
|
||||
elif yaplsettings.new_menu == False:
|
||||
pose_list_layout = pose_box_layout.column()
|
||||
|
||||
# Pose list
|
||||
@ -123,20 +123,20 @@ class DATA_PT_DSPLPanel(bpy.types.Panel):
|
||||
"wm.call_menu", icon='ADD', text="").name = "OBJECT_MT_AddPoseMenu"
|
||||
if pose_library.pose_markers.active:
|
||||
pose_ops_layout.operator(
|
||||
"dspl.remove_pose", icon='REMOVE', text="")
|
||||
"yapl.remove_pose", icon='REMOVE', text="")
|
||||
pose_ops_layout.operator(
|
||||
"dspl.apply_pose", icon='ARMATURE_DATA', text=""
|
||||
"yapl.apply_pose", icon='ARMATURE_DATA', text=""
|
||||
).posename = pose_library.pose_markers.active.name
|
||||
pose_ops_layout.operator(
|
||||
"dspl.move_pose", icon='TRIA_UP', text="").direction = "UP"
|
||||
"yapl.move_pose", icon='TRIA_UP', text="").direction = "UP"
|
||||
pose_ops_layout.operator(
|
||||
"dspl.move_pose", icon='TRIA_DOWN', text="").direction = "DOWN"
|
||||
"yapl.move_pose", icon='TRIA_DOWN', text="").direction = "DOWN"
|
||||
|
||||
else:
|
||||
armature_layout.label(
|
||||
text="No Action or Pose Library detected")
|
||||
armature_layout.template_ID(
|
||||
arm_object, "pose_library", new="dspl.create_pose_library")
|
||||
arm_object, "pose_library", new="yapl.create_pose_library")
|
||||
|
||||
else:
|
||||
armature_layout.label(text="No armature or parent selected")
|
||||
@ -149,11 +149,11 @@ class OBJECT_MT_AddPoseMenu(bpy.types.Menu):
|
||||
def draw(self, context):
|
||||
arm_object, pose_library = get_armature_data(context)
|
||||
|
||||
dspl_add_menu_layout = self.layout
|
||||
dspl_add_menu_layout.operator(
|
||||
"dspl.add_pose", icon='ADD', text="Add New Pose")
|
||||
yapl_add_menu_layout = self.layout
|
||||
yapl_add_menu_layout.operator(
|
||||
"yapl.add_pose", icon='ADD', text="Add New Pose")
|
||||
if len(pose_library.pose_markers):
|
||||
dspl_add_menu_layout.menu(
|
||||
yapl_add_menu_layout.menu(
|
||||
"OBJECT_MT_ReplacePoseMenu", text="Replace Existing Pose", icon="DECORATE_OVERRIDE")
|
||||
|
||||
|
||||
@ -164,15 +164,15 @@ class OBJECT_MT_ReplacePoseMenu(bpy.types.Menu):
|
||||
def draw(self, context):
|
||||
arm_object, pose_library = get_armature_data(context)
|
||||
|
||||
dspl_replace_menu_layout = self.layout
|
||||
yapl_replace_menu_layout = self.layout
|
||||
for pm in pose_library.pose_markers:
|
||||
op = dspl_replace_menu_layout.operator("dspl.add_pose", text=pm.name, icon="PMARKER")
|
||||
op = yapl_replace_menu_layout.operator("yapl.add_pose", text=pm.name, icon="PMARKER")
|
||||
op.replace = True
|
||||
op.posename = pm.name
|
||||
|
||||
|
||||
classes = (
|
||||
DATA_PT_DSPLPanel,
|
||||
DATA_PT_YaplPanel,
|
||||
OBJECT_MT_AddPoseMenu,
|
||||
OBJECT_MT_ReplacePoseMenu,
|
||||
)
|
||||
|
Reference in New Issue
Block a user