[Bf-python] Generate NLA Strips with Python

Gilbert, Joseph jgilbert at tigr.org
Wed Apr 7 22:47:50 CEST 2004


Now that I think about this a little more maybe Im wrong. :!

The points from before still stand I think, but I realized that all the
actions and action channels, keys, nla strips, etc. are armature
specific, right?
Therefore, these things should probably be accessible through the
armature object. (or at least some of them).
I ran into this problem with the rendering stuff. There were 1000
functions that needed to be added for rendering support, however, I
realized that the rendering support was Scene specific so it had to be
called by a BpyScene object.  However, this stuff really didn't belong
in the scene module. So to attempt to resolve this, I put all the
functionality for the rendering module in sceneRender.c/.h and then
linked the function prototypes to the methoddef of the Scene module. So
you can do:
sce = Blender.Scene.New('scene')
sce.render()

even though the prototype is in a different module.
Maybe this is what would be needed here - armatureNLA.c
This would be an internal only module (no new module additions - no MSVC
changes) and the function prototypes could be added to the armature
methoddef.
So you could call:
armData = Blender.Armature.New('army')
armData.createActionStrip(myAction, frameStart, frameEnd)

As for the callback. I was thinking of a static function inside the
module without a prototype definition that would be called internally
from a module method. Take a look at the sceneRender.c file.
Anyhoo this is just a suggestion, but It would 
1. separate nla/action issues to a separate .c file
2. be called from a specific Bpy_Armature


-----Original Message-----
From: bf-python-admin at blender.org [mailto:bf-python-admin at blender.org]
On Behalf Of Roland Hess
Sent: Wednesday, April 07, 2004 7:46 AM
To: bf-python at blender.org
Subject: RE: [Bf-python] Generate NLA Strips with Python

>	My feeling about this is that there needs to be a complete NLA
module.
>This module should deal with actions, action Channels, action Keys, NLA
>strips, etc.  There are reasons (I see) for doing this:

Good reasons, every single one. Agreed. I'll work on it, but please 
see my note below*.

>  I also don't
>think that any changes to the .c src/ files are necessary. This can be
>simply added to the module as a callback.

Here's where my newbieness comes in.  I don't really know what a 
callback is, so I may be speaking from ignorance, but here goes... 
When looking through the NLA code, it seems that the section for 
creating the strip is repeated, verbatim, many times throughout. My 
thought was that an independent function that did this when given the 
proper parameters would be more in keeping with good programming 
practices, and that later, if someone so desired, they could clean up 
the NLA code and swap the duplicated sections for a single function 
call. What then, would be the advantage to reduplicating this code 
again in the Python section, essentially cutting and pasting, when 
the function already exists elsewhere?

>	It would be my suggestion to add a new NLA module. It could 
>simply contain
>1 prototype (for now) (and maybe a callback), and  eventually other
>developers could add addition functionality regarding armature
animation to
>this source file.

Will do.

>	p.s. All new python modules need updates to the MSVC 
>projectfiles 6.0 and
>7.0 and the SCons build file, but not the make file. (and also some
>documentation :)

*I have no way of doing this, as I'm compiling with free tools on 
Windows (cygwin, etc.). If I break this out into a new module, will 
the "make" system pick it up and compile it simply by having it in 
the proper directories? If not, what do I need to do to make it 
happen? Also, if I do so and get it working, would someone else be 
able to update the MSVC and SCons files?

Thanks for the input.

-- 
Roland Hess - harkyman
Digital Prepress/Network Administrator
Reed & Witting Company
_______________________________________________
Bf-python mailing list
Bf-python at blender.org
http://www.blender.org/mailman/listinfo/bf-python



More information about the Bf-python mailing list