Merged changes in the trunk up to revision 42116.
This commit is contained in:
@@ -120,7 +120,7 @@ static PyObject *Quaternion_to_euler(QuaternionObject *self, PyObject *args)
|
||||
else quat_to_eulO(eul, order, tquat);
|
||||
}
|
||||
|
||||
return newEulerObject(eul, order, Py_NEW, NULL);
|
||||
return Euler_CreatePyObject(eul, order, Py_NEW, NULL);
|
||||
}
|
||||
//----------------------------Quaternion.toMatrix()------------------
|
||||
PyDoc_STRVAR(Quaternion_to_matrix_doc,
|
||||
@@ -139,7 +139,7 @@ static PyObject *Quaternion_to_matrix(QuaternionObject *self)
|
||||
return NULL;
|
||||
|
||||
quat_to_mat3((float (*)[3])mat, self->quat);
|
||||
return newMatrixObject(mat, 3, 3, Py_NEW, NULL);
|
||||
return Matrix_CreatePyObject(mat, 3, 3, Py_NEW, NULL);
|
||||
}
|
||||
|
||||
//----------------------------Quaternion.toMatrix()------------------
|
||||
@@ -169,7 +169,7 @@ static PyObject *Quaternion_to_axis_angle(QuaternionObject *self)
|
||||
quat__axis_angle_sanitize(axis, &angle);
|
||||
|
||||
ret= PyTuple_New(2);
|
||||
PyTuple_SET_ITEM(ret, 0, newVectorObject(axis, 3, Py_NEW, NULL));
|
||||
PyTuple_SET_ITEM(ret, 0, Vector_CreatePyObject(axis, 3, Py_NEW, NULL));
|
||||
PyTuple_SET_ITEM(ret, 1, PyFloat_FromDouble(angle));
|
||||
return ret;
|
||||
}
|
||||
@@ -197,7 +197,7 @@ static PyObject *Quaternion_cross(QuaternionObject *self, PyObject *value)
|
||||
return NULL;
|
||||
|
||||
mul_qt_qtqt(quat, self->quat, tquat);
|
||||
return newQuaternionObject(quat, Py_NEW, Py_TYPE(self));
|
||||
return Quaternion_CreatePyObject(quat, Py_NEW, Py_TYPE(self));
|
||||
}
|
||||
|
||||
//----------------------------Quaternion.dot(other)------------------
|
||||
@@ -246,7 +246,7 @@ static PyObject *Quaternion_rotation_difference(QuaternionObject *self, PyObject
|
||||
|
||||
rotation_between_quats_to_quat(quat, self->quat, tquat);
|
||||
|
||||
return newQuaternionObject(quat, Py_NEW, Py_TYPE(self));
|
||||
return Quaternion_CreatePyObject(quat, Py_NEW, Py_TYPE(self));
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(Quaternion_slerp_doc,
|
||||
@@ -288,7 +288,7 @@ static PyObject *Quaternion_slerp(QuaternionObject *self, PyObject *args)
|
||||
|
||||
interp_qt_qtqt(quat, self->quat, tquat, fac);
|
||||
|
||||
return newQuaternionObject(quat, Py_NEW, Py_TYPE(self));
|
||||
return Quaternion_CreatePyObject(quat, Py_NEW, Py_TYPE(self));
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(Quaternion_rotate_doc,
|
||||
@@ -312,7 +312,7 @@ static PyObject *Quaternion_rotate(QuaternionObject *self, PyObject *value)
|
||||
|
||||
length= normalize_qt_qt(tquat, self->quat);
|
||||
quat_to_mat3(self_rmat, tquat);
|
||||
mul_m3_m3m3(rmat, self_rmat, other_rmat);
|
||||
mul_m3_m3m3(rmat, other_rmat, self_rmat);
|
||||
|
||||
mat3_to_quat(self->quat, rmat);
|
||||
mul_qt_fl(self->quat, length); /* maintain length after rotating */
|
||||
@@ -464,7 +464,7 @@ static PyObject *Quaternion_copy(QuaternionObject *self)
|
||||
if (BaseMath_ReadCallback(self) == -1)
|
||||
return NULL;
|
||||
|
||||
return newQuaternionObject(self->quat, Py_NEW, Py_TYPE(self));
|
||||
return Quaternion_CreatePyObject(self->quat, Py_NEW, Py_TYPE(self));
|
||||
}
|
||||
|
||||
//----------------------------print object (internal)--------------
|
||||
@@ -721,7 +721,7 @@ static PyObject *Quaternion_add(PyObject *q1, PyObject *q2)
|
||||
return NULL;
|
||||
|
||||
add_qt_qtqt(quat, quat1->quat, quat2->quat, 1.0f);
|
||||
return newQuaternionObject(quat, Py_NEW, Py_TYPE(q1));
|
||||
return Quaternion_CreatePyObject(quat, Py_NEW, Py_TYPE(q1));
|
||||
}
|
||||
//------------------------obj - obj------------------------------
|
||||
//subtraction
|
||||
@@ -749,7 +749,7 @@ static PyObject *Quaternion_sub(PyObject *q1, PyObject *q2)
|
||||
quat[x] = quat1->quat[x] - quat2->quat[x];
|
||||
}
|
||||
|
||||
return newQuaternionObject(quat, Py_NEW, Py_TYPE(q1));
|
||||
return Quaternion_CreatePyObject(quat, Py_NEW, Py_TYPE(q1));
|
||||
}
|
||||
|
||||
static PyObject *quat_mul_float(QuaternionObject *quat, const float scalar)
|
||||
@@ -757,7 +757,7 @@ static PyObject *quat_mul_float(QuaternionObject *quat, const float scalar)
|
||||
float tquat[4];
|
||||
copy_qt_qt(tquat, quat->quat);
|
||||
mul_qt_fl(tquat, scalar);
|
||||
return newQuaternionObject(tquat, Py_NEW, Py_TYPE(quat));
|
||||
return Quaternion_CreatePyObject(tquat, Py_NEW, Py_TYPE(quat));
|
||||
}
|
||||
|
||||
//------------------------obj * obj------------------------------
|
||||
@@ -780,7 +780,7 @@ static PyObject *Quaternion_mul(PyObject *q1, PyObject *q2)
|
||||
|
||||
if (quat1 && quat2) { /* QUAT*QUAT (cross product) */
|
||||
mul_qt_qtqt(quat, quat1->quat, quat2->quat);
|
||||
return newQuaternionObject(quat, Py_NEW, Py_TYPE(q1));
|
||||
return Quaternion_CreatePyObject(quat, Py_NEW, Py_TYPE(q1));
|
||||
}
|
||||
/* the only case this can happen (for a supported type is "FLOAT*QUAT") */
|
||||
else if (quat2) { /* FLOAT*QUAT */
|
||||
@@ -808,7 +808,7 @@ static PyObject *Quaternion_mul(PyObject *q1, PyObject *q2)
|
||||
copy_v3_v3(tvec, vec2->vec);
|
||||
mul_qt_v3(quat1->quat, tvec);
|
||||
|
||||
return newVectorObject(tvec, 3, Py_NEW, Py_TYPE(vec2));
|
||||
return Vector_CreatePyObject(tvec, 3, Py_NEW, Py_TYPE(vec2));
|
||||
}
|
||||
/* QUAT * FLOAT */
|
||||
else if ((((scalar= PyFloat_AsDouble(q2)) == -1.0f && PyErr_Occurred())==0)) {
|
||||
@@ -836,7 +836,7 @@ static PyObject *Quaternion_neg(QuaternionObject *self)
|
||||
return NULL;
|
||||
|
||||
negate_v4_v4(tquat, self->quat);
|
||||
return newQuaternionObject(tquat, Py_NEW, Py_TYPE(self));
|
||||
return Quaternion_CreatePyObject(tquat, Py_NEW, Py_TYPE(self));
|
||||
}
|
||||
|
||||
|
||||
@@ -982,7 +982,7 @@ static PyObject *Quaternion_getAxisVec(QuaternionObject *self, void *UNUSED(clos
|
||||
|
||||
quat__axis_angle_sanitize(axis, NULL);
|
||||
|
||||
return (PyObject *) newVectorObject(axis, 3, Py_NEW, NULL);
|
||||
return (PyObject *) Vector_CreatePyObject(axis, 3, Py_NEW, NULL);
|
||||
}
|
||||
|
||||
static int Quaternion_setAxisVec(QuaternionObject *self, PyObject *value, void *UNUSED(closure))
|
||||
@@ -1045,7 +1045,7 @@ static PyObject *Quaternion_new(PyTypeObject *type, PyObject *args, PyObject *kw
|
||||
break;
|
||||
/* PyArg_ParseTuple assures no more then 2 */
|
||||
}
|
||||
return newQuaternionObject(quat, Py_NEW, type);
|
||||
return Quaternion_CreatePyObject(quat, Py_NEW, type);
|
||||
}
|
||||
|
||||
static PyObject *quat__apply_to_copy(PyNoArgsFunction quat_func, QuaternionObject *self)
|
||||
@@ -1190,13 +1190,13 @@ PyTypeObject quaternion_Type = {
|
||||
NULL, //tp_weaklist
|
||||
NULL, //tp_del
|
||||
};
|
||||
//------------------------newQuaternionObject (internal)-------------
|
||||
//------------------------Quaternion_CreatePyObject (internal)-------------
|
||||
//creates a new quaternion object
|
||||
/*pass Py_WRAP - if vector is a WRAPPER for data allocated by BLENDER
|
||||
(i.e. it was allocated elsewhere by MEM_mallocN())
|
||||
pass Py_NEW - if vector is not a WRAPPER and managed by PYTHON
|
||||
(i.e. it must be created here with PyMEM_malloc())*/
|
||||
PyObject *newQuaternionObject(float *quat, int type, PyTypeObject *base_type)
|
||||
PyObject *Quaternion_CreatePyObject(float *quat, int type, PyTypeObject *base_type)
|
||||
{
|
||||
QuaternionObject *self;
|
||||
|
||||
@@ -1229,9 +1229,9 @@ PyObject *newQuaternionObject(float *quat, int type, PyTypeObject *base_type)
|
||||
return (PyObject *) self;
|
||||
}
|
||||
|
||||
PyObject *newQuaternionObject_cb(PyObject *cb_user, int cb_type, int cb_subtype)
|
||||
PyObject *Quaternion_CreatePyObject_cb(PyObject *cb_user, int cb_type, int cb_subtype)
|
||||
{
|
||||
QuaternionObject *self= (QuaternionObject *)newQuaternionObject(NULL, Py_NEW, NULL);
|
||||
QuaternionObject *self= (QuaternionObject *)Quaternion_CreatePyObject(NULL, Py_NEW, NULL);
|
||||
if (self) {
|
||||
Py_INCREF(cb_user);
|
||||
self->cb_user= cb_user;
|
||||
|
||||
Reference in New Issue
Block a user