[Bf-committers] Q about poses/channels + A from Ton + follow-up Q

Roland Hess rolandh at reed-witting.com
Thu Nov 17 20:20:58 CET 2005

I originally sent this question directly to ton:

>I'm building some character animation tools in source, and I'm 
>wondering what the proper way is to fill a pose's pose_mat matrix. 
>My function uses extract_pose_from_action to obtain the proper pose, 
>then uses get_pose_channel to access a pose channel within that pose.
>The problem i'm running into is that I need to access the pose_mat 
>member of that pose_channel, but it seems to always be set to the 
>identity matrix. Obviously, something needs to be done with that 
>pose object to have it properly fill that matrix. I attempted to 
>crib some of your code from the armature ghost drawing function, but 
>it just made the armature go kablooey. I'm really wondering what 
>sequence functions (or single function) I need to call on that 
>returned pose object (or individual pose_channel) to properly fill 

He responded (and indicated my original q should have been to this 
list for the record):

>The posechannel->pose_mat is read-only, and cannot be filled by user 
>input. It is the result of the sequence:
>bone_mat  x  "user/action transform"  x  constraints  x  IK
>Only the "user/action transform" is accesible (loc, quat, size). A 
>call to the depgraph then will update the pose matrices correctly.

Okay - here's my follow-up question. The pose I'm obtaining is 
extracted from an arbitrary action (act) at an arbitrary frame in 
that action (x), that do not necessarily correspond to the current 
action, the current frame, or even the currently selected object. 
I've just looked through the DAG code, and I think Ton is referring 
to submitting the object in question to DAG_pose_sort in depsgraph.c.

So here's the real question now: what conditions do I need to meet to 
make DAG_pose_sort work on the right info? I'm assuming I will have 
to set the object's active pose to the one I extracted, then call 
DAG_pose_sort, then copy out pose_mat (the matrix I need to check) 
for later reference. Of course, since I don't want this evaluation to 
be reflected in the armature on screen, I need to copy the pose 
information that's in the object before I set it to my extracted 
pose, so I can reset it after I'm done. Is it as simple as that, or 
is there some other kind of voodoo that needs to be involved?

Roland Hess - harkyman

More information about the Bf-committers mailing list