Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Gavrilov <angavrilov@gmail.com>2018-12-08 09:17:57 +0300
committerAlexander Gavrilov <angavrilov@gmail.com>2018-12-11 20:40:51 +0300
commit48a3f97b23501fd33f6e400b7682ea4cb2988a8a (patch)
tree10b571a29b3ba81d60f072ea648c24f2c59b684a /source/blender/blenkernel/BKE_armature.h
parent4de5478409ea3b7749de46ff28bedceb79b6b481 (diff)
RNA: provide access to bone parent transform math from Python.
Applying the effect of bone parent is much more complicated than simple matrix multiplication because of the various flags like Inherit Scale. Thus it is reasonable to provide access to this math from Python for complicated rest pose related manipulations. The simple case of this is handled by Object.convert_space, so the new method is only needed for complex tasks. Differential Revision: https://developer.blender.org/D4053
Diffstat (limited to 'source/blender/blenkernel/BKE_armature.h')
-rw-r--r--source/blender/blenkernel/BKE_armature.h21
1 files changed, 19 insertions, 2 deletions
diff --git a/source/blender/blenkernel/BKE_armature.h b/source/blender/blenkernel/BKE_armature.h
index e0e1103fe21..3a29dd0c3cb 100644
--- a/source/blender/blenkernel/BKE_armature.h
+++ b/source/blender/blenkernel/BKE_armature.h
@@ -128,9 +128,26 @@ void BKE_pchan_apply_mat4(struct bPoseChannel *pchan, float mat[4][4], bool use_
void BKE_pchan_to_mat4(struct bPoseChannel *pchan, float chan_mat[4][4]);
void BKE_pchan_calc_mat(struct bPoseChannel *pchan);
-/* Get the "pchan to pose" transform matrix. These matrices apply the effects of
+/* Simple helper, computes the offset bone matrix. */
+void BKE_get_offset_bone_mat(struct Bone *bone, float offs_bone[4][4]);
+
+/* Transformation inherited from the parent bone. These matrices apply the effects of
* HINGE/NO_SCALE/NO_LOCAL_LOCATION options over the pchan loc/rot/scale transformations. */
-void BKE_pchan_to_pose_mat(struct bPoseChannel *pchan, float rotscale_mat[4][4], float loc_mat[4][4]);
+typedef struct BoneParentTransform {
+ float rotscale_mat[4][4]; /* parent effect on rotation & scale pose channels */
+ float loc_mat[4][4]; /* parent effect on location pose channel */
+} BoneParentTransform;
+
+/* Matrix-like algebra operations on the transform */
+void BKE_clear_bone_parent_transform(struct BoneParentTransform *bpt);
+void BKE_invert_bone_parent_transform(struct BoneParentTransform *bpt);
+void BKE_combine_bone_parent_transform(const struct BoneParentTransform *in1, const struct BoneParentTransform *in2, struct BoneParentTransform *result);
+
+void BKE_apply_bone_parent_transform(const struct BoneParentTransform *bpt, const float inmat[4][4], float outmat[4][4]);
+
+/* Get the current parent transformation for the given pose bone. */
+void BKE_pchan_to_parent_transform(struct bPoseChannel *pchan, struct BoneParentTransform *r_bpt);
+void BKE_calc_bone_parent_transform(int bone_flag, const float offs_bone[4][4], const float parent_arm_mat[4][4], const float parent_pose_mat[4][4], struct BoneParentTransform *r_bpt);
/* 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);