diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2014-04-05 16:36:18 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2014-04-05 16:50:17 +0400 |
commit | 45507319635a0351d3c5010d75c32e40bf211d25 (patch) | |
tree | 909a5c2cf0816630bbe166de46d8e23d573db09d /source/blender/makesrna/RNA_types.h | |
parent | cb0520f79a7a2babd4c4a4f0d075c0d289b2a2f0 (diff) |
RNA: optimization to avoid malloc for iterators.
This mostly helps making Cycles scene synchronization a bit faster.
Diffstat (limited to 'source/blender/makesrna/RNA_types.h')
-rw-r--r-- | source/blender/makesrna/RNA_types.h | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/source/blender/makesrna/RNA_types.h b/source/blender/makesrna/RNA_types.h index 4bf0719f5c0..83f3870c29a 100644 --- a/source/blender/makesrna/RNA_types.h +++ b/source/blender/makesrna/RNA_types.h @@ -236,12 +236,40 @@ typedef enum PropertyFlag { PROP_ENUM_NO_TRANSLATE = (1 << 29), /* for enums not to be translated (e.g. renderlayers' names in nodes) */ } PropertyFlag; +struct CollectionPropertyIterator; +struct Link; +typedef int (*IteratorSkipFunc)(struct CollectionPropertyIterator *iter, void *data); + +typedef struct ListBaseIterator { + struct Link *link; + int flag; + IteratorSkipFunc skip; +} ListBaseIterator; + +typedef struct ArrayIterator { + char *ptr; + char *endptr; /* past the last valid pointer, only for comparisons, ignores skipped values */ + void *free_ptr; /* will be freed if set */ + int itemsize; + + /* array length with no skip functions applied, take care not to compare against index from animsys + * or python indices */ + int length; + + /* optional skip function, when set the array as viewed by rna can contain only a subset of the members. + * this changes indices so quick array index lookups are not possible when skip function is used. */ + IteratorSkipFunc skip; +} ArrayIterator; + typedef struct CollectionPropertyIterator { /* internal */ PointerRNA parent; PointerRNA builtin_parent; struct PropertyRNA *prop; - void *internal; + union { + ArrayIterator array; + ListBaseIterator listbase; + } internal; int idprop; int level; |