[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [11093] branches/pyapi_devel/source/ blender/python/api2_2x: Removed the wrapped member from the Vector struct.

Campbell Barton cbarton at metavr.com
Thu Jun 28 06:47:11 CEST 2007


Revision: 11093
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=11093
Author:   campbellbarton
Date:     2007-06-28 06:47:10 +0200 (Thu, 28 Jun 2007)

Log Message:
-----------
Removed the wrapped member from the Vector struct. just test if the vector references a PyObject to see if its wrapped.

PVerts wernt being delt with properly when deallocing.

Modified Paths:
--------------
    branches/pyapi_devel/source/blender/python/api2_2x/Bone.c
    branches/pyapi_devel/source/blender/python/api2_2x/Effect.c
    branches/pyapi_devel/source/blender/python/api2_2x/Geometry.c
    branches/pyapi_devel/source/blender/python/api2_2x/Key.c
    branches/pyapi_devel/source/blender/python/api2_2x/Mathutils.c
    branches/pyapi_devel/source/blender/python/api2_2x/Mesh.c
    branches/pyapi_devel/source/blender/python/api2_2x/Metaball.c
    branches/pyapi_devel/source/blender/python/api2_2x/Modifier.c
    branches/pyapi_devel/source/blender/python/api2_2x/Object.c
    branches/pyapi_devel/source/blender/python/api2_2x/Pose.c
    branches/pyapi_devel/source/blender/python/api2_2x/Scene.c
    branches/pyapi_devel/source/blender/python/api2_2x/Texture.c
    branches/pyapi_devel/source/blender/python/api2_2x/matrix.c
    branches/pyapi_devel/source/blender/python/api2_2x/point.c
    branches/pyapi_devel/source/blender/python/api2_2x/quat.c
    branches/pyapi_devel/source/blender/python/api2_2x/vector.c
    branches/pyapi_devel/source/blender/python/api2_2x/vector.h

Modified: branches/pyapi_devel/source/blender/python/api2_2x/Bone.c
===================================================================
--- branches/pyapi_devel/source/blender/python/api2_2x/Bone.c	2007-06-28 02:23:06 UTC (rev 11092)
+++ branches/pyapi_devel/source/blender/python/api2_2x/Bone.c	2007-06-28 04:47:10 UTC (rev 11093)
@@ -174,9 +174,9 @@
 static PyObject *EditBone_getHead(BPy_EditBone *self, void *closure)
 {
 	if (self->editbone){
-		return newVectorObject(self->editbone->head, 3, Py_WRAP, (BPy_GenericLib *)NULL);
+		return newVectorObject(self->editbone->head, 3, Py_None);
 	}else{
-		return newVectorObject(self->head, 3, Py_NEW, NULL);
+		return newVectorObject(self->head, 3, (PyObject *)NULL);
 	}
 }
 //------------------------EditBone.head (set)
@@ -213,9 +213,9 @@
 static PyObject *EditBone_getTail(BPy_EditBone *self, void *closure)
 {
 	if (self->editbone){
-		return newVectorObject(self->editbone->tail, 3, Py_WRAP, (BPy_GenericLib *)NULL);
+		return newVectorObject(self->editbone->tail, 3, Py_None);
 	}else{
-		return newVectorObject(self->tail, 3, Py_NEW, (BPy_GenericLib *)NULL);
+		return newVectorObject(self->tail, 3, (PyObject *)NULL);
 	}
 }
 //------------------------EditBone.tail (set)
@@ -949,8 +949,8 @@
 //------------------------Bone.head (get)
 static PyObject *Bone_getHead(BPy_Bone *self, void *closure)
 {
-	PyObject *val1 = newVectorObject(self->bone->head, 3, Py_WRAP, (BPy_GenericLib *)NULL);
-	PyObject *val2 = newVectorObject(self->bone->arm_head, 3, Py_WRAP, (BPy_GenericLib *)NULL);
+	PyObject *val1 = newVectorObject(self->bone->head, 3, Py_None);
+	PyObject *val2 = newVectorObject(self->bone->arm_head, 3, Py_None);
 	PyObject *ret =	Py_BuildValue(
 			"{s:O, s:O}", "BONESPACE", val1, "ARMATURESPACE", val2);
 	
@@ -967,8 +967,8 @@
 //------------------------Bone.tail (get)
 static PyObject *Bone_getTail(BPy_Bone *self, void *closure)
 {
-	PyObject *val1 = newVectorObject(self->bone->tail, 3, Py_WRAP, (BPy_GenericLib *)NULL);
-	PyObject *val2 = newVectorObject(self->bone->arm_tail, 3, Py_WRAP, (BPy_GenericLib *)NULL);
+	PyObject *val1 = newVectorObject(self->bone->tail, 3, Py_None);
+	PyObject *val2 = newVectorObject(self->bone->arm_tail, 3, Py_None);
 	PyObject *ret =	Py_BuildValue("{s:O, s:O}", 
 		"BONESPACE", val1, "ARMATURESPACE", val2);
 	

Modified: branches/pyapi_devel/source/blender/python/api2_2x/Effect.c
===================================================================
--- branches/pyapi_devel/source/blender/python/api2_2x/Effect.c	2007-06-28 02:23:06 UTC (rev 11092)
+++ branches/pyapi_devel/source/blender/python/api2_2x/Effect.c	2007-06-28 04:47:10 UTC (rev 11093)
@@ -1544,7 +1544,7 @@
 			for(c_time= pa->time; c_time<m_time; c_time+=paf->staticstep) {
 				where_is_particle(paf, pa, c_time, vec);
 				MTC_Mat4MulVecfl(ob->obmat, vec); /* make worldspace like the others */
-				pyvec = newVectorObject(vec, 3, Py_NEW, (BPy_GenericLib *)NULL);
+				pyvec = newVectorObject(vec, 3, (PyObject *)NULL);
 				if( PyList_Append( strand_list, pyvec) < 0 ) {
 					Py_DECREF( list );
 					Py_DECREF( strand_list );
@@ -1584,8 +1584,8 @@
 					}
 					where_is_particle(paf, pa, s_time, vec);
 					where_is_particle(paf, pa, p_time, vec1);
-					pyvec  = newVectorObject(vec, 3, Py_NEW, (BPy_GenericLib *)NULL);
-					pyvec2 = newVectorObject(vec1, 3, Py_NEW, (BPy_GenericLib *)NULL);
+					pyvec  = newVectorObject(vec, 3, (PyObject *)NULL);
+					pyvec2 = newVectorObject(vec1, 3, (PyObject *)NULL);
 					if( PyList_Append( list, Py_BuildValue("[OO]", pyvec, pyvec2)) < 0 ) {
 						Py_DECREF( list );
 						Py_XDECREF( pyvec );
@@ -1597,7 +1597,7 @@
 					Py_DECREF( pyvec2 );
 				} else { /* not a vector */
 					where_is_particle(paf, pa, c_time, vec);
-					pyvec = newVectorObject(vec, 3, Py_NEW, (BPy_GenericLib *)NULL);
+					pyvec = newVectorObject(vec, 3, (PyObject *)NULL);
 					if( PyList_Append( list, pyvec) < 0 ) {
 						Py_DECREF( list );
 						Py_XDECREF( pyvec );

Modified: branches/pyapi_devel/source/blender/python/api2_2x/Geometry.c
===================================================================
--- branches/pyapi_devel/source/blender/python/api2_2x/Geometry.c	2007-06-28 02:23:06 UTC (rev 11092)
+++ branches/pyapi_devel/source/blender/python/api2_2x/Geometry.c	2007-06-28 04:47:10 UTC (rev 11093)
@@ -228,7 +228,7 @@
 			/*X of vert, Y of hoz. no calculation needed */
 			newvec[0]= a1x;
 			newvec[1]= b1y;
-			return newVectorObject(newvec, 2, Py_NEW, NULL);
+			return newVectorObject(newvec, 2, (PyObject *)NULL);
 		}
 		
 		yi = (float)(((b1y / fabs(b1x - b2x)) * fabs(b2x - a1x)) + ((b2y / fabs(b1x - b2x)) * fabs(b1x - a1x)));
@@ -240,7 +240,7 @@
 		}
 		newvec[0]= a1x;
 		newvec[1]= yi;
-		return newVectorObject(newvec, 2, Py_NEW, (BPy_GenericLib *)NULL);
+		return newVectorObject(newvec, 2, (PyObject *)NULL);
 	} else if (fabs(a2y-a1y) < eul) {  /* hoz line1 */
 		if (fabs(b2y-b1y) < eul) { /*hoz line2*/
 			Py_RETURN_NONE; /*2 hoz lines dont intersect*/
@@ -255,7 +255,7 @@
 		}
 		newvec[0]= xi;
 		newvec[1]= a1y;
-		return newVectorObject(newvec, 2, Py_NEW, (BPy_GenericLib *)NULL);
+		return newVectorObject(newvec, 2, (PyObject *)NULL);
 	}
 	
 	b1 = (a2y-a1y)/(a2x-a1x);
@@ -272,7 +272,7 @@
 	if ((a1x-xi)*(xi-a2x) >= 0 && (b1x-xi)*(xi-b2x) >= 0 && (a1y-yi)*(yi-a2y) >= 0 && (b1y-yi)*(yi-b2y)>=0) {
 		newvec[0]= xi;
 		newvec[1]= yi;
-		return newVectorObject(newvec, 2, Py_NEW, (BPy_GenericLib *)NULL);
+		return newVectorObject(newvec, 2, (PyObject *)NULL);
 	}
 	Py_RETURN_NONE;
 }

Modified: branches/pyapi_devel/source/blender/python/api2_2x/Key.c
===================================================================
--- branches/pyapi_devel/source/blender/python/api2_2x/Key.c	2007-06-28 02:23:06 UTC (rev 11092)
+++ branches/pyapi_devel/source/blender/python/api2_2x/Key.c	2007-06-28 04:47:10 UTC (rev 11093)
@@ -514,7 +514,7 @@
 
 		for (i=0, datap = kb->keyblock->data; i<kb->keyblock->totelem; i++) {
 			MVert *vert = (MVert *) datap;
-			PyList_SetItem(l, i, ( PyObject * ) newVectorObject( vert->co, 3, Py_NEW, NULL ));
+			PyList_SetItem(l, i, ( PyObject * ) newVectorObject( vert->co, 3, (PyObject *)NULL));
 			datap += kb->key->elemsize;
 		}
 		break;

Modified: branches/pyapi_devel/source/blender/python/api2_2x/Mathutils.c
===================================================================
--- branches/pyapi_devel/source/blender/python/api2_2x/Mathutils.c	2007-06-28 02:23:06 UTC (rev 11092)
+++ branches/pyapi_devel/source/blender/python/api2_2x/Mathutils.c	2007-06-28 04:47:10 UTC (rev 11093)
@@ -151,7 +151,7 @@
 		vecNew[z++] = (float)dot;
 		dot = 0.0f;
 	}
-	return newVectorObject(vecNew, vec->size, Py_NEW, (BPy_GenericLib *)NULL);
+	return newVectorObject(vecNew, vec->size, (PyObject *)NULL);
 }
 //This is a helper for point/matrix translation 
 
