diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-05-11 02:05:47 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-05-11 02:05:47 +0400 |
commit | 3e1e76a2c1f711b4888cb6e82892f6c765b21fef (patch) | |
tree | 648b9023659155728c7efd6706c5d34cece44746 /source/blender/makesrna/intern/rna_access.c | |
parent | 8e13bb3f602eac73296e98fe149d8bd18165a244 (diff) |
Fix #35289: UV layout export to image was extremely slow for large meshes. This
was due to slow implementation of slice operation for things like mesh uv data.
Made that faster now for cases where the internal storage is an array.
Diffstat (limited to 'source/blender/makesrna/intern/rna_access.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_access.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index a7e81416b80..ac2c994a4f8 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -2820,6 +2820,29 @@ void RNA_property_collection_next(CollectionPropertyIterator *iter) cprop->next(iter); } +void RNA_property_collection_skip(CollectionPropertyIterator *iter, int num) +{ + CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)rna_ensure_property(iter->prop); + int i; + + if (num > 1 && (iter->idprop || (cprop->property.flag & PROP_RAW_ARRAY))) { + /* fast skip for array */ + ArrayIterator *internal = iter->internal; + + if (!internal->skip) { + internal->ptr += internal->itemsize*(num-1); + iter->valid = (internal->ptr < internal->endptr); + if(iter->valid) + RNA_property_collection_next(iter); + return; + } + } + + /* slow iteration otherwise */ + for (i = 0; i < num && iter->valid; i++) + RNA_property_collection_next(iter); +} + void RNA_property_collection_end(CollectionPropertyIterator *iter) { CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)rna_ensure_property(iter->prop); |