[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [35319] trunk/blender/source/blender/ python/generic: support for mathutils GC wasn' t complete since PyObject_GC_Track is supposed to be called once the fields are filled in .

Campbell Barton ideasman42 at gmail.com
Thu Mar 3 07:01:31 CET 2011


Revision: 35319
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=35319
Author:   campbellbarton
Date:     2011-03-03 06:01:31 +0000 (Thu, 03 Mar 2011)
Log Message:
-----------
support for mathutils GC wasn't complete since PyObject_GC_Track is supposed to be called once the fields are filled in.

Modified Paths:
--------------
    trunk/blender/source/blender/python/generic/mathutils_Color.c
    trunk/blender/source/blender/python/generic/mathutils_Euler.c
    trunk/blender/source/blender/python/generic/mathutils_Matrix.c
    trunk/blender/source/blender/python/generic/mathutils_Quaternion.c
    trunk/blender/source/blender/python/generic/mathutils_Vector.c

Modified: trunk/blender/source/blender/python/generic/mathutils_Color.c
===================================================================
--- trunk/blender/source/blender/python/generic/mathutils_Color.c	2011-03-03 05:42:16 UTC (rev 35318)
+++ trunk/blender/source/blender/python/generic/mathutils_Color.c	2011-03-03 06:01:31 UTC (rev 35319)
@@ -109,7 +109,7 @@
 static PyObject *Color_repr(ColorObject * self)
 {
 	PyObject *ret, *tuple;
-	
+
 	if(BaseMath_ReadCallback(self) == -1)
 		return NULL;
 
@@ -556,6 +556,7 @@
 		self->cb_user=			cb_user;
 		self->cb_type=			(unsigned char)cb_type;
 		self->cb_subtype=		(unsigned char)cb_subtype;
+		PyObject_GC_Track(self);
 	}
 
 	return (PyObject *)self;

Modified: trunk/blender/source/blender/python/generic/mathutils_Euler.c
===================================================================
--- trunk/blender/source/blender/python/generic/mathutils_Euler.c	2011-03-03 05:42:16 UTC (rev 35318)
+++ trunk/blender/source/blender/python/generic/mathutils_Euler.c	2011-03-03 06:01:31 UTC (rev 35319)
@@ -695,6 +695,7 @@
 		self->cb_user=			cb_user;
 		self->cb_type=			(unsigned char)cb_type;
 		self->cb_subtype=		(unsigned char)cb_subtype;
+		PyObject_GC_Track(self);
 	}
 
 	return (PyObject *)self;

Modified: trunk/blender/source/blender/python/generic/mathutils_Matrix.c
===================================================================
--- trunk/blender/source/blender/python/generic/mathutils_Matrix.c	2011-03-03 05:42:16 UTC (rev 35318)
+++ trunk/blender/source/blender/python/generic/mathutils_Matrix.c	2011-03-03 06:01:31 UTC (rev 35319)
@@ -1895,6 +1895,7 @@
 		self->cb_user=			cb_user;
 		self->cb_type=			(unsigned char)cb_type;
 		self->cb_subtype=		(unsigned char)cb_subtype;
+		PyObject_GC_Track(self);
 	}
 	return (PyObject *) self;
 }

Modified: trunk/blender/source/blender/python/generic/mathutils_Quaternion.c
===================================================================
--- trunk/blender/source/blender/python/generic/mathutils_Quaternion.c	2011-03-03 05:42:16 UTC (rev 35318)
+++ trunk/blender/source/blender/python/generic/mathutils_Quaternion.c	2011-03-03 06:01:31 UTC (rev 35319)
@@ -1124,6 +1124,7 @@
 		self->cb_user=			cb_user;
 		self->cb_type=			(unsigned char)cb_type;
 		self->cb_subtype=		(unsigned char)cb_subtype;
+		PyObject_GC_Track(self);
 	}
 
 	return (PyObject *)self;

Modified: trunk/blender/source/blender/python/generic/mathutils_Vector.c
===================================================================
--- trunk/blender/source/blender/python/generic/mathutils_Vector.c	2011-03-03 05:42:16 UTC (rev 35318)
+++ trunk/blender/source/blender/python/generic/mathutils_Vector.c	2011-03-03 06:01:31 UTC (rev 35319)
@@ -2001,7 +2001,7 @@
 axis_pos = {'x':0, 'y':1, 'z':2, 'w':3}
 axises = 'xyzw'
 while len(axises) >= 2:
-	
+
 	for axis_0 in axises:
 		axis_0_pos = axis_pos[axis_0]
 		for axis_1 in axises:
@@ -2015,7 +2015,7 @@
 						for axis_3 in axises:
 							axis_3_pos = axis_pos[axis_3]
 							axis_dict[axis_0+axis_1+axis_2+axis_3] = '((%s|SWIZZLE_VALID_AXIS) | ((%s|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((%s|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((%s|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  ' % (axis_0_pos, axis_1_pos, axis_2_pos, axis_3_pos)
-	
+
 	axises = axises[:-1]
 
 
@@ -2053,7 +2053,7 @@
 			vec_cpy[3] = 1.0f;
 		}
 	}
-	
+
 	if(BaseMath_ReadCallback(vec) == -1 || BaseMath_ReadCallback(mat) == -1)
 		return -1;
 
@@ -2085,7 +2085,7 @@
 {
 	if(BaseMath_ReadCallback(self) == -1)
 		return NULL;
-	
+
 	negate_vn(self->vec, self->size);
 
 	(void)BaseMath_WriteCallback(self); // already checked for error
@@ -2128,7 +2128,7 @@
 
 /* Note
  Py_TPFLAGS_CHECKTYPES allows us to avoid casting all types to Vector when coercing
- but this means for eg that 
+ but this means for eg that
  vec*mat and mat*vec both get sent to Vector_mul and it neesd to sort out the order
 */
 
@@ -2169,7 +2169,7 @@
 	NULL,                       /* PyBufferProcs *tp_as_buffer; */
 
   /*** Flags to define presence of optional/expanded features ***/
-	Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, 
+	Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC,
 	vector_doc,                       /*  char *tp_doc;  Documentation string */
   /*** Assigned meaning in release 2.0 ***/
 
@@ -2275,6 +2275,7 @@
 		self->cb_user=			cb_user;
 		self->cb_type=			(unsigned char)cb_type;
 		self->cb_subtype=		(unsigned char)cb_subtype;
+		PyObject_GC_Track(self);
 	}
 
 	return (PyObject *)self;




More information about the Bf-blender-cvs mailing list