Blender Git Commit Log

Git Commits -> Revision 30dcada

Revision 30dcada by Campbell Barton (master)
June 30, 2009, 12:52 (GMT)
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.

Commit Details:

Full Hash: 30dcada24d1820e5aed4e1a671543e040918e910
SVN Revision: 21263
Parent Commit: 0c14be3
Lines Changed: +265, -15

3 Modified Paths:

/source/blender/makesrna/intern/rna_access.c (+17, -8) (Diff)
/source/blender/makesrna/RNA_access.h (+3, -0) (Diff)
/source/blender/python/intern/bpy_rna.c (+245, -7) (Diff)
By: Miika HämäläinenLast update: Nov-07-2014 14:18MiikaHweb | 2003-2021