diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2012-01-17 17:30:20 +0400 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2012-01-17 17:30:20 +0400 |
commit | 25e3b647b198d3eeb14345ccbeb6ce96e23c2cf9 (patch) | |
tree | 1fac56629855ca2e27b461c4f2a3782358922f64 /source/blender/blenkernel/BKE_armature.h | |
parent | f3e39fc8c9d83fff1e4d591b27073586d855bdc6 (diff) |
New pchan to pose matrices computes. Fixes [#27898] Bone snap to cursor fails and [#29461] Selection-to-Cursor works strange with bones with TrackTo constraint. Also fixes some inconsistant behavior of no Inherit Rotation/Scale options.
WARNING: This commits modifies how translated unconnected child bones with *no Inherit Rotation option* are positionned. This means that if you open a posed/animated armature using such (corner-case) setup, you'll have to adjust manually the locations of such bones: now, disabling Inherit Rotation/Scale will no more move the bone, only affecting its rotation/scale.
Many thanks to Bassam Kurdali (slikdigit) for his advices and tests of the patch!
-----
Dev notesĀ : the pchan_to_pose_mat() func was added to BKE_armature.h, which computes two matrices to get the pose transformations (pchan) of the bone directly in pose (i.e. armature object) space. The first matrix is the rotation/scaling parts, the second one is for location.
That new function is used by (hence deduplicating and simplifying their code):
* The pose evaluation code (where_is_pose_bone()).
* The interactive transformation code (add_pose_transdata(), in transform_conversion.c).
* The snap to cursor/grid code (through armature_loc_pose_to_bone()/armature_mat_pose_to_bone()).
Diffstat (limited to 'source/blender/blenkernel/BKE_armature.h')
-rw-r--r-- | source/blender/blenkernel/BKE_armature.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_armature.h b/source/blender/blenkernel/BKE_armature.h index b301b7cf03b..a89bfbd50b1 100644 --- a/source/blender/blenkernel/BKE_armature.h +++ b/source/blender/blenkernel/BKE_armature.h @@ -114,6 +114,10 @@ void pchan_apply_mat4(struct bPoseChannel *pchan, float mat[][4], short use_coma void pchan_to_mat4(struct bPoseChannel *pchan, float chan_mat[4][4]); void pchan_calc_mat(struct bPoseChannel *pchan); +/* Get the "pchan to pose" transform matrix. These matrices apply the effects of + * HINGE/NO_SCALE/NO_LOCAL_LOCATION options over the pchan loc/rot/scale transformations. */ +void pchan_to_pose_mat(struct bPoseChannel *pchan, float rotscale_mat[][4], float loc_mat[][4]); + /* Rotation Mode Conversions - Used for PoseChannels + Objects... */ void BKE_rotMode_change_values(float quat[4], float eul[3], float axis[3], float *angle, short oldMode, short newMode); |