@@ -216,7 +216,7 @@
 		vecNew[z++] = (float)dot;
 		dot = 0.0f;
 	}
-	return newVectorObject(vecNew, vec_size, Py_NEW, (BPy_GenericLib *)NULL);
+	return newVectorObject(vecNew, vec_size, (PyObject *)NULL);
 }
 //This is a helper for the point class
 PyObject *row_point_multiplication(PointObject* pt, MatrixObject * mat)
@@ -275,7 +275,7 @@
 				quat->quat[3]*quat->quat[3]*vec->vec[2] - 2*quat->quat[0]*quat->quat[2]*vec->vec[0] - 
 				quat->quat[2]*quat->quat[2]*vec->vec[2] + 2*quat->quat[0]*quat->quat[1]*vec->vec[1] - 
 				quat->quat[1]*quat->quat[1]*vec->vec[2] + quat->quat[0]*quat->quat[0]*vec->vec[2];
-			return newVectorObject(rot, 3, Py_NEW, (BPy_GenericLib *)NULL);
+			return newVectorObject(rot, 3, (PyObject *)NULL);
 		}else if(PointObject_Check(arg2)){
 			pt = (PointObject*)arg2;
 			rot[0] = quat->quat[0]*quat->quat[0]*pt->coord[0] + 2*quat->quat[2]*quat->quat[0]*pt->coord[2] - 
@@ -308,7 +308,7 @@
 				quat->quat[3]*quat->quat[3]*vec->vec[2] - 2*quat->quat[0]*quat->quat[2]*vec->vec[0] - 
 				quat->quat[2]*quat->quat[2]*vec->vec[2] + 2*quat->quat[0]*quat->quat[1]*vec->vec[1] - 
 				quat->quat[1]*quat->quat[1]*vec->vec[2] + quat->quat[0]*quat->quat[0]*vec->vec[2];
-			return newVectorObject(rot, 3, Py_NEW, (BPy_GenericLib *)NULL);
+			return newVectorObject(rot, 3, (PyObject *)NULL);
 		}
 	}else if(PointObject_Check(arg1)){
 		pt = (PointObject*)arg1;
@@ -385,7 +385,7 @@
 		}
 	} else if (size == 0) {
 		//returns a new empty 3d vector
-		return newVectorObject(NULL, 3, Py_NEW, (BPy_GenericLib *)NULL); 
+		return newVectorObject(NULL, 3, (PyObject *)NULL); 
 	} else {
 		listObject = EXPP_incr_ret(args);
 	}
