Skip to content
Snippets Groups Projects
Commit 5808784c authored by Brecht Van Lommel's avatar Brecht Van Lommel
Browse files

Fix incorrect pose bone copy with multiple objects in pose mode.

parent 08f39b75
No related branches found
No related tags found
No related merge requests found
...@@ -101,13 +101,16 @@ def getmat(bone, active, context, ignoreparent): ...@@ -101,13 +101,16 @@ def getmat(bone, active, context, ignoreparent):
"""Helper function for visual transform copy, """Helper function for visual transform copy,
gets the active transform in bone space gets the active transform in bone space
""" """
obj_act = context.active_object obj_bone = bone.id_data
data_bone = obj_act.data.bones[bone.name] obj_active = active.id_data
data_bone = obj_bone.data.bones[bone.name]
# all matrices are in armature space unless commented otherwise # 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 bonemat_local = data_bone.matrix_local.copy() # self rest matrix
if data_bone.parent: 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() parentbonemat = data_bone.parent.matrix_local.copy()
else: else:
parentposemat = parentbonemat = Matrix() parentposemat = parentbonemat = Matrix()
...@@ -160,13 +163,15 @@ def pVisLocExec(bone, active, context): ...@@ -160,13 +163,15 @@ def pVisLocExec(bone, active, context):
def pVisRotExec(bone, active, context): def pVisRotExec(bone, active, context):
obj_bone = bone.id_data
rotcopy(bone, getmat(bone, active, 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): def pVisScaExec(bone, active, context):
obj_bone = bone.id_data
bone.scale = getmat(bone, active, context, 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() .to_scale()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment