2.5: RNA, defining enums, pointers and collections properties is now
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Tue, 18 Aug 2009 01:29:25 +0000 (01:29 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Tue, 18 Aug 2009 01:29:25 +0000 (01:29 +0000)
commit4fb19159ea47027bbaf31d379da3d6b0ea0f0f28
treeb50c21dd7873b33912516c9f59429afec5a856c7
parenta5da26f59d8cd820ca4d27a06028dd6aaee65784
2.5: RNA, defining enums, pointers and collections properties is now
possible from python, but it's still work in progress.

Pointers and collections are restricted to types derived from
IDPropertyGroup (same as for operators), because RNA knows how to
allocate/deallocate those.

Collections have .add() and .remove(number) functions that can be
used. The remove function should be fixed to take an other argument
than a number.

With the IDPropertyGroup restriction, pointers are more like nested
structs. They don't have add(), remove() yet, not sure where to put
them. Currently the pointer / nested struct is automatically allocated
in the get() function, this needs to be fixed, rule is that RNA get()
will not change any data for thread safety.

Also, it is only possible to add properties to structs after they have
been registered, which needs to be improved as well.

Example code:
http://www.pasteall.org/7201/python
15 files changed:
source/blender/blenkernel/intern/idprop.c
source/blender/blenloader/intern/readfile.c
source/blender/blenloader/intern/writefile.c
source/blender/editors/screen/screen_ops.c
source/blender/makesrna/RNA_access.h
source/blender/makesrna/RNA_types.h
source/blender/makesrna/intern/rna_ID.c
source/blender/makesrna/intern/rna_access.c
source/blender/makesrna/intern/rna_define.c
source/blender/makesrna/intern/rna_internal.h
source/blender/makesrna/intern/rna_main.c
source/blender/makesrna/intern/rna_render.c
source/blender/makesrna/intern/rna_ui.c
source/blender/python/intern/bpy_rna.c
source/blender/python/intern/bpy_rna.h