Compare commits
3 Commits
select-but
...
1da217a6f2
Author | SHA1 | Date | |
---|---|---|---|
1da217a6f2 | |||
0aa1014f55 | |||
8f223527a2 |
48
README.md
48
README.md
@ -1,48 +1,6 @@
|
|||||||
# Damn Simple Pose Library
|
# Damn Simple Pose Library
|
||||||
|
|
||||||
In Blender 3.x, a new Asset-based Pose system was introduced. That's fine and dandy, but it was not (and still is not as of Jan 2025) ready to replace the old Action-based Pose Library system.
|
In Blender 3.x, a new Asset-based Pose system was introduced.
|
||||||
|
That's fine and dandy, however because of that, the old Pose Library was deprecated and gutted out real quick-like. Too quick.
|
||||||
|
|
||||||
The former Pose Library was deprecated and gutted rapidly during Blender 3.x, leaving legacy users high and dry. This addon brings the feature back as best as it can in a modern panel. Most, if not all existing Pose Libraries should work without any modifications, little new is introduced outside of string suffixes and mitigations (read further).
|
This brings it back as best as it can.
|
||||||
|
|
||||||
## Features
|
|
||||||
|
|
||||||
- Supports Blender 3.3 - 4.3 (4.1 recommended).
|
|
||||||
- New panel interface for interacting with pose libraries, inspired by [gret's Actions Panel feature](https://github.com/greisane/gret?tab=readme-ov-file#animation-actions-panel).
|
|
||||||
- The older Pose Library list layout is provided as option.
|
|
||||||
- Operators and data property [that were removed in 3.5](https://projects.blender.org/blender/blender/issues/93406) are ported from C to Python:
|
|
||||||
- `dspl.apply_pose`
|
|
||||||
- `dspl.browse_poses`
|
|
||||||
- `dspl.create_pose_library`
|
|
||||||
- `dspl.convert_pose_library`
|
|
||||||
- `dspl.add_pose`
|
|
||||||
- `dspl.move_pose`
|
|
||||||
- `dspl.remove_pose`
|
|
||||||
- `dspl.rename_pose`
|
|
||||||
- `dspl.unlink_pose_library`
|
|
||||||
- `Object.pose_library`
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
1. [Download the repository as a zip](https://git.bkspl.me/breakingspell/DamnSimplePoseLibrary/archive/develop.zip), or otherwise clone the repository.
|
|
||||||
2. Install as an Add-on in Blender via Install -> Zip, and enable.
|
|
||||||
3. Optionally configure the suffix strings to fit your workflow, and whether the orhpan checker should run at startup.
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
1. Open Sidebar (`N`), and choose the `Pose` tab.
|
|
||||||
2. Select existing Pose Library from drop-down, or create a new library.
|
|
||||||
|
|
||||||
### Hotkeys:
|
|
||||||
- `Shift + L` - Add/Replace Pose
|
|
||||||
- `Alt + L` - Browse Poses with Arrow Keys
|
|
||||||
### Menu Controls
|
|
||||||
- `Single click` - Apply Pose
|
|
||||||
- `Shift + Click` - Rename Pose
|
|
||||||
- `Alt + Click` - Remove Pose
|
|
||||||
- `Ctrl + Click ` - Select Pose
|
|
||||||
- Choose `Edit` for fast Move/Rename/Removal
|
|
||||||
|
|
||||||
## Considerations
|
|
||||||
- Opening older scenes will cause existing Pose Libraries to unlink from their former targets and fall into orphan state. They can be re-linked and will retain their link when saved afterwards, but would otherwise disappear if saved without linking or protecting the datablock.
|
|
||||||
- This is due to the core DNA type `poselib` having been removed, so objects will drop the data. [There is no way to prevent this](https://developer.blender.org/docs/features/core/rna/#internals) as Python ID properties cannot be present at program runtime, only once the add-on is initialized.
|
|
||||||
- To mitgate, an operator is provided to protect orphaned pose libraries: `dspl.protect_orphan_pose_library`.
|
|
||||||
|
|
||||||
- This add-on was made much easier by the `pose_markers` property being retained for converting old pose libraries to the new asset system. If they decide to remove that property as well, there will be a need to improvise an index-based lookup.
|
|
||||||
|
10
__init__.py
10
__init__.py
@ -3,10 +3,10 @@ from . import gui, operators, common, keymaps
|
|||||||
bl_info = \
|
bl_info = \
|
||||||
{
|
{
|
||||||
"name": "Damn Simple Pose Library",
|
"name": "Damn Simple Pose Library",
|
||||||
"author": "breakingspell",
|
"author": "jackie",
|
||||||
"version": (0, 1, 0),
|
"version": (4, 1, 0),
|
||||||
"blender": (3, 6, 0),
|
"blender": (3, 5, 0),
|
||||||
"description": "Re-implement Pose Library",
|
"description": "woah",
|
||||||
"category": "Object Data",
|
"category": "Object Data",
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -24,7 +24,7 @@ if _need_reload:
|
|||||||
|
|
||||||
class dsplSettings(bpy.types.PropertyGroup):
|
class dsplSettings(bpy.types.PropertyGroup):
|
||||||
new_menu: bpy.props.BoolProperty(
|
new_menu: bpy.props.BoolProperty(
|
||||||
name="New Menu", description="Toggle New Menu", default=True)
|
name="New Menu", description="Toggle New Menu", default=False)
|
||||||
edit_mode: bpy.props.BoolProperty(
|
edit_mode: bpy.props.BoolProperty(
|
||||||
name="Edit Mode", description="Toggle Edit Mode", default=False)
|
name="Edit Mode", description="Toggle Edit Mode", default=False)
|
||||||
|
|
||||||
|
50
common.py
50
common.py
@ -37,17 +37,6 @@ def searchPoseMarker(context, posename, type):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def selectBonesinPose(context, posename, active_marker):
|
|
||||||
try:
|
|
||||||
arm_object, pose_library = getArmatureData(context)
|
|
||||||
for bone in arm_object.pose.bones:
|
|
||||||
bone.bone.select = False
|
|
||||||
if findKeyframe(context, bone, active_marker.frame):
|
|
||||||
bone.bone.select = True
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
def findFcurve(context, bone_name, transform, index_int):
|
def findFcurve(context, bone_name, transform, index_int):
|
||||||
arm_object, pose_library = getArmatureData(context)
|
arm_object, pose_library = getArmatureData(context)
|
||||||
pose_markers = pose_library.pose_markers
|
pose_markers = pose_library.pose_markers
|
||||||
@ -73,16 +62,6 @@ def createFcurve(context, bone_name, transform, index_int):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def findKeyframe(context, bone, active_frame):
|
|
||||||
arm_object, pose_library = getArmatureData(context)
|
|
||||||
|
|
||||||
for fcu in pose_library.fcurves:
|
|
||||||
if fcu.data_path.startswith('pose.bones["'+bone.name+'"]'):
|
|
||||||
for kp in fcu.keyframe_points:
|
|
||||||
if kp.co.x == active_frame:
|
|
||||||
return fcu.data_path
|
|
||||||
|
|
||||||
|
|
||||||
def createKeyframe(context, bone_name, transform, index_int, new_marker, loc):
|
def createKeyframe(context, bone_name, transform, index_int, new_marker, loc):
|
||||||
arm_object, pose_library = getArmatureData(context)
|
arm_object, pose_library = getArmatureData(context)
|
||||||
pose_markers = pose_library.pose_markers
|
pose_markers = pose_library.pose_markers
|
||||||
@ -105,7 +84,11 @@ def setKeyframesFromBones(context, arm_object, new_marker):
|
|||||||
if bone.bone.select or none_selected == True:
|
if bone.bone.select or none_selected == True:
|
||||||
bone_name = bone.name
|
bone_name = bone.name
|
||||||
|
|
||||||
if bone.rotation_mode in ("XYZ", "XZY", "YXZ", "YZX", "ZXY", "ZYX"):
|
if bone.rotation_mode == "XYZ":
|
||||||
|
rot_mode = "rotation_euler"
|
||||||
|
elif bone.rotation_mode == "YZX":
|
||||||
|
rot_mode = "rotation_euler"
|
||||||
|
elif bone.rotation_mode == "ZXY":
|
||||||
rot_mode = "rotation_euler"
|
rot_mode = "rotation_euler"
|
||||||
elif bone.rotation_mode == "QUATERNION":
|
elif bone.rotation_mode == "QUATERNION":
|
||||||
rot_mode = "rotation_quaternion"
|
rot_mode = "rotation_quaternion"
|
||||||
@ -166,10 +149,11 @@ def setBonesfromKeyframes(context, arm_object, active_marker):
|
|||||||
if bone.bone.select or none_selected == True:
|
if bone.bone.select or none_selected == True:
|
||||||
bone_name = bone.name
|
bone_name = bone.name
|
||||||
|
|
||||||
if findKeyframe(context, bone, active_marker.frame) is None:
|
if bone.rotation_mode == "XYZ":
|
||||||
continue
|
rot_mode = "rotation_euler"
|
||||||
|
elif bone.rotation_mode == "YZX":
|
||||||
if bone.rotation_mode in ("XYZ", "XZY", "YXZ", "YZX", "ZXY", "ZYX"):
|
rot_mode = "rotation_euler"
|
||||||
|
elif bone.rotation_mode == "ZXY":
|
||||||
rot_mode = "rotation_euler"
|
rot_mode = "rotation_euler"
|
||||||
elif bone.rotation_mode == "QUATERNION":
|
elif bone.rotation_mode == "QUATERNION":
|
||||||
rot_mode = "rotation_quaternion"
|
rot_mode = "rotation_quaternion"
|
||||||
@ -194,9 +178,21 @@ def setBonesfromKeyframes(context, arm_object, active_marker):
|
|||||||
scl_z = findFcurve(context, bone_name, "scale", 2) or 1.0
|
scl_z = findFcurve(context, bone_name, "scale", 2) or 1.0
|
||||||
|
|
||||||
bone.location = mathutils.Vector((loc_x, loc_y, loc_z))
|
bone.location = mathutils.Vector((loc_x, loc_y, loc_z))
|
||||||
if rot_mode == "rotation_euler":
|
if bone.rotation_mode == "XYZ":
|
||||||
bone.rotation_euler = mathutils.Euler(
|
bone.rotation_euler = mathutils.Euler(
|
||||||
(rot_x, rot_y, rot_z))
|
(rot_x, rot_y, rot_z))
|
||||||
|
elif bone.rotation_mode == "YZX":
|
||||||
|
bone.rotation_euler = mathutils.Euler(
|
||||||
|
(rot_x, rot_y, rot_z))
|
||||||
|
elif bone.rotation_mode == "ZXY":
|
||||||
|
bone.rotation_euler = mathutils.Euler(
|
||||||
|
(rot_z, rot_x, rot_y))
|
||||||
|
elif bone.rotation_mode == "YXZ":
|
||||||
|
bone.rotation_euler = mathutils.Euler(
|
||||||
|
(rot_y, rot_x, rot_z))
|
||||||
|
elif bone.rotation_mode == "XZY":
|
||||||
|
bone.rotation_euler = mathutils.Euler(
|
||||||
|
(rot_x, rot_z, rot_y))
|
||||||
elif rot_mode == "rotation_quaternion":
|
elif rot_mode == "rotation_quaternion":
|
||||||
bone.rotation_quaternion = mathutils.Quaternion(
|
bone.rotation_quaternion = mathutils.Quaternion(
|
||||||
(rot_w, rot_x, rot_y, rot_z))
|
(rot_w, rot_x, rot_y, rot_z))
|
||||||
|
13
operators.py
13
operators.py
@ -254,7 +254,7 @@ class DSPL_OT_MovePose(bpy.types.Operator):
|
|||||||
class DSPL_OT_ApplyPose(bpy.types.Operator):
|
class DSPL_OT_ApplyPose(bpy.types.Operator):
|
||||||
bl_idname = "dspl.apply_pose"
|
bl_idname = "dspl.apply_pose"
|
||||||
bl_label = "Apply Pose"
|
bl_label = "Apply Pose"
|
||||||
bl_description = "Apply Pose (Ctrl+Click to select bones, Shift+Click to rename, Alt+Click to remove)"
|
bl_description = "Apply Pose (Ctrl+Click to select, Alt+Click to remove)"
|
||||||
bl_options = {'REGISTER', 'UNDO'}
|
bl_options = {'REGISTER', 'UNDO'}
|
||||||
|
|
||||||
posename: bpy.props.StringProperty()
|
posename: bpy.props.StringProperty()
|
||||||
@ -283,16 +283,9 @@ class DSPL_OT_ApplyPose(bpy.types.Operator):
|
|||||||
|
|
||||||
def invoke(self, context, event):
|
def invoke(self, context, event):
|
||||||
if event.ctrl:
|
if event.ctrl:
|
||||||
# Select bones
|
# Select
|
||||||
arm_object, pose_library = getArmatureData(context)
|
arm_object, pose_library = getArmatureData(context)
|
||||||
active_marker = searchPoseMarker(context, posename=self.posename, type="marker")
|
pose_library.pose_markers.active_index = searchPoseMarker(context, posename=self.posename, type="index")
|
||||||
|
|
||||||
arm_object.select = True
|
|
||||||
bpy.context.view_layer.objects.active = arm_object
|
|
||||||
bpy.ops.object.mode_set(mode='POSE')
|
|
||||||
selectBonesinPose(context, self.posename, active_marker)
|
|
||||||
|
|
||||||
self.execute(context)
|
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
elif event.alt:
|
elif event.alt:
|
||||||
# Remove
|
# Remove
|
||||||
|
Reference in New Issue
Block a user