diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-07-14 15:45:33 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-07-14 15:52:50 +0300 |
commit | fa7ace221584be4dfd8c897a1c6b74209fed4415 (patch) | |
tree | a1a19368503b8f8d77b2238d38baa8dec0b05807 /source/blender/python/mathutils/mathutils_Quaternion.c | |
parent | e3fd60b182f69ae77c043fd52bbde81a0b8c7d8e (diff) |
PyAPI: support element multiplication for vector, matrix, quaternions
This was disabled during 2.8x for smooth porting of 2.7x scripts,
Now '@' is used for matrix multiplication,
support '*' to multiple vector elements.
See T56276.
Diffstat (limited to 'source/blender/python/mathutils/mathutils_Quaternion.c')
-rw-r--r-- | source/blender/python/mathutils/mathutils_Quaternion.c | 13 |
1 files changed, 1 insertions, 12 deletions
diff --git a/source/blender/python/mathutils/mathutils_Quaternion.c b/source/blender/python/mathutils/mathutils_Quaternion.c index 7ce0ea5f249..2b7761b7678 100644 --- a/source/blender/python/mathutils/mathutils_Quaternion.c +++ b/source/blender/python/mathutils/mathutils_Quaternion.c @@ -962,11 +962,9 @@ static PyObject *Quaternion_mul(PyObject *q1, PyObject *q2) } if (quat1 && quat2) { /* QUAT * QUAT (element-wise product) */ -#ifdef USE_MATHUTILS_ELEM_MUL float quat[QUAT_SIZE]; mul_vn_vnvn(quat, quat1->quat, quat2->quat, QUAT_SIZE); return Quaternion_CreatePyObject(quat, Py_TYPE(q1)); -#endif } /* the only case this can happen (for a supported type is "FLOAT * QUAT") */ else if (quat2) { /* FLOAT * QUAT */ @@ -1007,17 +1005,8 @@ static PyObject *Quaternion_imul(PyObject *q1, PyObject *q2) } } - if (quat1 && quat2) { /* QUAT *= QUAT (inplace element-wise product) */ -#ifdef USE_MATHUTILS_ELEM_MUL + if (quat1 && quat2) { /* QUAT *= QUAT (in-place element-wise product). */ mul_vn_vn(quat1->quat, quat2->quat, QUAT_SIZE); -#else - PyErr_Format(PyExc_TypeError, - "In place element-wise multiplication: " - "not supported between '%.200s' and '%.200s' types", - Py_TYPE(q1)->tp_name, - Py_TYPE(q2)->tp_name); - return NULL; -#endif } else if (quat1 && (((scalar = PyFloat_AsDouble(q2)) == -1.0f && PyErr_Occurred()) == 0)) { /* QUAT *= FLOAT */ |