@@ -416,7 +416,7 @@
 		EXPP_decr2(f,v);
 	}
 	Py_DECREF(listObject);
-	return newVectorObject(vec, size, Py_NEW, (BPy_GenericLib *)NULL);
+	return newVectorObject(vec, size, (PyObject *)NULL);
 }
 //----------------------------------Mathutils.CrossVecs() ---------------
 //finds perpendicular vector - only 3D is supported
@@ -432,7 +432,7 @@
 		return EXPP_ReturnPyObjError(PyExc_AttributeError, 
 			"Mathutils.CrossVecs(): expects (2) 3D vector objects\n");
 
-	vecCross = newVectorObject(NULL, 3, Py_NEW, (BPy_GenericLib *)NULL);
+	vecCross = newVectorObject(NULL, 3, (PyObject *)NULL);
 	Crossf(((VectorObject*)vecCross)->vec, vec1->vec, vec2->vec);
 	return vecCross;
 }
@@ -519,7 +519,7 @@
 	for(x = 0; x < vec1->size; x++) {
 		vec[x] = 0.5f * (vec1->vec[x] + vec2->vec[x]);
 	}
-	return newVectorObject(vec, vec1->size, Py_NEW, (BPy_GenericLib *)NULL);
+	return newVectorObject(vec, vec1->size, (PyObject *)NULL);
 }
 //----------------------------------Mathutils.ProjectVecs() -------------
 //projects vector 1 onto vector 2
@@ -550,7 +550,7 @@
 	for(x = 0; x < size; x++) {
 		vec[x] = (float)(dot * vec2->vec[x]);
 	}
-	return newVectorObject(vec, size, Py_NEW, (BPy_GenericLib *)NULL);
+	return newVectorObject(vec, size, (PyObject *)NULL);
 }
 //----------------------------------MATRIX FUNCTIONS--------------------
 //----------------------------------Mathutils.Matrix() -----------------
@@ -1420,7 +1420,7 @@
 	VecMulf(dir, t);
 	VecAddf(pvec, orig, dir);
 
-	return newVectorObject(pvec, 3, Py_NEW, (BPy_GenericLib *)NULL);
+	return newVectorObject(pvec, 3, (PyObject *)NULL);
 }
 //----------------------------------Mathutils.LineIntersect() -------------------
 /* Line-Line intersection using algorithm from mathworld.wolfram.com */
@@ -1519,8 +1519,8 @@
 		}
 
 		tuple = PyTuple_New( 2 );
-		PyTuple_SetItem( tuple, 0, newVectorObject(i1, vec1->size, Py_NEW, (BPy_GenericLib *)NULL) );

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list