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>2010-12-24 06:51:34 +0300
committerCampbell Barton <ideasman42@gmail.com>2010-12-24 06:51:34 +0300
commit2dcfa5acf93479b10a91c86b3615b0feadb1d23f (patch)
tree0585424b585536926525395ddb2e4b1773e963b5 /source/blender/python/generic/mathutils_vector.c
parent47fc52f83920f3c4b311680bda7c28dd4794a979 (diff)
return typle for mathutils slice's.
The main advantage with this is that its close to twice as fast to do 'vertex.co[:]' then 'tuple(vertex.co)', this is common for writing a vertex array. the correct python behavior in this case is to return a copy of the original type, however euler and quats don't support different sizes so we cant do so easily.
Diffstat (limited to 'source/blender/python/generic/mathutils_vector.c')
-rw-r--r--source/blender/python/generic/mathutils_vector.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/source/blender/python/generic/mathutils_vector.c b/source/blender/python/generic/mathutils_vector.c
index f64c591faca..7bf8eebb12d 100644
--- a/source/blender/python/generic/mathutils_vector.c
+++ b/source/blender/python/generic/mathutils_vector.c
@@ -807,7 +807,7 @@ static int Vector_ass_item(VectorObject *self, int i, PyObject * ob)
sequence slice (get) */
static PyObject *Vector_slice(VectorObject *self, int begin, int end)
{
- PyObject *list = NULL;
+ PyObject *tuple;
int count;
if(!BaseMath_ReadCallback(self))
@@ -816,14 +816,14 @@ static PyObject *Vector_slice(VectorObject *self, int begin, int end)
CLAMP(begin, 0, self->size);
if (end<0) end= self->size+end+1;
CLAMP(end, 0, self->size);
- begin = MIN2(begin,end);
+ begin= MIN2(begin, end);
- list = PyList_New(end - begin);
+ tuple= PyTuple_New(end - begin);
for(count = begin; count < end; count++) {
- PyList_SET_ITEM(list, count - begin, PyFloat_FromDouble(self->vec[count]));
+ PyTuple_SET_ITEM(tuple, count - begin, PyFloat_FromDouble(self->vec[count]));
}
- return list;
+ return tuple;
}
/*----------------------------object[z:y]------------------------
sequence slice (set) */