Matrix right hand to left hand problem
I am doing export animation data from Blender to DirectX.
First, I personally am not very familiar with the Blender API, so I can't help you specifically with the API or the Python language.
Second, if you're not already doing it, you should be testing with the simplest mesh/armature combination you can create - possibly just 2 boxes and 2 bones. That will allow you to examine the actual values in each matrix, both on export and import, to determine if the matrices are being calculated exactly the way you expect.
So...
Are you writing an export script for Blender in Python? If so, you may want to examine this exporter to see how someone else has done it. It was written against the Blender 2.69 API, but the method should still be appropriate.
I found some method convert right hand matrix to left hand before transpose, but not work.
The general approach is correct. If it doesn't work, you'll have to determine where your code is incorrect. Perhaps examining the exporter linked above will help.
N.B., even when you get the matrix conversion working, conversion of the mesh data itself will have to be done. E.g., vertex normals, texture coords, etc., must also be converted. Again, the linked exporter script is well-commented and the various conversions are explicitly coded. EDIT2: You may have to invert the order of the face indices from CCW to CW if you want to use CCW culling mode in D3D.
EDIT:
The final matrix of bind pose: offset*bone_to_parent[n]*bone_to_parent[n-1]... == identity matrix
Although that will tell you if your matrices are correct, it won't provide you any useful information if the matrices are not correct. It's likely you'll find the problem(s) much more quickly if, as suggested above, you examine the matrix values themselves.
Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.
You don't forget how to play when you grow old; you grow old when you forget how to play.
I use 2 box for test, just bind pose.
My to_parent matrix formula is wrong when in column vector:
to_child = pose_bones[ix-1].matrix.inverted()*pose_bones[ix].matrix
to_parent = to_child.inverted()
It should be flip the order of multiplication, that cause my final matrix wrong.(Formula still not all right)
The final matrix is different between column vector and row vector:
column vector final matrix: bone_to_parent[0]*bone_to_parent[1]* ... *bone_to_parent[n]*offset == identity matrix
row vector, column vector, right hand, left hand, they are confused
bind pose OK now: (but motion pose is wrong)

