From 3e1e76a2c1f711b4888cb6e82892f6c765b21fef Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Fri, 10 May 2013 22:05:47 +0000 Subject: 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. --- source/blender/python/intern/bpy_rna.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) (limited to 'source/blender/python/intern') diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index f1c0530fedf..a0b2cd639bb 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -2270,7 +2270,7 @@ static PyObject *pyrna_prop_collection_subscript_str_lib_pair(BPy_PropertyRNA *s static PyObject *pyrna_prop_collection_subscript_slice(BPy_PropertyRNA *self, Py_ssize_t start, Py_ssize_t stop) { CollectionPropertyIterator rna_macro_iter; - int count = 0; + int count; PyObject *list; PyObject *item; @@ -2279,20 +2279,12 @@ static PyObject *pyrna_prop_collection_subscript_slice(BPy_PropertyRNA *self, Py list = PyList_New(0); - /* first loop up-until the start */ - for (RNA_property_collection_begin(&self->ptr, self->prop, &rna_macro_iter); - rna_macro_iter.valid; - RNA_property_collection_next(&rna_macro_iter)) - { - /* PointerRNA itemptr = rna_macro_iter.ptr; */ - if (count == start) { - break; - } - count++; - } + /* skip to start */ + RNA_property_collection_begin(&self->ptr, self->prop, &rna_macro_iter); + RNA_property_collection_skip(&rna_macro_iter, start); /* add items until stop */ - for (; rna_macro_iter.valid; + for (count = start; rna_macro_iter.valid; RNA_property_collection_next(&rna_macro_iter)) { item = pyrna_struct_CreatePyObject(&rna_macro_iter.ptr); -- cgit v1.2.3