Exporting animations in blender 2.63 (python)

Scripting in Blender with Python, and working on the API

Moderators: jesterKing, stiv

AlbinEng
Posts: 1
Joined: Fri Aug 03, 2012 12:15 am

Exporting animations in blender 2.63 (python)

Postby AlbinEng » Fri Aug 03, 2012 12:53 am

Hello, I'm in the process of porting one of my old model export scripts to the new version of blender but I've encountered some problems.

I used to use Blender.Armature.NLA.GetActions() then iterate each action and again iterate and set each key frame and just get the necessary information from the pose bones..

This no longer works with a new system in place.. I've found no resources regarding how things work now and I've spend hours going through the python/blender documents trying to figure out any way to get the right information.. but with no success .. :cry:

Does anyone have any insight into this? or know of any export scripts that have been ported to the new version?

I would be very grateful for any help regarding this. <3

dom107
Posts: 35
Joined: Wed Apr 18, 2012 10:04 am

Re: Exporting animations in blender 2.63 (python)

Postby dom107 » Tue Aug 07, 2012 2:14 pm

Hello,

For animation export, I’m using the principle found in io_export_directx_x.py.
See for example WriteFullAnimationSet. It looks like the animation is simulated frame by frame and at each step, you can extract the position, rotation, etc… to put in your export format.

It looks roughly like:

Code: Select all

  KeyframeCount = bpy.context.scene.frame_end - bpy.context.scene.frame_start + 1
   
    for Object in Config.ObjectList:
...       
        for Frame in range(0, KeyframeCount):
            bpy.context.scene.frame_set(Frame + bpy.context.scene.frame_start)
... get the current object position, rotation, scale, armature etc.. at the current framekey position
   process to store in your format


Does it fit your request?


Return to “Python”

Who is online

Users browsing this forum: No registered users and 1 guest