[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [50249] trunk/blender/source/blender/ python/mathutils: support unary positive operators for vectors ( same as numpy), so you can do 'vector_a = +vector_b', this makes a copy.

Campbell Barton ideasman42 at gmail.com
Mon Aug 27 15:40:20 CEST 2012


Revision: 50249
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=50249
Author:   campbellbarton
Date:     2012-08-27 13:40:19 +0000 (Mon, 27 Aug 2012)
Log Message:
-----------
support unary positive operators for vectors (same as numpy), so you can do 'vector_a = +vector_b', this makes a copy.

Modified Paths:
--------------
    trunk/blender/source/blender/python/mathutils/mathutils_Color.c
    trunk/blender/source/blender/python/mathutils/mathutils_Quaternion.c
    trunk/blender/source/blender/python/mathutils/mathutils_Vector.c

Modified: trunk/blender/source/blender/python/mathutils/mathutils_Color.c
===================================================================
--- trunk/blender/source/blender/python/mathutils/mathutils_Color.c	2012-08-27 12:00:39 UTC (rev 50248)
+++ trunk/blender/source/blender/python/mathutils/mathutils_Color.c	2012-08-27 13:40:19 UTC (rev 50249)
@@ -644,8 +644,8 @@
 	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*/

Modified: trunk/blender/source/blender/python/mathutils/mathutils_Quaternion.c
===================================================================
--- trunk/blender/source/blender/python/mathutils/mathutils_Quaternion.c	2012-08-27 12:00:39 UTC (rev 50248)
+++ trunk/blender/source/blender/python/mathutils/mathutils_Quaternion.c	2012-08-27 13:40:19 UTC (rev 50249)
@@ -903,7 +903,7 @@
 	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*/

Modified: trunk/blender/source/blender/python/mathutils/mathutils_Vector.c
===================================================================
--- trunk/blender/source/blender/python/mathutils/mathutils_Vector.c	2012-08-27 12:00:39 UTC (rev 50248)
+++ trunk/blender/source/blender/python/mathutils/mathutils_Vector.c	2012-08-27 13:40:19 UTC (rev 50249)
@@ -2046,7 +2046,7 @@
 	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*/




More information about the Bf-blender-cvs mailing list