diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-07-24 11:08:42 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-07-26 11:15:39 +0300 |
commit | 250995d67b772f0b7bd80aabb79b18d278ffc257 (patch) | |
tree | 069d056da3641c1e34fce4b4d5d7131d4e273cf2 /source/blender/blenkernel/intern/armature.c | |
parent | cf0f2f2d3dbf6e90a2c81d59bbdb8af538376f9c (diff) |
Fix T67507: Set origin on armature moves incorrectly parented objects
Need to copy changes from original armature to evaluated one prior to
BKE_pose_where_is(), otherwise the pose matrix in pose channels will
not be correct.
Can not use dependency graph update here, since we must not re-evaluate
possible dependencies of the changed armature.
Reviewers: brecht
Reviewed By: brecht
Maniphest Tasks: T67507
Differential Revision: https://developer.blender.org/D5331
Diffstat (limited to 'source/blender/blenkernel/intern/armature.c')
-rw-r--r-- | source/blender/blenkernel/intern/armature.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index c36acd1eae1..3621926e93b 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -239,6 +239,35 @@ bArmature *BKE_armature_copy(Main *bmain, const bArmature *arm) return arm_copy; } +static void copy_bone_transform(Bone *bone_dst, const Bone *bone_src) +{ + bone_dst->roll = bone_src->roll; + + copy_v3_v3(bone_dst->head, bone_src->head); + copy_v3_v3(bone_dst->tail, bone_src->tail); + + copy_m3_m3(bone_dst->bone_mat, bone_src->bone_mat); + + copy_v3_v3(bone_dst->arm_head, bone_src->arm_head); + copy_v3_v3(bone_dst->arm_tail, bone_src->arm_tail); + + copy_m4_m4(bone_dst->arm_mat, bone_src->arm_mat); + + bone_dst->arm_roll = bone_src->arm_roll; +} + +void BKE_armature_copy_bone_transforms(bArmature *armature_dst, const bArmature *armature_src) +{ + Bone *bone_dst = armature_dst->bonebase.first; + const Bone *bone_src = armature_src->bonebase.first; + while (bone_dst != NULL) { + BLI_assert(bone_src != NULL); + copy_bone_transform(bone_dst, bone_src); + bone_dst = bone_dst->next; + bone_src = bone_src->next; + } +} + static Bone *get_named_bone_bonechildren(ListBase *lb, const char *name) { Bone *curBone, *rbone; |