Extensions:2.4/Py/Scripts/Animation/PoseLib16
PoseLib16
About
UI location | Group: Animation | ||
---|---|---|---|
Version | 1.0 (Sept 22,2006) | Author(s) | Basil_Fawlty/Cage_drei (Andrew Cruse) |
Blender | 2.42a | License | GPL |
Note(s) | Example File: pose_script_test.zip (seperate download may be unavailible). |
File name | PoseLib16e2.py |
---|
Links | http://blenderartists.org/forum/showthread.php?t=73317
http://www.the.cage.page.phantom3d.net/blender/PoseLib16e2.py |
---|
Introduction
This script provides several tools for pose and armature handling. It uses Blender Library type poses and provides animation support using batch import and export of those poses. It also provides various tools for pose tweaking and development and can import and export Poser poses.
This script processes bone quaternion rotations four different ways to produce four varieties of poses.
1) Blender Library type. This method seems to embed bone roll data in the pose, making it difficult to use the pose with armatures other than the source armature.
Save: quat without processing Load: quat without processing
Note: No conversion processing is required for default poses.
2) Restmatrix type (exported in bvh data, also from PoserPython). Essentially lacks embedded bone roll data in the pose, so the pose can be loaded onto armatures with different bone roll setups.
Save: quat = (rest_matrix_invert * quat_as_matrix * rest_matrix).toQuat() Load: quat = (rest_matrix * quat_as_matrix * rest_matrix_invert).toQuat()
Note: Load restmatrix type poses using the 'Restmatrix pose ('No Roll')' option.
3) Posematrix type. This type uses the poseMatrix to export IK and constraints. This type also embeds bone roll data.
Save: quat = (posematrix * parent_posematrix).toQuat() Load: quat = (quat_as_matrix * (rest_matrix * parent_rest_matrix_invert).invert()).toQuat()
Note: Load posematrix type poses using the 'Posematrix pose ('IK')' option.
4) Combination posematrix and restmatrix type. Combined correctly, types 2) and 3) can render a pose which both contains IK and constraint data, but lacks embedded bone roll. This is not simply a matter of encoding the data both ways on export and import. That works - in the order 3)-2) for export and 2)-3) for import - but the bone roll information remains embedded. To export the benefits of both, they are processed as they would be if type 3) were saved, then loaded, then saved again as type 2).
Save: quat = ((posematrix * parent_posematrix) * (rest_matrix * parent_restmatrix_invert).invert()).toQuat() This is a combination of the save and load for type three. Then it is passed to the save process for type two. quat = (rest_matrix_invert * quat_as_matrix * rest_matrix).toQuat() Load: quat = (rest_matrix * quat_as_matrix * rest_matrix_invert).toQuat()
Note: Load combination type poses using the 'Restmatrix pose ('No Roll')' option.
That's kind of a shorthand version of the handling in this script. Type 2 poses are based on the work of Campbell Barton. Type three poses are based on scripts by der_ton and others.
- Save fxn, load fxn, and pose formatting are adapted from Blender Library
- PoseMatrix pose handling adapted from der_ton's md5 I/O scripts
- "No roll"/restmatrix pose handling adapted from Campbell Barton's bvh_import.py for 2.42
- Radians conversion borrowed from xsi export, by "Elira"
- GUI colorbox from discombobulator.py
This script is designed to work with my poser2blender.py for PoserPython
Some elements of this script are still in development:
- Bone layer handling will be added once it is added to the BPy API.
- align_chains and boneroll_correction both need tweaking.
- Poses exported with save_poser are occasionally incorrect. Blender's quaternion to euler conversions don't seem to return the correct results for this purpose, and no wholly correct conversion method has yet been found.
Support
- Python & Plugins forum at Blender Artists.