diff options
author | Joshua Leung <aligorith@gmail.com> | 2011-02-16 03:17:22 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2011-02-16 03:17:22 +0300 |
commit | 147309e3c5b2047ee1017af7a810539f1514007d (patch) | |
tree | 994ae692f1e2266ed1a1da8a35f4d27dd3640e4b /release | |
parent | c195e68e8ea186e0c1e9dee5c6b081c90530fc6e (diff) |
Pose Lib: Start of PoseLib UI in Armature buttons
This presents a UI from which PoseLibs can be assigned/removed from
Objects. From here, it is also possible to see the list of poses and
add/remove poses from this list.
Known Issues:
- [Py/RNA/Operators BUG ALERT!] If after immediately starting Blender
you try to remove a pose from the PoseLib using the UI buttons, you'll
get a an error the first time you do so (but not for subsequent
attempts). This seems to be caused by the "pose" enum (dynamically
generated) of the POSELIB_OT_pose_remove operator, which does not seem
to be getting initialised when the operator's exec gets called without
the invoke having been called previously
- Changing the active Pose Library still seems to be broken (to be
fixed soon)
Todos:
- Operator button to make the selected pose get shown in the 3d view
- Restore the "validate action" operator and add that to this panel
- Rename pose access
Diffstat (limited to 'release')
-rw-r--r-- | release/scripts/ui/properties_data_armature.py | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/release/scripts/ui/properties_data_armature.py b/release/scripts/ui/properties_data_armature.py index 6550e1bb1ed..566cf1dc3cc 100644 --- a/release/scripts/ui/properties_data_armature.py +++ b/release/scripts/ui/properties_data_armature.py @@ -154,6 +154,51 @@ class DATA_PT_bone_groups(ArmatureButtonsPanel, bpy.types.Panel): sub.operator("pose.group_deselect", text="Deselect") +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 + else: + activePose = None + activePoseName = None + + 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 + # 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("poselib.pose_remove", icon='ZOOMOUT', text="").pose = activePoseName + + # TODO: + # - show selected pose in 3d-view using browse op... + # - rename selected pose... + + # TODO: "validate action" operator to be restored + # TODO: this panel will soon be depreceated too class DATA_PT_ghost(ArmatureButtonsPanel, bpy.types.Panel): bl_label = "Ghost" |