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>2011-02-08 06:37:49 +0300
committerCampbell Barton <ideasman42@gmail.com>2011-02-08 06:37:49 +0300
commit53afd198084e4bca72d6694708d801a799a2f76f (patch)
tree551887b832a1be33f0173b825685c063cfe9eeab /source/blender/python
parent0242a96f3bc0d844c6ca1c3916671b891de10d9f (diff)
fix [#25975] Quaternion/Vector.negated() isn't available
theres no need for value.negated(), better use -vec / -quat. however -quat didn't exist.
Diffstat (limited to 'source/blender/python')
-rw-r--r--source/blender/python/generic/mathutils_quat.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/source/blender/python/generic/mathutils_quat.c b/source/blender/python/generic/mathutils_quat.c
index 56757ae5d2d..b28ef866fea 100644
--- a/source/blender/python/generic/mathutils_quat.c
+++ b/source/blender/python/generic/mathutils_quat.c
@@ -744,6 +744,20 @@ static PyObject *Quaternion_mul(PyObject *q1, PyObject *q2)
return NULL;
}
+/* -obj
+ returns the negative of this object*/
+static PyObject *Quaternion_neg(QuaternionObject *self)
+{
+ float tquat[QUAT_SIZE];
+
+ if(!BaseMath_ReadCallback(self))
+ return NULL;
+
+ negate_v4_v4(tquat, self->quat);
+ return newQuaternionObject(tquat, Py_NEW, Py_TYPE(self));
+}
+
+
//-----------------PROTOCOL DECLARATIONS--------------------------
static PySequenceMethods Quaternion_SeqMethods = {
(lenfunc) Quaternion_len, /* sq_length */
@@ -771,7 +785,7 @@ static PyNumberMethods Quaternion_NumMethods = {
0, /*nb_remainder*/
0, /*nb_divmod*/
0, /*nb_power*/
- (unaryfunc) 0, /*nb_negative*/
+ (unaryfunc) Quaternion_neg, /*nb_negative*/
(unaryfunc) 0, /*tp_positive*/
(unaryfunc) 0, /*tp_absolute*/
(inquiry) 0, /*tp_bool*/