state of 2.4 armature api

Scripting in Blender with Python, and working on the API

Moderators: jesterKing, stiv

Post Reply
kakapo
Posts: 0
Joined: Sat Sep 04, 2004 2:32 pm

state of 2.4 armature api

Post by kakapo »

what is the state of the armature api in the current cvs builds? i would like to work on an exporter which supports writing out bone matrices (similar to the .x one). should i better wait?

LetterRip
Posts: 0
Joined: Thu Mar 25, 2004 7:03 am

Post by LetterRip »

I'm pretty sure it is being updated as ascotan, I would suggest waiting,

LetterRip

kakapo
Posts: 0
Joined: Sat Sep 04, 2004 2:32 pm

Post by kakapo »

ok, i will wait...

it would be nice if the new get bone matrix function(s) would be a bit more logical and flexible.

for example if i remember correctly getrestmatrix returned the matrix of the current frame but didn't the "rest" in the name indicate that it's supposed to return the matrix of the bind pose?

onip
Posts: 0
Joined: Fri Sep 30, 2005 6:32 am

Post by onip »

It's could be very useful if we can get local(relative to parent) bone information in a more readable format(euler. not quaternion or matrix),in this way it's should be more easy to make procedural rig and procedural animation with armature.Now it's really difficult to write even a simply expression to control for example the rotation of a bone,too much work for very little results,I think that the possibility to use python for rigging and animation has not considered too much.
Sorry for my bad english
Ciao
pino

housetroll0
Posts: 0
Joined: Sun Jun 26, 2005 7:58 pm

Post by housetroll0 »

I agree. I started using blender because I want to model procedurally. However, on the latest CVS the armatures wont even be displayed when they are made with python.

ascotan
Posts: 0
Joined: Thu May 29, 2003 10:32 pm
Location: Maryland, U.S.

Post by ascotan »

I working as fast as I can :)

onip
Posts: 0
Joined: Fri Sep 30, 2005 6:32 am

Post by onip »

Hi ascotan,thank you for your effort.Take it easy,use all the time you need for it,but please consider the possibility to give python scripters some more simple data for bone manipolation to work with.
I'm not a a programmer,but I used to script and write expression to control procedurally object(particulary setups for characters)in other programs.In MHO Blender is weak in this area,to complex to really use it ,at least for me :D
bye

LetterRip
Posts: 0
Joined: Thu Mar 25, 2004 7:03 am

Post by LetterRip »

onip - if you could post some of the different functions that you used in other programs and how you used them, it might help,

LetterRip

onip
Posts: 0
Joined: Fri Sep 30, 2005 6:32 am

Post by onip »

Hi LetterRip, the problem with bones for me is this:
5 years ago in Blender we have IKA( I use the program for a very long time).This kind of bones were not particulary spectacular, but could be easily animated with expressions,because they use Euler and it was very simple to make rotate ,for example,a bone in x when another object rotate in z(like now we can do with ipodrivers).With that bones i was able to control very good deformation in problematic areas like shoulders or doing some automatic control for rig(nothing really difficult,footroll, or automated clavicle for example).
Now(from 2000/2001) with quaternion it's not really possibile to separate the component of a rotation,I can make the conversion to/from Euler myself,but it's make the thing more complex.
Another(BIG) problem is IK.It's not possibile to know the rotation of a bone when is affected by an ik constraint(at least when i tried it,summer 2004,i hope this has changed).
When i tried it was possible to obtain via matrix the global but not the local orientation(I know that there is an option to return the local matrix but it's seams that it doesn't work),maybe I'm wrong but i read this forum and the elysiun and noone seems to have succeded in doing it.
The last problem is rest pose.Beeing separate from animation pose,make
difficult creating custom rig because the constraints are calculated for the animation state of a bone,but the skinning is done in the rest state,we need a function that syncronized the two states,aligning the rest pose to the animation pose when the constraints are applied,with this is possible to make, for example,ikspline setups utilizing the path contraint.
Sorry for my bad english
bye

an-toni
Posts: 0
Joined: Wed Mar 17, 2004 5:20 pm

Post by an-toni »

interesting, thanks for the info, onip.

when ascotan will commit the new armature module to cvs it's good time to review these issues..

~Toni

ascotan
Posts: 0
Joined: Thu May 29, 2003 10:32 pm
Location: Maryland, U.S.

Post by ascotan »

I'm planning on this update in 3 stages.
1st is to get the api for manipulating armature + bones. This includes getting, creating, manipulating the armature/bone data.
2nd is a pose module that will give access and allow manipulation of the bones at a timeframe in the scene. This pose module will need to deal with constraints and the DAG.
3rd is the rewrite of the NLA module and it's relationship to the pose module and the object module.

Right now i'm still on 1. :)

1) yes it it looks like right now the manipulation of rotation in the bones will be done through the position of the head/tail and a roll or through a matrix.
It should be easy to get the euler rotation through the following:
e = Quaternion(bone.head, bone.roll).toEuler()
or
e = bone.matrix().toEuler()
To apply a rotation though you might need to do:
head = myEuler.toQuaternion().axis
roll = myEuler.toQuaternion().angle

2) IK is sorta gone. Right now we have 'connected to parent' which is IK in disguise. We need to make sure that the IK'ed values of head/tail, etc. are going to be correct. I'll keep an eye on it.

3) I plan on having the same user access to Pose as you would to armature. i.e. Object.Pose.bones['bone1'].matrix * myTransform or something. This will make posing bones fairly easy. Internally the 'pose' is in reality an IPO curve that defines a (delta)tranformation/time. The constraint constrains the IPO curve to certain limits. When you modify the rest pose the IPO constraints will be modified through the DAG which is another issue for the pose module.

onip
Posts: 0
Joined: Fri Sep 30, 2005 6:32 am

Post by onip »

Hi ascotan,your approach looks good to me :D
I find interesting point 3,in the past I have had some difficulties because I have tried to change directly the status of a pose without creating first an action(and in this way it dosen't work, the skinning goes crazy and sometimes blender crashes,the right way was to write an action from python containing the pose of the bones generated by the expressions).
It seems you are doing a good work,thank you.
Sorry for my english
Bye
pino

an-toni
Posts: 0
Joined: Wed Mar 17, 2004 5:20 pm

NLA

Post by an-toni »

i might start from 3. NLA soon, if/as we need some tools with it for orange.

Ton was thinking that simple / high level things, like defining that action A is used from frame n to m, might be interesting for scripting animations. Will try to think about it..

we looked at actions.c and the seemingly nice functions like copy_pose(), extract_pose_from_action() and blend_poses() would be the first i'd expose for NLA use.

~Toni

Post Reply