Importing Animations

Hello,

i want to write a plugin that imports animations. the Animations are having a 3 x 3 Matrix and a position (x, y,z) each frame.

is it possible to import that animations into blender? if yes, can you explain me what to do with the animation matrix?

thank you in advance

Regards

oxygene

If these are just general 3D bodies, and not armatures then:

1.) Import the matrix and create a matrix object using the Mathutils module. Convert it to an euler.

2.) Assign the location (x, y, z) to your object your animating. Then set the rotation of the object using the euler from (1).

3.) Insert the proper keys into an IPO.

For the matrix, its important to know whether or not its in local space or world/global space. This will change how you need to interpret it mathematically for it to work properly.

Thank you for your answer.

These are normal 3d objects. the position is based on the local object. the rotation i think is for the object the local transformation, here are some sample values:


Frame 0 of 59
Object0:
Trafo: 
( 1.000000 , 0.000000 , 0.000000 ) 
( 0.000000 , 1.000000 , 0.000000 ) 
( 0.000000 , 0.000000 , 1.000000 ) 
Position: 
( 0.000000 , 0.000000 , 12.322540 ) 
Object1:
Trafo: 
( 1.000000 , 0.000000 , 0.000000 ) 
( 0.000000 , 1.000000 , 0.000000 ) 
( 0.000000 , 0.000000 , 1.000000 ) 
Position: 
( 0.000000 , 0.000000 , 0.090195 ) 

1.) Import the matrix and create a matrix object using the Mathutils module. Convert it to an euler.

What do you mean exaktly with an euler? Are there any samples available which where helpful for the using animations?

Thank you in advance for your help

Regards

Oxygene

It’d be something like (once you have your matrices properly imported):


import Blender.Mathutils

...Whatever Code you Need here...

mat = Mathutils.Matrix(row1, row2, row3)
eul = mat.toEuler()

object.setLocation
object.setEuler(eul)

...Proceed to set IPO keys, etc....