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.
This commit is contained in:
@@ -480,7 +480,7 @@ static int Quaternion_ass_item(QuaternionObject * self, int i, PyObject * ob)
|
||||
//sequence slice (get)
|
||||
static PyObject *Quaternion_slice(QuaternionObject * self, int begin, int end)
|
||||
{
|
||||
PyObject *list = NULL;
|
||||
PyObject *tuple;
|
||||
int count;
|
||||
|
||||
if(!BaseMath_ReadCallback(self))
|
||||
@@ -489,14 +489,14 @@ static PyObject *Quaternion_slice(QuaternionObject * self, int begin, int end)
|
||||
CLAMP(begin, 0, QUAT_SIZE);
|
||||
if (end<0) end= (QUAT_SIZE + 1) + end;
|
||||
CLAMP(end, 0, QUAT_SIZE);
|
||||
begin = MIN2(begin,end);
|
||||
begin= MIN2(begin, end);
|
||||
|
||||
list = PyList_New(end - begin);
|
||||
for(count = begin; count < end; count++) {
|
||||
PyList_SET_ITEM(list, count - begin, PyFloat_FromDouble(self->quat[count]));
|
||||
tuple= PyTuple_New(end - begin);
|
||||
for(count= begin; count < end; count++) {
|
||||
PyTuple_SET_ITEM(tuple, count - begin, PyFloat_FromDouble(self->quat[count]));
|
||||
}
|
||||
|
||||
return list;
|
||||
return tuple;
|
||||
}
|
||||
//----------------------------object[z:y]------------------------
|
||||
//sequence slice (set)
|
||||
|
||||
Reference in New Issue
Block a user