[Bf-committers] Python RNA/API help/todo's

Campbell Barton ideasman42 at gmail.com
Sun May 16 12:17:16 CEST 2010


On Sat, May 15, 2010 at 4:31 AM, Dan Eicher <dan at trollwerks.org> wrote:
> Got a second batch -- http://www.pasteall.org/13151/diff
>
> Wasn't sure if I was supposed to mess with the user count on the VFont one
> so just did like the image loading example.

applied this too, except for the node-tree part, need to investigate
how to create a 'Node Group', that can be added from the menu. though
I don't think this is high priority at the moment, probably better to
be done as a more general project for getting python to manipulate
nodes.

You asked this before if this was possible:
bpy.context.active_object.foo.bar_list += bpy.types.bar(1, 1, 1)

Though I'd suggest use basic pythjon types...
bpy.context.active_object.foo.bar_list += [1, 1, 1]

This could be done via
http://docs.python.org/c-api/typeobj.html#sq_inplace_concat
see bpy_rna.c
 PySequenceMethods pyrna_prop_collection_as_sequence = { .....

The collections add/remove functions conflict a bit with possible
custom functions collections might have,
Its confusing when the add function exists but often cant be used.
collection in-place concatenation is one way, which seems fine to me.

Removal can be done in a similar way
  del collection[i]
or...
  collection[0:3] = []

-- 
- Campbell


More information about the Bf-committers mailing list