So I wanted to adjust a posebone using Python script, and I ran into something wierd:
import bpy
def Twist(mat):
mat[0][2] = 0
mat[1][2] = -1 #line5
mat[2][2] = 0
mat[3][2] = 0 #line7
return
matrix = bpy.data.objects.get('Armature').pose.bones['Bone'].matrix
Twist(matrix)
print (matrix)
This small piece of code acts wierd for the test bone I used, since at first it dose nothing; yet, if I siwtch line 5 and line 7, it actually twists the target posebone z axis towards global -y, resulting into a kinda "mirrored" bone. In short, somehow the order of value assignment actually matters, and I wonder why.
Could it be some hidden update mechanics (of class matrix
perhaps?) that I don't know that caused this? And how should I properly manipulate posebones if what I did was wrong?
FYI: Here is the .blend
file: