Python DNA API Joint IDs order in joint groups do not match with values in the matrices

I’m working my way to be able to read/write from the values matrices for the different joint groups and expressions using the Python DNA API.

The initial assumption is that the order in which the joints are presented in the joint group should help decide where the slopes in the values matrix are. Well this is not only False, but I’ve found is random (in some joint groups the order in which values are presented match only when I sort the joint IDs in ascending order, just to name an example)

Here is another example with a face I’m working with ATM:
-Joint 324 (FACIAL_R_EyelidUpperA2) and Expression 11 (eye_blink_R)
-Joint Group 51: [321, 338, 322, 326, 324, 340, 341, 339]
-Joint index in joint group: 4
-Expression index in inputs: 15
-Inputs lenght: 41
-Outputs lenght: 48

Using these values I should be able to find the first of 6 output values at these coordinates in the matrix: (24, 15). Or in other words, at index 999 of the values. The remaining values should then be located at 1040, 1081, 1122, 1163 and 1204.

1122, 1163 and 1204 should be the rotation values of the joint when eye_blink_R is set to 1. BUT, they ARE NOT!.

Instead, if I do a manual search for the actual rotation I see in Maya when eye_blink_R is set to 1 (with the help of an IDE and the DNA file as JSON), I find the actual indexes of these values in the matrix are: 753, 794, 835, 876, 917, 958.

Given the first index is 753, the joint index of joint 324 in joint group 51 should be 3, not 4!! So the order in which the Python DNA API is returning these joint IDs is not reliable.

Did I miss something obvious? Or is there a sorting algoritm we should be aware of?

I wrote a small function to backtrack the correct joint order and for this particular case (Joint Group 51) it should be: [321, 338, 322, 324, 326, 339, 340, 341]. Seems to me like this sorting comes from the hierarchy matrices.

1 Like