[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [11057] branches/pyapi_devel/source/ blender/python/api2_2x: Made vector reference ID and Matrix data for memory checking ( need to be add checks still)
Campbell Barton
cbarton at metavr.com
Tue Jun 26 03:04:05 CEST 2007
Revision: 11057
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=11057
Author: campbellbarton
Date: 2007-06-26 03:04:03 +0200 (Tue, 26 Jun 2007)
Log Message:
-----------
Made vector reference ID and Matrix data for memory checking (need to be add checks still)
Made mesh data - verts, edges, faces, colors etc reference the python mesh, so if its ever removed they can check and raise an error.
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/Mesh.h
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/Scene.h
branches/pyapi_devel/source/blender/python/api2_2x/Texture.c
branches/pyapi_devel/source/blender/python/api2_2x/gen_utils.h
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-25 21:51:13 UTC (rev 11056)
+++ branches/pyapi_devel/source/blender/python/api2_2x/Bone.c 2007-06-26 01:04:03 UTC (rev 11057)
@@ -174,9 +174,9 @@
static PyObject *EditBone_getHead(BPy_EditBone *self, void *closure)
{
if (self->editbone){
- return newVectorObject(self->editbone->head, 3, Py_WRAP);
+ return newVectorObject(self->editbone->head, 3, Py_WRAP, (BPy_GenericLib *)NULL);
}else{
- return newVectorObject(self->head, 3, Py_NEW);
+ return newVectorObject(self->head, 3, Py_NEW, 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);
+ return newVectorObject(self->editbone->tail, 3, Py_WRAP, (BPy_GenericLib *)NULL);
}else{
- return newVectorObject(self->tail, 3, Py_NEW);
+ return newVectorObject(self->tail, 3, Py_NEW, (BPy_GenericLib *)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);
- PyObject *val2 = newVectorObject(self->bone->arm_head, 3, Py_WRAP);
+ 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 *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);
- PyObject *val2 = newVectorObject(self->bone->arm_tail, 3, Py_WRAP);
+ 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 *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-25 21:51:13 UTC (rev 11056)
+++ branches/pyapi_devel/source/blender/python/api2_2x/Effect.c 2007-06-26 01:04:03 UTC (rev 11057)
@@ -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);
+ pyvec = newVectorObject(vec, 3, Py_NEW, (BPy_GenericLib *)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);
- pyvec2 = newVectorObject(vec1, 3, Py_NEW);
+ pyvec = newVectorObject(vec, 3, Py_NEW, (BPy_GenericLib *)NULL);
+ pyvec2 = newVectorObject(vec1, 3, Py_NEW, (BPy_GenericLib *)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);
+ pyvec = newVectorObject(vec, 3, Py_NEW, (BPy_GenericLib *)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-25 21:51:13 UTC (rev 11056)
+++ branches/pyapi_devel/source/blender/python/api2_2x/Geometry.c 2007-06-26 01:04:03 UTC (rev 11057)
@@ -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);
+ return newVectorObject(newvec, 2, Py_NEW, 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);
+ return newVectorObject(newvec, 2, Py_NEW, (BPy_GenericLib *)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);
+ return newVectorObject(newvec, 2, Py_NEW, (BPy_GenericLib *)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);
+ return newVectorObject(newvec, 2, Py_NEW, (BPy_GenericLib *)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-25 21:51:13 UTC (rev 11056)
+++ branches/pyapi_devel/source/blender/python/api2_2x/Key.c 2007-06-26 01:04:03 UTC (rev 11057)
@@ -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_WRAP ));
+ PyList_SetItem(l, i, ( PyObject * ) newVectorObject( vert->co, 3, Py_NEW, 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-25 21:51:13 UTC (rev 11056)
+++ branches/pyapi_devel/source/blender/python/api2_2x/Mathutils.c 2007-06-26 01:04:03 UTC (rev 11057)
@@ -165,7 +165,7 @@
vecNew[z++] = (float)dot;
dot = 0.0f;
}
- return newVectorObject(vecNew, vec->size, Py_NEW);
+ return newVectorObject(vecNew, vec->size, Py_NEW, (BPy_GenericLib *)NULL);
}
//This is a helper for point/matrix translation
@@ -230,7 +230,7 @@
vecNew[z++] = (float)dot;
dot = 0.0f;
}
- return newVectorObject(vecNew, vec_size, Py_NEW);
+ return newVectorObject(vecNew, vec_size, Py_NEW, (BPy_GenericLib *)NULL);
}
//This is a helper for the point class
PyObject *row_point_multiplication(PointObject* pt, MatrixObject * mat)
@@ -289,7 +289,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);
+ return newVectorObject(rot, 3, Py_NEW, (BPy_GenericLib *)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] -
@@ -304,7 +304,7 @@
quat->quat[3]*quat->quat[3]*pt->coord[2] - 2*quat->quat[0]*quat->quat[2]*pt->coord[0] -
quat->quat[2]*quat->quat[2]*pt->coord[2] + 2*quat->quat[0]*quat->quat[1]*pt->coord[1] -
quat->quat[1]*quat->quat[1]*pt->coord[2] + quat->quat[0]*quat->quat[0]*pt->coord[2];
- return newPointObject(rot, 3, Py_NEW);
+ return newPointObject(rot, 3, Py_NEW );
}
}else if(VectorObject_Check(arg1)){
vec = (VectorObject*)arg1;
@@ -322,7 +322,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);
+ return newVectorObject(rot, 3, Py_NEW, (BPy_GenericLib *)NULL);
}
}else if(PointObject_Check(arg1)){
pt = (PointObject*)arg1;
@@ -399,7 +399,7 @@
}
} else if (size == 0) {
//returns a new empty 3d vector
- return newVectorObject(NULL, 3, Py_NEW);
+ return newVectorObject(NULL, 3, Py_NEW, (BPy_GenericLib *)NULL);
} else {
listObject = EXPP_incr_ret(args);
}
@@ -430,7 +430,7 @@
EXPP_decr2(f,v);
}
Py_DECREF(listObject);
- return newVectorObject(vec, size, Py_NEW);
+ return newVectorObject(vec, size, Py_NEW, (BPy_GenericLib *)NULL);
}
//----------------------------------Mathutils.CrossVecs() ---------------
//finds perpendicular vector - only 3D is supported
@@ -446,7 +446,7 @@
return EXPP_ReturnPyObjError(PyExc_AttributeError,
"Mathutils.CrossVecs(): expects (2) 3D vector objects\n");
- vecCross = newVectorObject(NULL, 3, Py_NEW);
+ vecCross = newVectorObject(NULL, 3, Py_NEW, (BPy_GenericLib *)NULL);
Crossf(((VectorObject*)vecCross)->vec, vec1->vec, vec2->vec);
return vecCross;
}
@@ -533,7 +533,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);
+ return newVectorObject(vec, vec1->size, Py_NEW, (BPy_GenericLib *)NULL);
}
//----------------------------------Mathutils.ProjectVecs() -------------
//projects vector 1 onto vector 2
@@ -564,7 +564,7 @@
for(x = 0; x < size; x++) {
vec[x] = (float)(dot * vec2->vec[x]);
}
- return newVectorObject(vec, size, Py_NEW);
+ return newVectorObject(vec, size, Py_NEW, (BPy_GenericLib *)NULL);
}
//----------------------------------MATRIX FUNCTIONS--------------------
//----------------------------------Mathutils.Matrix() -----------------
@@ -1434,7 +1434,7 @@
VecMulf(dir, t);
VecAddf(pvec, orig, dir);
- return newVectorObject(pvec, 3, Py_NEW);
+ return newVectorObject(pvec, 3, Py_NEW, (BPy_GenericLib *)NULL);
}
//----------------------------------Mathutils.LineIntersect() -------------------
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list