diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-02-01 09:59:50 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-02-01 09:59:50 +0400 |
commit | a834007a9b9b7adca2e57bf6ff575524bee80804 (patch) | |
tree | 527913e721ecee8b87095ebbf29ebeb2b099018d /source/blender/blenkernel/intern/armature.c | |
parent | 7836069775a688cceb40d3892d84886e80c437fd (diff) |
Previous fix for [#29484] wasn't working right (did work in report file though).
this now shares code with RNA's 'pchan.matrix = matrix'
tested with parent scale/rot/translation
Diffstat (limited to 'source/blender/blenkernel/intern/armature.c')
-rw-r--r-- | source/blender/blenkernel/intern/armature.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index 64ea862477f..02b9330d588 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -1319,6 +1319,23 @@ void armature_loc_pose_to_bone(bPoseChannel *pchan, float *inloc, float *outloc) copy_v3_v3(outloc, nLocMat[3]); } +void armature_mat_pose_to_bone_ex(Object *ob, bPoseChannel *pchan, float inmat[][4], float outmat[][4]) +{ + bPoseChannel work_pchan = *pchan; + + /* recalculate pose matrix with only parent transformations, + * bone loc/sca/rot is ignored, scene and frame are not used. */ + where_is_pose_bone(NULL, ob, &work_pchan, 0.0f, FALSE); + + /* find the matrix, need to remove the bone transforms first so this is + * calculated as a matrix to set rather then a difference ontop of whats + * already there. */ + unit_m4(outmat); + pchan_apply_mat4(&work_pchan, outmat, FALSE); + + armature_mat_pose_to_bone(&work_pchan, inmat, outmat); +} + /* same as object_mat3_to_rot() */ void pchan_mat3_to_rot(bPoseChannel *pchan, float mat[][3], short use_compat) { |