diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-06-30 16:52:16 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-06-30 16:52:16 +0400 |
commit | 30dcada24d1820e5aed4e1a671543e040918e910 (patch) | |
tree | fac786d2adc97ac939e35d4dd9a94b1f526021d8 /source/blender/makesrna/RNA_access.h | |
parent | 0c14be3b5820d7130a281e95da664753a0ff2793 (diff) |
python access to RNA arrays.
coords = array.array('f', [0.0]) * len(me.verts) * 3
m.verts.foreach_get('co', coords)
the reverse works with set also.
currently works for python buffers or sequences (slower)
Quick speed test with 1,179,654 verts.
*foreach_get*
list 0.377
array 0.032
py 10.29
*foreach_set*
list 0.184
array 0.028
py 9.79
where python was done like this...
----
i= 0
for v in m.verts:
co = v.co
l[i] = co[0]; l[i+1] = co[0]; l[i+2] = co[0]
i+=3
----
some of the error checking here needs to be cleaned up to account for different invalid bad inputs.
Diffstat (limited to 'source/blender/makesrna/RNA_access.h')
-rw-r--r-- | source/blender/makesrna/RNA_access.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index 3c205020ba7..d69439e25bc 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -606,6 +606,9 @@ int RNA_property_collection_lookup_string(PointerRNA *ptr, PropertyRNA *prop, co int RNA_property_collection_raw_array(PointerRNA *ptr, PropertyRNA *prop, PropertyRNA *itemprop, RawArray *array); int RNA_property_collection_raw_get(struct ReportList *reports, PointerRNA *ptr, PropertyRNA *prop, char *propname, void *array, RawPropertyType type, int len); int RNA_property_collection_raw_set(struct ReportList *reports, PointerRNA *ptr, PropertyRNA *prop, char *propname, void *array, RawPropertyType type, int len); +int RNA_raw_type_sizeof(RawPropertyType type); +RawPropertyType RNA_property_raw_type(PropertyRNA *prop); + /* to create ID property groups */ void RNA_property_pointer_add(PointerRNA *ptr, PropertyRNA *prop); |