Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-03-03 10:41:09 +0300
committerCampbell Barton <ideasman42@gmail.com>2011-03-03 10:41:09 +0300
commit3a2ce2be8337196436a464e4f865bb84d28485a5 (patch)
tree1b412bd190dee79250bd477f7992d4d09730c70a /source/blender/python/intern/bpy_rna.h
parentb535c738d968b84bfefcd9cfa38a549d53b68c04 (diff)
Py/RNA api - real collection iterator
Previously the api just converted the collection to a list and got the iterator from the list to return. This has the advantage that it uses minimal memory on large collections where before it would make an array. Though the main reason for this change is to support a bugfix for collections which free memory when they are done, this currently crashes the python api since once the list is built, the data is freed which is used by the list items in some cases (dynamic enums for eg).
Diffstat (limited to 'source/blender/python/intern/bpy_rna.h')
-rw-r--r--source/blender/python/intern/bpy_rna.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/source/blender/python/intern/bpy_rna.h b/source/blender/python/intern/bpy_rna.h
index aa8eaf3601a..9c2b2b62ff8 100644
--- a/source/blender/python/intern/bpy_rna.h
+++ b/source/blender/python/intern/bpy_rna.h
@@ -40,6 +40,8 @@
/* different method */
//#define USE_PYRNA_INVALIDATE_WEAKREF
+/* use real collection iterators rather then faking with a list */
+#define USE_PYRNA_ITER
/* sanity checks on above defs */
#if defined(USE_PYRNA_INVALIDATE_WEAKREF) && !defined(USE_WEAKREFS)
@@ -113,6 +115,16 @@ typedef struct {
int arrayoffset; /* array first item offset, e.g. if face.uv is [4][2], arrayoffset for face.uv[n] is 2n */
} BPy_PropertyArrayRNA;
+typedef struct {
+ PyObject_HEAD /* required python macro */
+#ifdef USE_WEAKREFS
+ PyObject *in_weakreflist;
+#endif
+
+ /* collection iterator spesific parts */
+ CollectionPropertyIterator iter;
+} BPy_PropertyCollectionIterRNA;
+
/* cheap trick */
#define BPy_BaseTypeRNA BPy_PropertyRNA