support unary positive operators for vectors (same as numpy), so you can do 'vector_a...
authorCampbell Barton <ideasman42@gmail.com>
Mon, 27 Aug 2012 13:40:19 +0000 (13:40 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 27 Aug 2012 13:40:19 +0000 (13:40 +0000)
source/blender/python/mathutils/mathutils_Color.c
source/blender/python/mathutils/mathutils_Quaternion.c
source/blender/python/mathutils/mathutils_Vector.c

index 8a87938d825bbaba4f053fc2c919a101b1b0eb9a..05fc84eaa87ebb05327eba483d76ebc477a79caa 100644 (file)
@@ -644,8 +644,8 @@ static PyNumberMethods Color_NumMethods = {
        NULL,               /*nb_remainder*/
        NULL,               /*nb_divmod*/
        NULL,               /*nb_power*/
-       (unaryfunc) Color_neg, /*nb_negative*/
-       (unaryfunc) NULL,   /*tp_positive*/
+       (unaryfunc) Color_neg,   /*nb_negative*/
+       (unaryfunc) Color_copy,  /*tp_positive*/
        (unaryfunc) NULL,   /*tp_absolute*/
        (inquiry)   NULL,   /*tp_bool*/
        (unaryfunc) NULL,   /*nb_invert*/
index 40c0215ffd1af646a598b939e025bcaf98fddbc0..b595dab494df67bc5a7a59ac637e07f90c1d2efe 100644 (file)
@@ -903,7 +903,7 @@ static PyNumberMethods Quaternion_NumMethods = {
        NULL,                           /*nb_divmod*/
        NULL,                           /*nb_power*/
        (unaryfunc)     Quaternion_neg, /*nb_negative*/
-       (unaryfunc)     0,  /*tp_positive*/
+       (unaryfunc)     Quaternion_copy,/*tp_positive*/
        (unaryfunc)     0,  /*tp_absolute*/
        (inquiry)   0,      /*tp_bool*/
        (unaryfunc) 0,      /*nb_invert*/
index c7911cb1572f8cbe9209e098bb912a8288a4c699..74a4cd838d080257154e07b57dd31240f9f1347f 100644 (file)
@@ -2046,7 +2046,7 @@ static PyNumberMethods Vector_NumMethods = {
        NULL,                       /*nb_divmod*/
        NULL,                       /*nb_power*/
        (unaryfunc)     Vector_neg, /*nb_negative*/
-       (unaryfunc)     NULL,       /*tp_positive*/
+       (unaryfunc)     Vector_copy,/*tp_positive*/
        (unaryfunc)     NULL,       /*tp_absolute*/
        (inquiry)   NULL,           /*tp_bool*/
        (unaryfunc) NULL,           /*nb_invert*/