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

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2018-09-26 21:00:44 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2018-09-26 21:12:30 +0300
commit5808784c02674e900323e4b8d14ef242917c6ee5 (patch)
tree651a76eb426d9d98dfc69c7fa112ec821d3f58e8 /space_view3d_copy_attributes.py
parent08f39b75b9bf459d7b2cd2a06a258abdcebba840 (diff)
Fix incorrect pose bone copy with multiple objects in pose mode.
Diffstat (limited to 'space_view3d_copy_attributes.py')
-rw-r--r--space_view3d_copy_attributes.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/space_view3d_copy_attributes.py b/space_view3d_copy_attributes.py
index 4e2bbb03..3fca5d11 100644
--- a/space_view3d_copy_attributes.py
+++ b/space_view3d_copy_attributes.py
@@ -101,13 +101,16 @@ def getmat(bone, active, context, ignoreparent):
"""Helper function for visual transform copy,
gets the active transform in bone space
"""
- obj_act = context.active_object
- data_bone = obj_act.data.bones[bone.name]
+ obj_bone = bone.id_data
+ obj_active = active.id_data
+ data_bone = obj_bone.data.bones[bone.name]
# all matrices are in armature space unless commented otherwise
- otherloc = active.matrix # final 4x4 mat of target, location.
+ active_to_selected = obj_bone.matrix_world.inverted() @ obj_active.matrix_world
+ active_matrix = active_to_selected @ active.matrix
+ otherloc = active_matrix # final 4x4 mat of target, location.
bonemat_local = data_bone.matrix_local.copy() # self rest matrix
if data_bone.parent:
- parentposemat = obj_act.pose.bones[data_bone.parent.name].matrix.copy()
+ parentposemat = obj_bone.pose.bones[data_bone.parent.name].matrix.copy()
parentbonemat = data_bone.parent.matrix_local.copy()
else:
parentposemat = parentbonemat = Matrix()
@@ -160,13 +163,15 @@ def pVisLocExec(bone, active, context):
def pVisRotExec(bone, active, context):
+ obj_bone = bone.id_data
rotcopy(bone, getmat(bone, active,
- context, not context.active_object.data.bones[bone.name].use_inherit_rotation))
+ context, not obj_bone.data.bones[bone.name].use_inherit_rotation))
def pVisScaExec(bone, active, context):
+ obj_bone = bone.id_data
bone.scale = getmat(bone, active, context,
- not context.active_object.data.bones[bone.name].use_inherit_scale)\
+ not obj_bone.data.bones[bone.name].use_inherit_scale)\
.to_scale()