[Bf-extensions-cvs] [5808784c] blender2.8: Fix incorrect pose bone copy with multiple objects in pose mode.

Brecht Van Lommel noreply at git.blender.org
Wed Sep 26 20:12:50 CEST 2018


Commit: 5808784c02674e900323e4b8d14ef242917c6ee5
Author: Brecht Van Lommel
Date:   Wed Sep 26 20:00:44 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBA5808784c02674e900323e4b8d14ef242917c6ee5

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

===================================================================

M	space_view3d_copy_attributes.py

===================================================================

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()



More information about the Bf-extensions-cvs mailing list