[Bf-python] Suggestions for the basics of an NLA API

Joseph Gilbert jgilbert at tigr.ORG
Fri May 12 20:32:59 CEST 2006


Toni Alatalo wrote:

> in normal python i think these would be:
> NLA.actionstrips #a dict/mapping type of actions strips
> NLA.actionstrips.values() #the list of ActionObjects there
> NLA.actionsstrips['name'] #gets an actionstrip by name
> NLA.actionstrips.items() #list in format (name, object)
>
Yea this is the 'new' way of handling items. Both myself and ken have 
added these 'sequence' type objects to the API. I think that it makes 
the api more user friendly. We could really use as generic base type to 
make this type of seq iteration more easy to code.  I think this would 
be a more cleaner interface as well.

>> Removes that Action Strip from the Armature's NLA list.
>
> ActionStrip.delete()

Same thing. This would be a move to a seq iterator object instead of the 
'old' way.
 >>> del myActionStrip

> ActionStrip.addStrip("Name",Action Object
> this i either misunderstand or find very strange.

The correct way to generate a ActionStrip object should be:
myActionStrip = Module.ActionStrip(parameters)
or
myActionStrip = Object.newActionStrip(parameters)
depending on whether or not overriding tp_new is appropriate

> saw no problem there (apart from the naming convention perhaps .. 
> usually only classes, sometimes modules are with CamelCaps, and 
> methods and properties, if capsed at all, iirc with 
> smallStartingCamelCaps). i think even in bpy api only Modules, 
> Module.Function()s and Classes are with initial capital, methods and 
> attributeNames with not ( i may be missing something tho)

Good catch. All object method names are lowercase. Module method names 
are uppercase.

> Altering any of these properties or calling any of the methods  
> (except getStrips) should trigger an NLA window refresh.

Willian will have a fit if you add redraws in every method.

What about adding/removing bActions from bActionStrips??
Is there no such methods? I thought there would be somemthing like:
myActionStrip.actions.append(myAction)




More information about the Bf-python mailing list