[Bf-extensions-cvs] [f5ab20e] blender-v2.78-release: Fixes: Snapping functions update for new limb types

Lucio Rossi noreply at git.blender.org
Mon Sep 26 14:33:51 CEST 2016


Commit: f5ab20ebe69d2da2b10828e0ad6766ce8b066af0
Author: Lucio Rossi
Date:   Thu Sep 22 13:15:38 2016 +0200
Branches: blender-v2.78-release
https://developer.blender.org/rBAf5ab20ebe69d2da2b10828e0ad6766ce8b066af0

Fixes: Snapping functions update for new limb types

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

M	rigify/rig_ui_pitchipoy_template.py

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

diff --git a/rigify/rig_ui_pitchipoy_template.py b/rigify/rig_ui_pitchipoy_template.py
old mode 100644
new mode 100755
index da3bda7..33737f0
--- a/rigify/rig_ui_pitchipoy_template.py
+++ b/rigify/rig_ui_pitchipoy_template.py
@@ -362,6 +362,45 @@ def ik2fk_arm(obj, fk, ik):
     # Rotation Correction
     correct_rotation(uarmi, uarm)
 
+    #Correct matrix if handi has IK_follow property
+    if 'IK_follow' in handi.keys():
+        identity = Matrix([[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]])
+        cns = handi.constraints[0]
+        parent = obj.pose.bones[cns.subtarget]
+        cns1 = handi.constraints[1]
+        parent1 = obj.pose.bones[cns1.subtarget]
+        infl = cns.influence
+
+        C = parent.matrix.inverted()
+        #A=(obj.matrix_world*parent1.matrix)
+        #B=parent1.matrix.inverted()
+        #C = obj.pose.bones['torso'].matrix.inverted()
+        #D = obj.pose.bones['torso'].matrix_basis.inverted()
+        #E = parent1.matrix_basis.inverted()
+        #E=E*E
+        F=parent1.matrix_channel.inverted()
+        #start_bone = parent1
+        #while (True):
+        #    if start_bone.parent==None:
+        #        break
+        #    E = start_bone.parent.matrix_basis.inverted()*start_bone.parent.matrix_basis.inverted()*E
+        #    start_bone = start_bone.parent
+        #T = C.to_translation()#translation part
+        #T = Matrix.Translation((T[0],T[1],T[2],1))
+        #T1 = F.to_translation()
+        #T = Matrix.Translation((T1[0],T1[1],T1[2],1))
+        #R = C.to_quaternion()#Rotation part
+        #R1 = F.to_quaternion()
+        #S = C.to_scale() #Scale part
+        #S1 = F.to_scale()
+        #cns_mat = infl*(parent.matrix.inverted()*parent.matrix.inverted() - identity) + identity
+        #cns1_mat = (1-infl)*( F*F - identity) + identity
+        C=C*C
+        F=F*F
+        G = C.lerp(F,1-infl)
+        handi.matrix = G*handi.matrix
+
+
 #     farmi.constraints["IK"].pole_target = obj
 #     farmi.constraints["IK"].pole_subtarget = farm.name
 #     farmi.constraints["IK"].pole_angle = -1.74533
@@ -457,6 +496,44 @@ def ik2fk_leg(obj, fk, ik):
     # Rotation Correction
     correct_rotation(thighi,thigh)
 
+    #Correct matrix if footi has IK_follow property
+    if 'IK_follow' in footi.keys():
+        identity = Matrix([[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]])
+        cns = footi.constraints[0]
+        parent = obj.pose.bones[cns.subtarget]
+        cns1 = footi.constraints[1]
+        parent1 = obj.pose.bones[cns1.subtarget]
+        infl = cns.influence
+
+        C = parent.matrix.inverted()
+        #A=(obj.matrix_world*parent1.matrix)
+        #B=parent1.matrix.inverted()
+        #C = obj.pose.bones['torso'].matrix.inverted()
+        #D = obj.pose.bones['torso'].matrix_basis.inverted()
+        #E = parent1.matrix_basis.inverted()
+        #E=E*E
+        F=parent1.matrix_channel.inverted()
+        #start_bone = parent1
+        #while (True):
+        #    if start_bone.parent==None:
+        #        break
+        #    E = start_bone.parent.matrix_basis.inverted()*start_bone.parent.matrix_basis.inverted()*E
+        #    start_bone = start_bone.parent
+        #T = C.to_translation()#translation part
+        #T = Matrix.Translation((T[0],T[1],T[2],1))
+        #T1 = F.to_translation()
+        #T = Matrix.Translation((T1[0],T1[1],T1[2],1))
+        #R = C.to_quaternion()#Rotation part
+        #R1 = F.to_quaternion()
+        #S = C.to_scale() #Scale part
+        #S1 = F.to_scale()
+        #cns_mat = infl*(parent.matrix.inverted()*parent.matrix.inverted() - identity) + identity
+        #cns1_mat = (1-infl)*( F*F - identity) + identity
+        C=C*C
+        F=F*F
+        G = C.lerp(F,1-infl)
+        footi.matrix = G*footi.matrix
+
 #     shini.constraints["IK"].pole_target = obj
 #     shini.constraints["IK"].pole_subtarget = shin.name
 #     shini.constraints["IK"].pole_angle = -1.74533



More information about the Bf-extensions-cvs mailing list