diff --git a/source/blender/python/api2_2x/Curve.c b/source/blender/python/api2_2x/Curve.c index d28f95a9dc8..679648857f5 100644 --- a/source/blender/python/api2_2x/Curve.c +++ b/source/blender/python/api2_2x/Curve.c @@ -45,20 +45,20 @@ static PyObject *M_Curve_New(PyObject *self, PyObject *args) printf ("In Curve_New()\n"); if (!PyArg_ParseTuple(args, "|s", &name)) - return (EXPP_ReturnPyObjError (PyExc_AttributeError, - "expected string argument or no argument")); + return (EXPP_ReturnPyObjError (PyExc_AttributeError, + "expected string argument or no argument")); blcurve = add_curve(OB_CURVE); /* first create the Curve Data in Blender */ if (blcurve == NULL) - return (EXPP_ReturnPyObjError (PyExc_RuntimeError, - "couldn't create Curve Data in Blender")); + return (EXPP_ReturnPyObjError (PyExc_RuntimeError, + "couldn't create Curve Data in Blender")); pycurve = (C_Curve *)PyObject_NEW(C_Curve, &Curve_Type); if (pycurve == NULL) - return (EXPP_ReturnPyObjError (PyExc_MemoryError, - "couldn't create Curve Data object")); + return (EXPP_ReturnPyObjError (PyExc_MemoryError, + "couldn't create Curve Data object")); pycurve->curve = blcurve; /* link Python curve wrapper to Blender Curve */ if (name) @@ -84,7 +84,7 @@ static PyObject *M_Curve_Get(PyObject *self, PyObject *args) printf ("In Curve_Get()\n"); if (!PyArg_ParseTuple(args, "|s", &name))//expects nothing or a string return (EXPP_ReturnPyObjError (PyExc_AttributeError, - "expected string argument")); + "expected string argument")); if(name){//a name has been given /* Use the name to search for the curve requested */ wanted_curv = NULL; @@ -93,8 +93,8 @@ static PyObject *M_Curve_Get(PyObject *self, PyObject *args) while ((curv_iter) && (wanted_curv == NULL)) { if (strcmp (name, curv_iter->id.name+2) == 0) { - wanted_curv = (C_Curve *)PyObject_NEW(C_Curve, &Curve_Type); - if (wanted_curv) wanted_curv->curve = curv_iter; + wanted_curv = (C_Curve *)PyObject_NEW(C_Curve, &Curve_Type); + if (wanted_curv) wanted_curv->curve = curv_iter; } curv_iter = curv_iter->id.next; @@ -109,33 +109,27 @@ static PyObject *M_Curve_Get(PyObject *self, PyObject *args) return (PyObject*)wanted_curv; - }/*if(name)*/ - else{/*no name has been given; return a list with all curves in the scene */ - int index = 0; - PyObject *curvlist, *pyobj; + }//if(name) + else{//no name has been given; return a list of all curves by name. + PyObject *curvlist; curv_iter = G.main->curve.first; - curvlist = PyList_New (BLI_countlist (&(G.main->curve))); + curvlist = PyList_New (0); if (curvlist == NULL) return (PythonReturnErrorObject (PyExc_MemoryError, - "couldn't create PyList")); + "couldn't create PyList")); while (curv_iter) { - pyobj = CurveCreatePyObject (curv_iter); - - if (!pyobj) - return (PythonReturnErrorObject (PyExc_MemoryError, - "couldn't create PyString")); - - PyList_SET_ITEM (curvlist, index, pyobj); +C_Curve *found_cur=(C_Curve*)PyObject_NEW(C_Curve,&Curve_Type); + found_cur->curve = curv_iter; + PyList_Append (curvlist, (PyObject *)found_cur); curv_iter = curv_iter->id.next; - index++; } return (curvlist); - }/*else*/ + }//else } /*****************************************************************************/ @@ -168,7 +162,7 @@ static PyObject *Curve_getName(C_Curve *self) if (attr) return attr; return (EXPP_ReturnPyObjError (PyExc_RuntimeError, - "couldn't get Curve.name attribute")); + "couldn't get Curve.name attribute")); } static PyObject *Curve_setName(C_Curve *self, PyObject *args) @@ -178,7 +172,7 @@ static PyObject *Curve_setName(C_Curve *self, PyObject *args) if (!PyArg_ParseTuple(args, "s", &(name))) return (EXPP_ReturnPyObjError (PyExc_AttributeError, - "expected string argument")); + "expected string argument")); PyOS_snprintf(buf, sizeof(buf), "%s", name); rename_id(&self->curve->id, buf); /* proper way in Blender */ @@ -193,7 +187,7 @@ static PyObject *Curve_getPathLen(C_Curve *self) if (attr) return attr; return (EXPP_ReturnPyObjError (PyExc_RuntimeError, - "couldn't get Curve.pathlen attribute")); + "couldn't get Curve.pathlen attribute")); } @@ -201,8 +195,8 @@ static PyObject *Curve_setPathLen(C_Curve *self, PyObject *args) { if (!PyArg_ParseTuple(args, "i", &(self->curve->pathlen))) - return (EXPP_ReturnPyObjError (PyExc_AttributeError, - "expected int argument")); + return (EXPP_ReturnPyObjError (PyExc_AttributeError, + "expected int argument")); Py_INCREF(Py_None); return Py_None; @@ -216,7 +210,7 @@ static PyObject *Curve_getTotcol(C_Curve *self) if (attr) return attr; return (EXPP_ReturnPyObjError (PyExc_RuntimeError, - "couldn't get Curve.totcol attribute")); + "couldn't get Curve.totcol attribute")); } @@ -224,8 +218,8 @@ static PyObject *Curve_setTotcol(C_Curve *self, PyObject *args) { if (!PyArg_ParseTuple(args, "i", &(self->curve->totcol))) - return (EXPP_ReturnPyObjError (PyExc_AttributeError, - "expected int argument")); + return (EXPP_ReturnPyObjError (PyExc_AttributeError, + "expected int argument")); Py_INCREF(Py_None); return Py_None; @@ -239,7 +233,7 @@ static PyObject *Curve_getMode(C_Curve *self) if (attr) return attr; return (EXPP_ReturnPyObjError (PyExc_RuntimeError, - "couldn't get Curve.flag attribute")); + "couldn't get Curve.flag attribute")); } @@ -247,8 +241,8 @@ static PyObject *Curve_setMode(C_Curve *self, PyObject *args) { if (!PyArg_ParseTuple(args, "i", &(self->curve->flag))) - return (EXPP_ReturnPyObjError (PyExc_AttributeError, - "expected int argument")); + return (EXPP_ReturnPyObjError (PyExc_AttributeError, + "expected int argument")); Py_INCREF(Py_None); return Py_None; @@ -262,7 +256,7 @@ static PyObject *Curve_getBevresol(C_Curve *self) if (attr) return attr; return (EXPP_ReturnPyObjError (PyExc_RuntimeError, - "couldn't get Curve.bevresol attribute")); + "couldn't get Curve.bevresol attribute")); } @@ -270,8 +264,8 @@ static PyObject *Curve_setBevresol(C_Curve *self, PyObject *args) { if (!PyArg_ParseTuple(args, "i", &(self->curve->bevresol))) - return (EXPP_ReturnPyObjError (PyExc_AttributeError, - "expected int argument")); + return (EXPP_ReturnPyObjError (PyExc_AttributeError, + "expected int argument")); Py_INCREF(Py_None); return Py_None; @@ -285,7 +279,7 @@ static PyObject *Curve_getResolu(C_Curve *self) if (attr) return attr; return (EXPP_ReturnPyObjError (PyExc_RuntimeError, - "couldn't get Curve.resolu attribute")); + "couldn't get Curve.resolu attribute")); } @@ -293,8 +287,8 @@ static PyObject *Curve_setResolu(C_Curve *self, PyObject *args) { if (!PyArg_ParseTuple(args, "i", &(self->curve->resolu))) - return (EXPP_ReturnPyObjError (PyExc_AttributeError, - "expected int argument")); + return (EXPP_ReturnPyObjError (PyExc_AttributeError, + "expected int argument")); Py_INCREF(Py_None); return Py_None; @@ -309,7 +303,7 @@ static PyObject *Curve_getResolv(C_Curve *self) if (attr) return attr; return (EXPP_ReturnPyObjError (PyExc_RuntimeError, - "couldn't get Curve.resolv attribute")); + "couldn't get Curve.resolv attribute")); } @@ -317,8 +311,8 @@ static PyObject *Curve_setResolv(C_Curve *self, PyObject *args) { if (!PyArg_ParseTuple(args, "i", &(self->curve->resolv))) - return (EXPP_ReturnPyObjError (PyExc_AttributeError, - "expected int argument")); + return (EXPP_ReturnPyObjError (PyExc_AttributeError, + "expected int argument")); Py_INCREF(Py_None); return Py_None; @@ -333,7 +327,7 @@ static PyObject *Curve_getWidth(C_Curve *self) if (attr) return attr; return (EXPP_ReturnPyObjError (PyExc_RuntimeError, - "couldn't get Curve.width attribute")); + "couldn't get Curve.width attribute")); } @@ -341,8 +335,8 @@ static PyObject *Curve_setWidth(C_Curve *self, PyObject *args) { if (!PyArg_ParseTuple(args, "f", &(self->curve->width))) - return (EXPP_ReturnPyObjError (PyExc_AttributeError, - "expected float argument")); + return (EXPP_ReturnPyObjError (PyExc_AttributeError, + "expected float argument")); Py_INCREF(Py_None); return Py_None; @@ -356,7 +350,7 @@ static PyObject *Curve_getExt1(C_Curve *self) if (attr) return attr; return (EXPP_ReturnPyObjError (PyExc_RuntimeError, - "couldn't get Curve.ext1 attribute")); + "couldn't get Curve.ext1 attribute")); } @@ -364,8 +358,8 @@ static PyObject *Curve_setExt1(C_Curve *self, PyObject *args) { if (!PyArg_ParseTuple(args, "f", &(self->curve->ext1))) - return (EXPP_ReturnPyObjError (PyExc_AttributeError, - "expected float argument")); + return (EXPP_ReturnPyObjError (PyExc_AttributeError, + "expected float argument")); Py_INCREF(Py_None); return Py_None; @@ -380,7 +374,7 @@ static PyObject *Curve_getExt2(C_Curve *self) if (attr) return attr; return (EXPP_ReturnPyObjError (PyExc_RuntimeError, - "couldn't get Curve.ext2 attribute")); + "couldn't get Curve.ext2 attribute")); } @@ -388,8 +382,8 @@ static PyObject *Curve_setExt2(C_Curve *self, PyObject *args) { if (!PyArg_ParseTuple(args, "f", &(self->curve->ext2))) - return (EXPP_ReturnPyObjError (PyExc_AttributeError, - "expected float argument")); + return (EXPP_ReturnPyObjError (PyExc_AttributeError, + "expected float argument")); Py_INCREF(Py_None); return Py_None; @@ -408,13 +402,13 @@ static PyObject *Curve_setControlPoint(C_Curve *self, PyObject *args) if (ptrnurb->bp) if (!PyArg_ParseTuple(args, "iiffff", &numcourbe,&numpoint,&x,&y,&z,&w)) return (EXPP_ReturnPyObjError (PyExc_AttributeError, - "expected int int float float float float arguments")); + "expected int int float float float float arguments")); if (ptrnurb->bezt) if (!PyArg_ParseTuple(args, "iifffffffff", &numcourbe,&numpoint, - bez,bez+1,bez+2,bez+3,bez+4,bez+5,bez+6,bez+7,bez+8)) + bez,bez+1,bez+2,bez+3,bez+4,bez+5,bez+6,bez+7,bez+8)) return (EXPP_ReturnPyObjError (PyExc_AttributeError, - "expected int int float float float float float float " - "float float float arguments")); + "expected int int float float float float float float " + "float float float arguments")); for(i = 0;i< numcourbe;i++) ptrnurb=ptrnurb->next; @@ -428,10 +422,10 @@ static PyObject *Curve_setControlPoint(C_Curve *self, PyObject *args) if (ptrnurb->bezt) { for(i = 0;i<3;i++) - for(j = 0;j<3;j++) - ptrnurb->bezt[numpoint].vec[i][j] = bez[i*3+j]; + for(j = 0;j<3;j++) + ptrnurb->bezt[numpoint].vec[i][j] = bez[i*3+j]; } - + Py_INCREF(Py_None); return Py_None; } @@ -445,7 +439,7 @@ static PyObject *Curve_getControlPoint(C_Curve *self, PyObject *args) if (!PyArg_ParseTuple(args, "ii", &numcourbe,&numpoint)) return (EXPP_ReturnPyObjError (PyExc_AttributeError, - "expected int int arguments")); + "expected int int arguments")); //check args ??? if (!self->curve->nurb.first)return liste; ptrnurb = self->curve->nurb.first; @@ -455,16 +449,16 @@ static PyObject *Curve_getControlPoint(C_Curve *self, PyObject *args) if (ptrnurb->bp) { for(i = 0;i< 4;i++) - PyList_Append(liste, PyFloat_FromDouble( ptrnurb->bp[numpoint].vec[i])); + PyList_Append(liste, PyFloat_FromDouble( ptrnurb->bp[numpoint].vec[i])); } if (ptrnurb->bezt) { liste = PyList_New(9); for(i = 0;i< 3;i++) - for(j = 0;j< 3;j++) - PyList_Append(liste, - PyFloat_FromDouble( ptrnurb->bezt[numpoint].vec[i][j])); + for(j = 0;j< 3;j++) + PyList_Append(liste, + PyFloat_FromDouble( ptrnurb->bezt[numpoint].vec[i][j])); } return liste; @@ -487,7 +481,7 @@ static PyObject *Curve_setLoc(C_Curve *self, PyObject *args) if (!PyArg_ParseTuple(args, "fff",&x,&y,&z)) return (EXPP_ReturnPyObjError (PyExc_AttributeError, - "expected float float float arguments")); + "expected float float float arguments")); self->curve->loc[0] = x; self->curve->loc[1] = y; @@ -513,7 +507,7 @@ static PyObject *Curve_setRot(C_Curve *self, PyObject *args) if (!PyArg_ParseTuple(args, "fff",&x,&y,&z)) return (EXPP_ReturnPyObjError (PyExc_AttributeError, - "expected float float float arguments")); + "expected float float float arguments")); self->curve->rot[0] = x; self->curve->rot[1] = y; @@ -538,7 +532,7 @@ static PyObject *Curve_setSize(C_Curve *self, PyObject *args) if (!PyArg_ParseTuple(args, "fff",&x,&y,&z)) return (EXPP_ReturnPyObjError (PyExc_AttributeError, - "expected float float float arguments")); + "expected float float float arguments")); self->curve->size[0] = x; self->curve->size[1] = y; @@ -598,7 +592,7 @@ static PyObject *CurveGetAttr (C_Curve *self, char *name)//getattr if (!attr) return (EXPP_ReturnPyObjError (PyExc_MemoryError, - "couldn't create PyObject")); + "couldn't create PyObject")); if (attr != Py_None) return attr; /* member attribute found, return it */ @@ -664,7 +658,7 @@ static int CurvePrint(C_Curve *self, FILE *fp, int flags) //print { fprintf(fp, "[Curve \"%s\"]\n", self->curve->id.name+2); - + return 0; } diff --git a/source/blender/python/api2_2x/Curve.h b/source/blender/python/api2_2x/Curve.h index e739aae4582..631f27d2afc 100644 --- a/source/blender/python/api2_2x/Curve.h +++ b/source/blender/python/api2_2x/Curve.h @@ -119,7 +119,6 @@ static PyObject *Curve_setSize(C_Curve *self, PyObject *args); /* Python C_Curve methods table: */ /*****************************************************************************/ static PyMethodDef C_Curve_methods[] = { - /* name, method, flags, doc */ {"getName", (PyCFunction)Curve_getName, METH_NOARGS,"() - Return Curve Data name"}, {"setName", (PyCFunction)Curve_setName, @@ -129,56 +128,56 @@ static PyMethodDef C_Curve_methods[] = { {"setPathLen", (PyCFunction)Curve_setPathLen, METH_VARARGS,"(int) - Sets Curve path length"}, {"getTotcol", (PyCFunction)Curve_getTotcol, - METH_NOARGS,"() - Return totcol"}, + METH_NOARGS,"() - Return the number of materials of the curve"}, {"setTotcol", (PyCFunction)Curve_setTotcol, - METH_VARARGS,"(int) - Sets totcol"}, + METH_VARARGS,"(int) - Sets the number of materials of the curve"}, {"getFlag", (PyCFunction)Curve_getMode, - METH_NOARGS,"() - Return flag"}, + METH_NOARGS,"() - Return flag (see the doc for semantic)"}, {"setFlag", (PyCFunction)Curve_setMode, - METH_VARARGS,"(int) - Sets flag"}, + METH_VARARGS,"(int) - Sets flag (see the doc for semantic)"}, {"getBevresol", (PyCFunction)Curve_getBevresol, - METH_NOARGS,"() - Return bevresol"}, + METH_NOARGS,"() - Return bevel resolution"}, {"setBevresol", (PyCFunction)Curve_setBevresol, - METH_VARARGS,"(int) - Sets bevresol"}, + METH_VARARGS,"(int) - Sets bevel resolution"}, {"getResolu", (PyCFunction)Curve_getResolu, - METH_NOARGS,"() - Return resolu"}, + METH_NOARGS,"() - Return U resolution"}, {"setResolu", (PyCFunction)Curve_setResolu, - METH_VARARGS,"(int) - Sets resolu"}, + METH_VARARGS,"(int) - Sets U resolution"}, {"getResolv", (PyCFunction)Curve_getResolv, - METH_NOARGS,"() - Return resolv"}, + METH_NOARGS,"() - Return V resolution"}, {"setResolv", (PyCFunction)Curve_setResolv, - METH_VARARGS,"(int) - Sets resolv"}, + METH_VARARGS,"(int) - Sets V resolution"}, {"getWidth", (PyCFunction)Curve_getWidth, - METH_NOARGS,"() - Return width"}, + METH_NOARGS,"() - Return curve width"}, {"setWidth", (PyCFunction)Curve_setWidth, - METH_VARARGS,"(int) - Sets width"}, + METH_VARARGS,"(int) - Sets curve width"}, {"getExt1", (PyCFunction)Curve_getExt1, - METH_NOARGS,"() - Return ext1"}, + METH_NOARGS,"() - Returns extent 1 of the bevel"}, {"setExt1", (PyCFunction)Curve_setExt1, - METH_VARARGS,"(int) - Sets ext1"}, + METH_VARARGS,"(int) - Sets extent 1 of the bevel"}, {"getExt2", (PyCFunction)Curve_getExt2, - METH_NOARGS,"() - Return ext2"}, + METH_NOARGS,"() - Return extent 2 of the bevel "}, {"setExt2", (PyCFunction)Curve_setExt2, - METH_VARARGS,"(int) - Sets ext2"}, + METH_VARARGS,"(int) - Sets extent 2 of the bevel "}, {"getControlPoint", (PyCFunction)Curve_getControlPoint, - METH_VARARGS,"(int numcurve,int numpoint) - Gets a control point." - "\nDepending upon the curve type, returne a list of 4 or 9 floats"}, + METH_VARARGS,"(int numcurve,int numpoint) -\ +Gets a control point.Depending upon the curve type, returne a list of 4 or 9 floats"}, {"setControlPoint", (PyCFunction)Curve_setControlPoint, METH_VARARGS,"(int numcurve,int numpoint,float x,float y,float z,\ loat w)(nurbs) or (int numcurve,int numpoint,float x1,...,x9(bezier)\ Sets a control point "}, {"getLoc", (PyCFunction)Curve_getLoc, - METH_NOARGS,"() - Gets Location"}, + METH_NOARGS,"() - Gets Location of the curve (a 3-tuple) "}, {"setLoc", (PyCFunction)Curve_setLoc, - METH_VARARGS,"(float x,float y,float z) - Sets Location"}, + METH_VARARGS,"(3-tuple) - Sets Location "}, {"getRot", (PyCFunction)Curve_getRot, - METH_NOARGS,"() - Gets Rotation"}, + METH_NOARGS,"() - Gets curve rotation"}, {"setRot", (PyCFunction)Curve_setRot, - METH_VARARGS,"(float x,float y,float z) - Sets Rotation"}, + METH_VARARGS,"(3-tuple) - Sets curve rotation"}, {"getSize", (PyCFunction)Curve_getSize, - METH_NOARGS,"() - Gets Size"}, + METH_NOARGS,"() - Gets curve size"}, {"setSize", (PyCFunction)Curve_setSize, - METH_VARARGS,"(float x,float y,float z) - Sets Size"}, + METH_VARARGS,"(3-tuple) - Sets curve size"}, {0} }; @@ -198,7 +197,7 @@ struct Curve* CurveFromPyObject (PyObject *py_obj); /*****************************************************************************/ /* Python Curve_Type structure definition: */ /*****************************************************************************/ -PyTypeObject Curve_Type = +static PyTypeObject Curve_Type = { PyObject_HEAD_INIT(NULL) 0, /* ob_size */ diff --git a/source/blender/python/api2_2x/Metaball.c b/source/blender/python/api2_2x/Metaball.c index 9d4ff483e4f..c86a39d929e 100644 --- a/source/blender/python/api2_2x/Metaball.c +++ b/source/blender/python/api2_2x/Metaball.c @@ -31,10 +31,6 @@ #include "Metaball.h" -#ifndef FP_INFINITE -#define FP_INFINITE 1 -#endif - /*****************************************************************************/ /* Function: M_Metaball_New */ /* Python equivalent: Blender.Metaball.New */ @@ -114,26 +110,19 @@ static PyObject *M_Metaball_Get(PyObject *self, PyObject *args) } else { /* () - return a list of all mballs in the scene */ - int index = 0; - PyObject *mballlist, *pyobj; + PyObject *mballlist; - mballlist = PyList_New (BLI_countlist (&(G.main->mball))); + mballlist = PyList_New (0); if (mballlist == NULL) return (PythonReturnErrorObject (PyExc_MemoryError, "couldn't create PyList")); while (mball_iter) { - pyobj = Metaball_CreatePyObject (mball_iter); - - if (!pyobj) - return (PythonReturnErrorObject (PyExc_MemoryError, - "couldn't create PyString")); - - PyList_SET_ITEM (mballlist, index, pyobj); - + C_Metaball *found_mball=(C_Metaball*)PyObject_NEW(C_Metaball,&Metaball_Type); + found_mball->metaball = mball_iter; + PyList_Append (mballlist, (PyObject *)found_mball); mball_iter = mball_iter->id.next; - index++; } return (mballlist); @@ -148,8 +137,7 @@ PyObject *M_Metaball_Init (void) { PyObject *submodule; - Metaball_Type.ob_type = &PyType_Type; - + Metaball_Type.ob_type = &PyType_Type; printf ("In M_Metaball_Init()\n"); submodule = Py_InitModule3("Blender.Metaball", M_Metaball_methods, M_Metaball_doc); @@ -219,18 +207,6 @@ static PyObject *Metaball_getNMetaElems(C_Metaball *self) return (PyInt_FromLong(i) ); } -static PyObject *Metaball_getNMetaElems1(C_Metaball *self) -{ - int i = 0; - MetaElem*ptr = self->metaball->disp.first; - if(!ptr) return (PyInt_FromLong(0) ); - while(ptr) - { - i++; - ptr = ptr->next; - } - return (PyInt_FromLong(i) ); -} static PyObject *Metaball_getloc(C_Metaball *self) @@ -244,18 +220,18 @@ static PyObject *Metaball_getloc(C_Metaball *self) static PyObject *Metaball_setloc(C_Metaball *self,PyObject*args) { - - float val[3]; - if (!PyArg_ParseTuple(args, "fff", val,val+1,val+2)) - return (EXPP_ReturnPyObjError(PyExc_TypeError,"expected three float args")); - - self->metaball->loc[0] = val[0]; - self->metaball->loc[1] = val[1]; - self->metaball->loc[2] = val[2]; - + PyObject *listargs=0; + int i; + if (!PyArg_ParseTuple(args, "O", &listargs)) + return (EXPP_ReturnPyObjError(PyExc_TypeError,"expected a list")); + if (!PyList_Check(listargs)) + return (EXPP_ReturnPyObjError(PyExc_TypeError,"expected a list")); + for(i=0;i<3;i++){ + PyObject * xx = PyList_GetItem(listargs,i); + self->metaball->loc[i] = PyFloat_AsDouble(xx); + } Py_INCREF(Py_None); return Py_None; - } static PyObject *Metaball_getrot(C_Metaball *self) @@ -269,18 +245,18 @@ static PyObject *Metaball_getrot(C_Metaball *self) static PyObject *Metaball_setrot(C_Metaball *self,PyObject*args) { - - float val[3]; - if (!PyArg_ParseTuple(args, "fff", val,val+1,val+2)) - return (EXPP_ReturnPyObjError (PyExc_TypeError,"expected three float args")); - - self->metaball->rot[0] = val[0]; - self->metaball->rot[1] = val[1]; - self->metaball->rot[2] = val[2]; - + PyObject *listargs=0; + int i; + if (!PyArg_ParseTuple(args, "O", &listargs)) + return (EXPP_ReturnPyObjError(PyExc_TypeError,"expected a list")); + if (!PyList_Check(listargs)) + return (EXPP_ReturnPyObjError(PyExc_TypeError,"expected a list")); + for(i=0;i<3;i++){ + PyObject * xx = PyList_GetItem(listargs,i); + self->metaball->rot[i] = PyFloat_AsDouble(xx); + } Py_INCREF(Py_None); return Py_None; - } static PyObject *Metaball_getsize(C_Metaball *self) @@ -294,19 +270,20 @@ static PyObject *Metaball_getsize(C_Metaball *self) static PyObject *Metaball_setsize(C_Metaball *self,PyObject*args) { - - float val[3]; - if (!PyArg_ParseTuple(args, "fff", val,val+1,val+2)) - return (EXPP_ReturnPyObjError (PyExc_TypeError,"expected three float args")); - - self->metaball->size[0] = val[0]; - self->metaball->size[1] = val[1]; - self->metaball->size[2] = val[2]; - + PyObject *listargs=0; + int i; + if (!PyArg_ParseTuple(args, "O", &listargs)) + return (EXPP_ReturnPyObjError(PyExc_TypeError,"expected a list")); + if (!PyList_Check(listargs)) + return (EXPP_ReturnPyObjError(PyExc_TypeError,"expected a list")); + for(i=0;i<3;i++){ + PyObject * xx = PyList_GetItem(listargs,i); + self->metaball->size[i] = PyFloat_AsDouble(xx); + } Py_INCREF(Py_None); return Py_None; - } + static PyObject *Metaball_getWiresize(C_Metaball *self) { return PyFloat_FromDouble(self->metaball->wiresize); @@ -389,14 +366,6 @@ static PyObject *Metaball_getMetadata(C_Metaball *self,PyObject*args) } if(!strcmp(name,"type")) return (PyInt_FromLong(ptr->type)); - if(!strcmp(name,"lay")) - return (PyInt_FromLong(ptr->lay)); - if(!strcmp(name,"selcol")) - return (PyInt_FromLong(ptr->selcol)); - if(!strcmp(name,"flag")) - return (PyInt_FromLong(ptr->flag)); - if(!strcmp(name,"pad")) - return (PyInt_FromLong(ptr->pad)); if(!strcmp(name,"x")) return (PyFloat_FromDouble(ptr->x)); if(!strcmp(name,"y")) @@ -417,11 +386,6 @@ static PyObject *Metaball_getMetadata(C_Metaball *self,PyObject*args) return (PyFloat_FromDouble(ptr->s)); if(!strcmp(name,"len")) return (PyFloat_FromDouble(ptr->len)); - if(!strcmp(name,"maxrad2")) - return (PyFloat_FromDouble(ptr->maxrad2)); - - - return (EXPP_ReturnPyObjError (PyExc_TypeError, "unknown name ")); } @@ -435,19 +399,12 @@ static PyObject *Metaball_setMetadata(C_Metaball *self,PyObject*args) char*name = NULL; int intval=-1; float floatval=FP_INFINITE; - int ok = 0; MetaElem *ptr; - /* XXX: This won't work. PyArg_ParseTuple will unpack 'args' in its first - * call, so it can't be called again. Better get the value as a float then - * compare it with its int part and, if equal, consider it an int. Note - * that 'ok' isn't used in this function at all, whatever it was meant for */ - if (PyArg_ParseTuple(args, "sii", &name,&num,&intval))ok=1; - if (PyArg_ParseTuple(args, "sif", &name,&num,&floatval)) ok = 2; - if (!ok) + if (!PyArg_ParseTuple(args, "sif", &name,&num,&floatval)) return (EXPP_ReturnPyObjError (PyExc_TypeError, \ - "expected string,int,int or float arguments")); - if (floatval == FP_INFINITE) floatval = (float)intval; + "expected string,int,int float arguments")); + intval = (int)floatval; /*jump to the num-th MetaElem*/ ptr = self->metaball->elems.first; if(!ptr) @@ -460,15 +417,7 @@ return (EXPP_ReturnPyObjError (PyExc_TypeError, \ } if(!strcmp(name,"type")) {ptr->type=intval;return (PyInt_FromLong(intval));} - if(!strcmp(name,"lay")) - {ptr->lay=intval;return (PyInt_FromLong(intval));} - if(!strcmp(name,"selcol")) - {ptr->selcol=intval;return (PyInt_FromLong(intval));} - if(!strcmp(name,"flag")) - {ptr->flag=intval;return (PyInt_FromLong(intval));} - if(!strcmp(name,"pad")) {ptr->pad=intval;return (PyInt_FromLong(intval));} - if(!strcmp(name,"x")) {ptr->x=floatval;return (PyFloat_FromDouble(floatval));} if(!strcmp(name,"y")) @@ -489,12 +438,8 @@ return (EXPP_ReturnPyObjError (PyExc_TypeError, \ {ptr->s=floatval;return (PyFloat_FromDouble(floatval));} if(!strcmp(name,"len")) {ptr->len=floatval;return (PyFloat_FromDouble(floatval));} - if(!strcmp(name,"maxrad2")) - {ptr->maxrad2=floatval;return (PyFloat_FromDouble(floatval));} - - - return (EXPP_ReturnPyObjError (PyExc_TypeError, "unknown name ")); + return (EXPP_ReturnPyObjError (PyExc_TypeError, "unknown field ")); } static PyObject *Metaball_getMetatype(C_Metaball *self,PyObject*args) @@ -527,121 +472,6 @@ static PyObject *Metaball_setMetatype(C_Metaball *self,PyObject*args) } -static PyObject *Metaball_getMetalay(C_Metaball *self,PyObject*args) -{ - int num; - int i = 0; - MetaElem*ptr = self->metaball->elems.first; - if (!PyArg_ParseTuple(args, "i", &num)) - return (EXPP_ReturnPyObjError (PyExc_TypeError, "expected int argument")); - if(!ptr) return (PyInt_FromLong(0)); - for(i = 0;inext;} - return (PyInt_FromLong(ptr->lay)); -} - - - -static PyObject *Metaball_setMetalay(C_Metaball *self,PyObject*args) -{ - int num,val, i = 0; - MetaElem*ptr = self->metaball->elems.first; - if (!PyArg_ParseTuple(args, "ii", &num,&val)) - return (EXPP_ReturnPyObjError(PyExc_TypeError,"expected int int arguments")); - if(!ptr) return (EXPP_ReturnPyObjError (PyExc_TypeError, "No MetaElem")); - for(i = 0;inext;} - ptr->lay = val; - - Py_INCREF(Py_None); - return Py_None; - -} - -static PyObject *Metaball_getMetaflag(C_Metaball *self,PyObject*args) -{ - int num; - int i = 0; - MetaElem*ptr = self->metaball->elems.first; - if (!PyArg_ParseTuple(args, "i", &num)) - return (EXPP_ReturnPyObjError (PyExc_TypeError, "expected int argument")); - if(!ptr) return (PyInt_FromLong(0)); - for(i = 0;inext;} - return (PyInt_FromLong(ptr->flag)); -} - - - -static PyObject *Metaball_setMetaflag(C_Metaball *self,PyObject*args) -{ - MetaElem*ptr = self->metaball->elems.first; - int num,val, i = 0; - if (!PyArg_ParseTuple(args, "ii", &num,&val)) - return (EXPP_ReturnPyObjError (PyExc_TypeError, "expected int int argnts")); - if(!ptr) return (EXPP_ReturnPyObjError (PyExc_TypeError, "No MetaElem")); - for(i = 0;inext;} - ptr->flag = val; - - Py_INCREF(Py_None); - return Py_None; - -} - -static PyObject *Metaball_getMetaselcol(C_Metaball *self,PyObject*args) -{ - MetaElem*ptr = self->metaball->elems.first; - int num; - int i = 0; - if (!PyArg_ParseTuple(args, "i", &num)) - return (EXPP_ReturnPyObjError (PyExc_TypeError, "expected int argument")); - if(!ptr) return (PyInt_FromLong(0)); - for(i = 0;inext;} - return (PyInt_FromLong(ptr->selcol)); -} - - - -static PyObject *Metaball_setMetaselcol(C_Metaball *self,PyObject*args) -{ - MetaElem*ptr = self->metaball->elems.first; - int num,val, i = 0; - if (!PyArg_ParseTuple(args, "ii", &num,&val)) - return (EXPP_ReturnPyObjError(PyExc_TypeError,"expected int int arguments")); - if(!ptr) return (EXPP_ReturnPyObjError (PyExc_TypeError, "No MetaElem")); - for(i = 0;inext;} - ptr->selcol = val; - - Py_INCREF(Py_None); - return Py_None; - -} - -static PyObject *Metaball_getMetapad(C_Metaball *self,PyObject*args) -{ - MetaElem*ptr = self->metaball->elems.first; - int num; - int i = 0; - if (!PyArg_ParseTuple(args, "i", &num)) - return (EXPP_ReturnPyObjError (PyExc_TypeError, "expected int argument")); - if(!ptr) return (PyInt_FromLong(0)); - for(i = 0;inext;} - return (PyInt_FromLong(ptr->pad)); -} - - - -static PyObject *Metaball_setMetapad(C_Metaball *self,PyObject*args) -{ - MetaElem*ptr = self->metaball->elems.first; - int num,val, i = 0; - if (!PyArg_ParseTuple(args, "ii", &num,&val)) - return (EXPP_ReturnPyObjError(PyExc_TypeError,"expected int int arguments")); - if(!ptr) return (EXPP_ReturnPyObjError (PyExc_TypeError, "No MetaElem")); - for(i = 0;inext;} - ptr->pad = val; - - Py_INCREF(Py_None); - return Py_None; - -} static PyObject *Metaball_getMetax(C_Metaball *self,PyObject*args) { @@ -731,148 +561,6 @@ static PyObject *Metaball_setMetaz(C_Metaball *self,PyObject*args) } -static PyObject *Metaball_getMetaexpx(C_Metaball *self,PyObject*args) -{ - MetaElem*ptr = self->metaball->elems.first; - int num; - int i = 0; - if (!PyArg_ParseTuple(args, "i", &num)) - return (EXPP_ReturnPyObjError (PyExc_TypeError, "expected int argument")); - if(!ptr) return (PyFloat_FromDouble(0)); - for(i = 0;inext;} - return (PyFloat_FromDouble(ptr->expx)); -} - -static PyObject *Metaball_setMetaexpx(C_Metaball *self,PyObject*args) -{ - MetaElem*ptr = self->metaball->elems.first; - int num, i = 0; - float val; - if (!PyArg_ParseTuple(args, "if", &num,&val)) - return (EXPP_ReturnPyObjError (PyExc_TypeError, "expected int float args")); - if(!ptr) return (EXPP_ReturnPyObjError (PyExc_TypeError, "No MetaElem")); - for(i = 0;inext;} - ptr->expx = val; - - Py_INCREF(Py_None); - return Py_None; - -} - -static PyObject *Metaball_getMetaexpy(C_Metaball *self,PyObject*args) -{ - MetaElem*ptr = self->metaball->elems.first; - int num; - int i = 0; - if (!PyArg_ParseTuple(args, "i", &num)) - return (EXPP_ReturnPyObjError (PyExc_TypeError, "expected int argument")); - if(!ptr) return (PyFloat_FromDouble(0)); - for(i = 0;inext;} - return (PyFloat_FromDouble(ptr->expy)); -} - -static PyObject *Metaball_setMetaexpy(C_Metaball *self,PyObject*args) -{ - MetaElem*ptr = self->metaball->elems.first; - int num, i = 0; - float val; - if (!PyArg_ParseTuple(args, "if", &num,&val)) - return (EXPP_ReturnPyObjError (PyExc_TypeError, "expected int float argts")); - if(!ptr) return (EXPP_ReturnPyObjError (PyExc_TypeError, "No MetaElem")); - for(i = 0;inext;} - ptr->expy = val; - - Py_INCREF(Py_None); - return Py_None; - -} - -static PyObject *Metaball_getMetaexpz(C_Metaball *self,PyObject*args) -{ - MetaElem*ptr = self->metaball->elems.first; - int num; - int i = 0; - if (!PyArg_ParseTuple(args, "i", &num)) - return (EXPP_ReturnPyObjError (PyExc_TypeError, "expected int argument")); - if(!ptr) return (PyFloat_FromDouble(0)); - for(i = 0;inext;} - return (PyFloat_FromDouble(ptr->expz)); -} - -static PyObject *Metaball_setMetaexpz(C_Metaball *self,PyObject*args) -{ - MetaElem*ptr = self->metaball->elems.first; - int num, i = 0; - float val; - if (!PyArg_ParseTuple(args, "if", &num,&val)) - return (EXPP_ReturnPyObjError (PyExc_TypeError, "expected int float argts")); - if(!ptr) return (EXPP_ReturnPyObjError (PyExc_TypeError, "No MetaElem")); - for(i = 0;inext;} - ptr->expz = val; - - Py_INCREF(Py_None); - return Py_None; - -} - - -static PyObject *Metaball_getMetarad(C_Metaball *self,PyObject*args) -{ - MetaElem*ptr = self->metaball->elems.first; - int num; - int i = 0; - if (!PyArg_ParseTuple(args, "i", &num)) - return (EXPP_ReturnPyObjError (PyExc_TypeError, "expected int argument")); - if(!ptr) return (PyFloat_FromDouble(0)); - for(i = 0;inext;} - return (PyFloat_FromDouble(ptr->rad)); -} - -static PyObject *Metaball_setMetarad(C_Metaball *self,PyObject*args) -{ - MetaElem*ptr = self->metaball->elems.first; - int num, i = 0; - float val; - if (!PyArg_ParseTuple(args, "if", &num,&val)) - return (EXPP_ReturnPyObjError (PyExc_TypeError, "expected int float args")); - if(!ptr) return (EXPP_ReturnPyObjError (PyExc_TypeError, "No MetaElem")); - for(i = 0;inext;} - ptr->rad = val; - - Py_INCREF(Py_None); - return Py_None; - -} - - - -static PyObject *Metaball_getMetarad2(C_Metaball *self,PyObject*args) -{ - MetaElem*ptr = self->metaball->elems.first; - int num; - int i = 0; - if (!PyArg_ParseTuple(args, "i", &num)) - return (EXPP_ReturnPyObjError (PyExc_TypeError, "expected int argument")); - if(!ptr) return (PyFloat_FromDouble(0)); - for(i = 0;inext;} - return (PyFloat_FromDouble(ptr->rad2)); -} - -static PyObject *Metaball_setMetarad2(C_Metaball *self,PyObject*args) -{ - MetaElem*ptr = self->metaball->elems.first; - int num, i = 0; - float val; - if (!PyArg_ParseTuple(args, "if", &num,&val)) - return (EXPP_ReturnPyObjError (PyExc_TypeError, "expected int float args")); - if(!ptr) return (EXPP_ReturnPyObjError (PyExc_TypeError, "No MetaElem")); - for(i = 0;inext;} - ptr->rad2 = val; - - Py_INCREF(Py_None); - return Py_None; - -} static PyObject *Metaball_getMetas(C_Metaball *self,PyObject*args) { @@ -889,12 +577,10 @@ static PyObject *Metaball_getMetas(C_Metaball *self,PyObject*args) static PyObject *Metaball_setMetas(C_Metaball *self,PyObject*args) { int num, i = 0; + MetaElem*ptr = self->metaball->elems.first; float val; - MetaElem *ptr; - if (!PyArg_ParseTuple(args, "if", &num,&val)) return (EXPP_ReturnPyObjError (PyExc_TypeError, "expected int float args")); - ptr = self->metaball->elems.first; if(!ptr) return (EXPP_ReturnPyObjError (PyExc_TypeError, "No MetaElem")); for(i = 0;inext;} ptr->s = val; @@ -906,6 +592,9 @@ static PyObject *Metaball_setMetas(C_Metaball *self,PyObject*args) + + + static PyObject *Metaball_getMetalen(C_Metaball *self,PyObject*args) { int num; @@ -940,38 +629,6 @@ static PyObject *Metaball_setMetalen(C_Metaball *self,PyObject*args) -static PyObject *Metaball_getMetamaxrad2(C_Metaball *self,PyObject*args) -{ - int num; - int i = 0; - MetaElem *ptr; - - if (!PyArg_ParseTuple(args, "i", &num)) - return (EXPP_ReturnPyObjError (PyExc_TypeError, "expected int argument")); - ptr = self->metaball->elems.first; - if(!ptr) return (PyFloat_FromDouble(0)); - for(i = 0;inext;} - return (PyFloat_FromDouble(ptr->maxrad2)); -} - -static PyObject *Metaball_setMetamaxrad2(C_Metaball *self,PyObject*args) -{ - int num, i = 0; - float val; - MetaElem *ptr; - - if (!PyArg_ParseTuple(args, "if", &num,&val)) - return (EXPP_ReturnPyObjError (PyExc_TypeError, "expected int float args")); - ptr = self->metaball->elems.first; - if(!ptr) return (EXPP_ReturnPyObjError (PyExc_TypeError, "No MetaElem")); - for(i = 0;inext;} - ptr->maxrad2 = val; - - Py_INCREF(Py_None); - return Py_None; - -} - @@ -1004,6 +661,8 @@ static PyObject *MetaballGetAttr (C_Metaball *self, char *name) if (strcmp (name, "name") == 0)return Metaball_getName (self); if (strcmp (name, "rot") == 0)return Metaball_getrot (self); +if (strcmp (name, "loc") == 0)return Metaball_getloc (self); +if (strcmp (name, "size") == 0)return Metaball_getsize (self); return Py_FindMethod(C_Metaball_methods, (PyObject *)self, name); } @@ -1031,7 +690,17 @@ static int MetaballSetAttr (C_Metaball *self, char *name, PyObject *value) Metaball_setrot (self, valtuple); return 0; } + if (strcmp (name, "loc") == 0) + { + Metaball_setloc (self, valtuple); + return 0; + } + if (strcmp (name, "size") == 0) + { + Metaball_setsize (self, valtuple); + return 0; + } return (EXPP_ReturnIntError (PyExc_KeyError,"attribute not found")); } @@ -1045,44 +714,3 @@ static PyObject *MetaballRepr (C_Metaball *self) return PyString_FromString(self->metaball->id.name+2); } -/* Three Python Metaball_Type helper functions needed by the Object module: */ - -/*****************************************************************************/ -/* Function: Metaball_CreatePyObject */ -/* Description: This function will create a new C_Metaball from an existing */ -/* Blender metaball structure. */ -/*****************************************************************************/ -PyObject *Metaball_CreatePyObject (MetaBall *metaball) -{ - C_Metaball *pymetaball; - - pymetaball = (C_Metaball *)PyObject_NEW (C_Metaball, &Metaball_Type); - - if (!pymetaball) - return EXPP_ReturnPyObjError (PyExc_MemoryError, - "couldn't create C_Metaball object"); - - pymetaball->metaball = metaball; - - return (PyObject *)pymetaball; -} - -/*****************************************************************************/ -/* Function: Metaball_CheckPyObject */ -/* Description: This function returns true when the given PyObject is of the */ -/* type Metaball. Otherwise it will return false. */ -/*****************************************************************************/ -int Metaball_CheckPyObject (PyObject *pyobj) -{ - return (pyobj->ob_type == &Metaball_Type); -} - -/*****************************************************************************/ -/* Function: Metaball_FromPyObject */ -/* Description: This function returns the Blender metaball from the given */ -/* PyObject. */ -/*****************************************************************************/ -MetaBall *Metaball_FromPyObject (PyObject *pyobj) -{ - return ((C_Metaball *)pyobj)->metaball; -} diff --git a/source/blender/python/api2_2x/Metaball.h b/source/blender/python/api2_2x/Metaball.h index c79406862bd..2da63447225 100644 --- a/source/blender/python/api2_2x/Metaball.h +++ b/source/blender/python/api2_2x/Metaball.h @@ -27,7 +27,7 @@ * Contributor(s): Jacques Guignot * * ***** END GPL/BL DUAL LICENSE BLOCK ***** -*/ + */ #ifndef EXPP_METABALL_H #define EXPP_METABALL_H @@ -103,41 +103,20 @@ static PyObject *Metaball_setRendersize(C_Metaball *self,PyObject*args); static PyObject *Metaball_getThresh(C_Metaball *self); static PyObject *Metaball_setThresh(C_Metaball *self,PyObject*args); static PyObject *Metaball_getNMetaElems(C_Metaball *self); -static PyObject *Metaball_getNMetaElems1(C_Metaball *self); static PyObject *Metaball_getMetatype(C_Metaball *self,PyObject*args); static PyObject *Metaball_setMetatype(C_Metaball *self,PyObject*args); static PyObject *Metaball_getMetadata(C_Metaball *self,PyObject*args); static PyObject *Metaball_setMetadata(C_Metaball *self,PyObject*args); -static PyObject *Metaball_getMetalay(C_Metaball *self,PyObject*args); -static PyObject *Metaball_setMetalay(C_Metaball *self,PyObject*args); -static PyObject *Metaball_getMetaflag(C_Metaball *self,PyObject*args); -static PyObject *Metaball_setMetaflag(C_Metaball *self,PyObject*args); -static PyObject *Metaball_getMetaselcol(C_Metaball *self,PyObject*args); -static PyObject *Metaball_setMetaselcol(C_Metaball *self,PyObject*args); -static PyObject *Metaball_getMetapad(C_Metaball *self,PyObject*args); -static PyObject *Metaball_setMetapad(C_Metaball *self,PyObject*args); static PyObject *Metaball_getMetax(C_Metaball *self,PyObject*args); static PyObject *Metaball_setMetax(C_Metaball *self,PyObject*args); static PyObject *Metaball_getMetay(C_Metaball *self,PyObject*args); static PyObject *Metaball_setMetay(C_Metaball *self,PyObject*args); static PyObject *Metaball_getMetaz(C_Metaball *self,PyObject*args); static PyObject *Metaball_setMetaz(C_Metaball *self,PyObject*args); -static PyObject *Metaball_getMetaexpx(C_Metaball *self,PyObject*args); -static PyObject *Metaball_setMetaexpx(C_Metaball *self,PyObject*args); -static PyObject *Metaball_getMetaexpy(C_Metaball *self,PyObject*args); -static PyObject *Metaball_setMetaexpy(C_Metaball *self,PyObject*args); -static PyObject *Metaball_getMetaexpz(C_Metaball *self,PyObject*args); -static PyObject *Metaball_setMetaexpz(C_Metaball *self,PyObject*args); -static PyObject *Metaball_getMetarad(C_Metaball *self,PyObject*args); -static PyObject *Metaball_setMetarad(C_Metaball *self,PyObject*args); -static PyObject *Metaball_getMetarad2(C_Metaball *self,PyObject*args); -static PyObject *Metaball_setMetarad2(C_Metaball *self,PyObject*args); static PyObject *Metaball_getMetas(C_Metaball *self,PyObject*args); static PyObject *Metaball_setMetas(C_Metaball *self,PyObject*args); static PyObject *Metaball_getMetalen(C_Metaball *self,PyObject*args); static PyObject *Metaball_setMetalen(C_Metaball *self,PyObject*args); -static PyObject *Metaball_getMetamaxrad2(C_Metaball *self,PyObject*args); -static PyObject *Metaball_setMetamaxrad2(C_Metaball *self,PyObject*args); static PyObject *Metaball_getloc(C_Metaball *self); static PyObject *Metaball_setloc(C_Metaball *self,PyObject*args); static PyObject *Metaball_getrot(C_Metaball *self); @@ -149,121 +128,69 @@ static PyObject *Metaball_setsize(C_Metaball *self,PyObject*args); /* Python C_Metaball methods table: */ /*****************************************************************************/ static PyMethodDef C_Metaball_methods[] = { - /* name, method, flags, doc */ + /* name, method, flags, doc */ {"getName", (PyCFunction)Metaball_getName,\ - METH_NOARGS, "() - Return Metaball Data name"}, - + METH_NOARGS, "() - Return Metaball name"}, {"setName", (PyCFunction)Metaball_setName,\ - METH_VARARGS, "() - Sets Metaball Data name"}, - + METH_VARARGS, "() - Sets Metaball name"}, {"getWiresize", (PyCFunction)Metaball_getWiresize,\ - METH_NOARGS, "() - Return Metaball Data wiresize"}, - + METH_NOARGS, "() - Return Metaball wire size"}, {"setWiresize", (PyCFunction)Metaball_setWiresize,\ - METH_VARARGS, "() - Sets Metaball Data wiresize"}, - + METH_VARARGS, "() - Sets Metaball wire size"}, {"getRendersize", (PyCFunction)Metaball_getRendersize,\ - METH_NOARGS, "() - Return Metaball Data rendersize"}, - + METH_NOARGS, "() - Return Metaball render size"}, {"setRendersize", (PyCFunction)Metaball_setRendersize,\ - METH_VARARGS, "() - Sets Metaball Data rendersize"}, - + METH_VARARGS, "() - Sets Metaball render size"}, {"getThresh", (PyCFunction)Metaball_getThresh,\ - METH_NOARGS, "() - Return Metaball Data thresh"}, - + METH_NOARGS, "() - Return Metaball threshold"}, {"setThresh", (PyCFunction)Metaball_setThresh,\ - METH_VARARGS, "() - Sets Metaball Data thresh"}, - -{"getBbox", (PyCFunction)Metaball_getBbox,\ + METH_VARARGS, "() - Sets Metaball threshold"}, + {"getBbox", (PyCFunction)Metaball_getBbox,\ METH_NOARGS, "() - Return Metaball bounding box"}, - {"getNMetaElems",(PyCFunction)Metaball_getNMetaElems,\ -METH_NOARGS, "() - "}, - - {"getNMetaElems1",(PyCFunction)Metaball_getNMetaElems1,\ -METH_NOARGS, "() - "}, + METH_NOARGS, "() Returns the number of Spheres "}, {"getMetatype", (PyCFunction)Metaball_getMetatype , \ -METH_VARARGS, "() - "}, + METH_VARARGS, "() - "}, {"setMetatype", (PyCFunction)Metaball_setMetatype , \ -METH_VARARGS, "() - "}, + METH_VARARGS, "() - "}, {"getMetadata", (PyCFunction)Metaball_getMetadata , \ -METH_VARARGS, "() - Gets Metaball MetaData "}, + METH_VARARGS, "() - Gets Metaball MetaData "}, {"setMetadata", (PyCFunction)Metaball_setMetadata , \ -METH_VARARGS, "() - "}, - {"getMetalay", (PyCFunction)Metaball_getMetalay , \ -METH_VARARGS, "() - "}, - {"setMetalay", (PyCFunction)Metaball_setMetalay , \ -METH_VARARGS, "() - "}, - {"getMetaflag", (PyCFunction)Metaball_getMetaflag , \ -METH_VARARGS, "() - "}, - {"setMetaflag", (PyCFunction)Metaball_setMetaflag , \ -METH_VARARGS, "() - "}, - {"getMetaselcol", (PyCFunction)Metaball_getMetaselcol , \ -METH_VARARGS, "() - "}, - {"setMetaselcol", (PyCFunction)Metaball_setMetaselcol , \ -METH_VARARGS, "() - "}, - {"getMetapad", (PyCFunction)Metaball_getMetapad , \ -METH_VARARGS, "() - "}, - {"setMetapad", (PyCFunction)Metaball_setMetapad , \ -METH_VARARGS, "() - "}, + METH_VARARGS, "() - "}, {"getMetax", (PyCFunction)Metaball_getMetax , \ -METH_VARARGS, "() - "}, + METH_VARARGS, "() - gets the x coordinate of the metaelement "}, {"setMetax", (PyCFunction)Metaball_setMetax , \ -METH_VARARGS, "() - "}, + METH_VARARGS, "() -sets the x coordinate of the metaelement "}, {"getMetay", (PyCFunction)Metaball_getMetay , \ -METH_VARARGS, "() - "}, + METH_VARARGS, "() - gets the y coordinate of the metaelement"}, {"setMetay", (PyCFunction)Metaball_setMetay , \ -METH_VARARGS, "() - "}, + METH_VARARGS, "() - sets the y coordinate of the metaelement"}, {"getMetaz", (PyCFunction)Metaball_getMetaz , \ -METH_VARARGS, "() - "}, + METH_VARARGS, "() - gets the z coordinate of the metaelement"}, {"setMetaz", (PyCFunction)Metaball_setMetaz , \ -METH_VARARGS, "() - "}, - {"getMetaexpx", (PyCFunction)Metaball_getMetaexpx , \ -METH_VARARGS, "() - "}, - {"setMetaexpx", (PyCFunction)Metaball_setMetaexpx , \ -METH_VARARGS, "() - "}, - {"getMetaexpy", (PyCFunction)Metaball_getMetaexpy , \ -METH_VARARGS, "() - "}, - {"setMetaexpy", (PyCFunction)Metaball_setMetaexpy , \ -METH_VARARGS, "() - "}, - {"getMetaexpz", (PyCFunction)Metaball_getMetaexpz , \ -METH_VARARGS, "() - "}, - {"setMetaexpz", (PyCFunction)Metaball_setMetaexpz , \ -METH_VARARGS, "() - "}, - {"getMetarad", (PyCFunction)Metaball_getMetarad , \ -METH_VARARGS, "() - "}, - {"setMetarad", (PyCFunction)Metaball_setMetarad , \ -METH_VARARGS, "() - "}, - {"getMetarad2", (PyCFunction)Metaball_getMetarad2 , \ -METH_VARARGS, "() - "}, - {"setMetarad2", (PyCFunction)Metaball_setMetarad2 , \ -METH_VARARGS, "() - "}, + METH_VARARGS, "() - sets the z coordinate of the metaelement"}, {"getMetas", (PyCFunction)Metaball_getMetas , \ -METH_VARARGS, "() - "}, + METH_VARARGS, "() - gets the s coordinate of the metaelement"}, {"setMetas", (PyCFunction)Metaball_setMetas , \ -METH_VARARGS, "() - "}, + METH_VARARGS, "() - sets the s coordinate of the metaelement"}, {"getMetalen", (PyCFunction)Metaball_getMetalen , \ -METH_VARARGS, "() - "}, + METH_VARARGS, "() - gets the length of the metaelement."}, {"setMetalen", (PyCFunction)Metaball_setMetalen , \ -METH_VARARGS, "() - "}, - {"getMetamaxrad2", (PyCFunction)Metaball_getMetamaxrad2 , \ -METH_VARARGS, "() - "}, - {"setMetamaxrad2", (PyCFunction)Metaball_setMetamaxrad2 , \ -METH_VARARGS, "() - "}, + METH_VARARGS, "() - sets the length of the metaelement."}, {"getloc", (PyCFunction)Metaball_getloc , \ -METH_NOARGS, "() - Gets Metaball loc values"}, + METH_NOARGS, "() - Gets Metaball loc values"}, {"setloc", (PyCFunction)Metaball_setloc , \ -METH_VARARGS, "(f f f) - Sets Metaball loc values"}, + METH_VARARGS, "(f f f) - Sets Metaball loc values"}, {"getrot", (PyCFunction)Metaball_getrot , \ -METH_NOARGS, "() - Gets Metaball rot values"}, + METH_NOARGS, "() - Gets Metaball rot values"}, {"setrot", (PyCFunction)Metaball_setrot , \ -METH_VARARGS, "(f f f) - Sets Metaball rot values"}, + METH_VARARGS, "(f f f) - Sets Metaball rot values"}, {"getsize", (PyCFunction)Metaball_getsize , \ -METH_NOARGS, "() - Gets Metaball size values"}, + METH_NOARGS, "() - Gets Metaball size values"}, {"setsize", (PyCFunction)Metaball_setsize , \ -METH_VARARGS, "(f f f) - Sets Metaball size values"}, -/*end of MetaElem data*/ - {0} + METH_VARARGS, "(f f f) - Sets Metaball size values"}, + /*end of MetaElem data*/ + {0} }; /*****************************************************************************/ @@ -278,29 +205,29 @@ static PyObject *MetaballRepr (C_Metaball *self); /*****************************************************************************/ /* Python Metaball_Type structure definition: */ /*****************************************************************************/ -PyTypeObject Metaball_Type = -{ - PyObject_HEAD_INIT(NULL) - 0, /* ob_size */ - "Metaball", /* tp_name */ - sizeof (C_Metaball), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)MetaballDeAlloc, /* tp_dealloc */ - (printfunc)MetaballPrint, /* tp_print */ - (getattrfunc)MetaballGetAttr, /* tp_getattr */ - (setattrfunc)MetaballSetAttr, /* tp_setattr */ - 0, /* tp_compare */ - (reprfunc)MetaballRepr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_as_hash */ - 0,0,0,0,0,0, - 0, /* tp_doc */ - 0,0,0,0,0,0, - C_Metaball_methods, /* tp_methods */ - 0, /* tp_members */ -}; +static PyTypeObject Metaball_Type = + { + PyObject_HEAD_INIT(NULL) + 0, /* ob_size */ + "Metaball", /* tp_name */ + sizeof (C_Metaball), /* tp_basicsize */ + 0, /* tp_itemsize */ + /* methods */ + (destructor)MetaballDeAlloc, /* tp_dealloc */ + (printfunc)MetaballPrint, /* tp_print */ + (getattrfunc)MetaballGetAttr, /* tp_getattr */ + (setattrfunc)MetaballSetAttr, /* tp_setattr */ + 0, /* tp_compare */ + (reprfunc)MetaballRepr, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_as_hash */ + 0,0,0,0,0,0, + 0, /* tp_doc */ + 0,0,0,0,0,0, + C_Metaball_methods, /* tp_methods */ + 0, /* tp_members */ + }; #endif /* EXPP_METABALL_H */