From 4fb19159ea47027bbaf31d379da3d6b0ea0f0f28 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Tue, 18 Aug 2009 01:29:25 +0000 Subject: 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 --- source/blender/blenkernel/intern/idprop.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/blenkernel/intern/idprop.c') diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c index 54366aadd92..3cff82f522a 100644 --- a/source/blender/blenkernel/intern/idprop.c +++ b/source/blender/blenkernel/intern/idprop.c @@ -167,7 +167,7 @@ void IDP_ResizeIDPArray(IDProperty *prop, int newlen) for (i=newlen; ilen; i++) { IDP_FreeProperty(GETPROP(prop, i)); } - memcpy(newarr, prop->data.pointer, newlen*prop->len*sizeof(IDProperty)); + memcpy(newarr, prop->data.pointer, newlen*sizeof(IDProperty)); } if(prop->data.pointer) -- cgit v1.2.3