PoseLib Bugfixes, Cleanups, and Missing Operators
* All the various index-related issues should finally be sorted now. It seems you cannot just partially implement some of these active index getter/setters... * Standardised the call used by PoseLib operators to get the Object from which they get the active PoseLib data from * PoseLib operators which require some existing data to work now use a poll() which checks for this * Added back the operator used to make standard actions into ones usable by PoseLib * Added a dummy operator for the apply active pose button which really just calls the same backend functions as "Browse Interactive", but which has a nicer frontend (naming + description) for the purpose of being used in this way * Also, removed some useless code from here
This commit is contained in:
@@ -157,46 +157,44 @@ class DATA_PT_bone_groups(ArmatureButtonsPanel, bpy.types.Panel):
|
||||
class DATA_PT_pose_library(ArmatureButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Pose Library"
|
||||
bl_options = {'DEFAULT_CLOSED'}
|
||||
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return (context.object and context.object.type == 'ARMATURE' and context.object.pose)
|
||||
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
|
||||
ob = context.object
|
||||
poselib = ob.pose_library
|
||||
|
||||
|
||||
row = layout.row()
|
||||
row.template_ID(ob, "pose_library", new="poselib.new", unlink="poselib.unlink")
|
||||
|
||||
|
||||
if poselib:
|
||||
activePoseIndex = poselib.pose_markers.active_index
|
||||
if len(poselib.pose_markers):
|
||||
activePose = poselib.pose_markers[activePoseIndex]
|
||||
activePoseName = activePose.name if activePose else None
|
||||
if poselib.pose_markers.active:
|
||||
activePoseName = poselib.pose_markers.active.name
|
||||
else:
|
||||
activePose = None
|
||||
activePoseName = None
|
||||
|
||||
activePoseName = ""
|
||||
|
||||
row = layout.row()
|
||||
row.template_list(poselib, "pose_markers", poselib.pose_markers, "active_index", rows=5)
|
||||
|
||||
|
||||
col = row.column(align=True)
|
||||
col.active = (poselib.library is None)
|
||||
|
||||
# invoke should still be used for 'add', as it is needed to allow
|
||||
|
||||
# invoke should still be used for 'add', as it is needed to allow
|
||||
# add/replace options to be used properly
|
||||
col.operator("poselib.pose_add", icon='ZOOMIN', text="")
|
||||
|
||||
col.operator_context = 'EXEC_DEFAULT' # exec not invoke, so that menu doesn't need showing
|
||||
|
||||
col.operator_context = 'EXEC_DEFAULT' # exec not invoke, so that menu doesn't need showing
|
||||
col.operator("poselib.pose_remove", icon='ZOOMOUT', text="").pose = activePoseName
|
||||
|
||||
#col.operator_context = 'EXEC_DEFAULT' # exec not invoke, so modal preview loop doesn't run
|
||||
col.operator("poselib.browse_interactive", icon='ZOOM_SELECTED', text="").pose_index = activePoseIndex
|
||||
|
||||
# TODO: "validate action" operator to be restored
|
||||
col.operator("poselib.apply_pose", icon='ZOOM_SELECTED', text="").pose_index = activePoseIndex
|
||||
|
||||
row = layout.row()
|
||||
row.operator("poselib.action_sanitise")
|
||||
|
||||
|
||||
# TODO: this panel will soon be depreceated too
|
||||
|
||||
Reference in New Issue
Block a user