From a703837179d40fc5e34ae06619d4610a09f72097 Mon Sep 17 00:00:00 2001 From: Stephen Swaney Date: Sun, 6 Jun 2004 22:42:51 +0000 Subject: [PATCH] Replace deprecated methods from old api: PythonReturnErrorObject PythonIncRef Fix some compiler warnings about missing initializers in method tables. --- source/blender/python/api2_2x/Armature.c | 4 +- source/blender/python/api2_2x/BezTriple.h | 3 +- source/blender/python/api2_2x/Blender.c | 12 +-- source/blender/python/api2_2x/Camera.c | 4 +- source/blender/python/api2_2x/Curve.c | 2 +- source/blender/python/api2_2x/Draw.c | 2 +- source/blender/python/api2_2x/Effect.c | 2 +- source/blender/python/api2_2x/Image.c | 6 +- source/blender/python/api2_2x/Ipo.c | 4 +- source/blender/python/api2_2x/Lamp.c | 4 +- source/blender/python/api2_2x/Lamp.h | 2 +- source/blender/python/api2_2x/Lattice.h | 2 +- source/blender/python/api2_2x/MTex.c | 2 +- source/blender/python/api2_2x/Material.c | 6 +- source/blender/python/api2_2x/Metaball.c | 2 +- source/blender/python/api2_2x/Metaball.h | 2 +- source/blender/python/api2_2x/NLA.c | 4 +- source/blender/python/api2_2x/NMesh.c | 6 +- source/blender/python/api2_2x/Object.c | 94 +++++++++++------------ source/blender/python/api2_2x/Particle.c | 2 +- source/blender/python/api2_2x/Scene.c | 6 +- source/blender/python/api2_2x/Text.c | 2 +- source/blender/python/api2_2x/Texture.c | 6 +- source/blender/python/api2_2x/Wave.c | 2 +- source/blender/python/api2_2x/World.c | 2 +- source/blender/python/api2_2x/World.h | 2 +- source/blender/python/api2_2x/constant.c | 8 +- source/blender/python/api2_2x/gen_utils.c | 11 +-- 28 files changed, 98 insertions(+), 106 deletions(-) diff --git a/source/blender/python/api2_2x/Armature.c b/source/blender/python/api2_2x/Armature.c index 557f30b114a..a95d56c367c 100644 --- a/source/blender/python/api2_2x/Armature.c +++ b/source/blender/python/api2_2x/Armature.c @@ -461,14 +461,14 @@ M_Armature_Get (PyObject * self, PyObject * args) armlist = PyList_New (BLI_countlist (&(G.main->armature))); if (armlist == NULL) - return (PythonReturnErrorObject (PyExc_MemoryError, + return (EXPP_ReturnPyObjError (PyExc_MemoryError, "couldn't create PyList")); while (armature_iter){ pyobj = Armature_CreatePyObject (armature_iter); if (!pyobj) - return (PythonReturnErrorObject (PyExc_MemoryError, + return (EXPP_ReturnPyObjError (PyExc_MemoryError, "couldn't create PyString")); PyList_SET_ITEM (armlist, index, pyobj); diff --git a/source/blender/python/api2_2x/BezTriple.h b/source/blender/python/api2_2x/BezTriple.h index 10bfff9b332..992c306199a 100644 --- a/source/blender/python/api2_2x/BezTriple.h +++ b/source/blender/python/api2_2x/BezTriple.h @@ -41,7 +41,8 @@ typedef struct { - PyObject_HEAD BezTriple *beztriple; + PyObject_HEAD /* required python macro */ + BezTriple *beztriple; } C_BezTriple; diff --git a/source/blender/python/api2_2x/Blender.c b/source/blender/python/api2_2x/Blender.c index 839c8010ce4..5f3a857920e 100644 --- a/source/blender/python/api2_2x/Blender.c +++ b/source/blender/python/api2_2x/Blender.c @@ -115,7 +115,7 @@ static struct PyMethodDef Blender_methods[] = { {"Load", Blender_Load, METH_VARARGS, Blender_Load_doc}, {"ReleaseGlobalDict", &Blender_ReleaseGlobalDict, METH_VARARGS, Blender_ReleaseGlobalDict_doc}, - {NULL, NULL} + {NULL, NULL, 0, NULL} }; /*****************************************************************************/ @@ -153,10 +153,10 @@ static PyObject *Blender_Set (PyObject *self, PyObject *args) } else { - return (PythonReturnErrorObject (PyExc_AttributeError, + return (EXPP_ReturnPyObjError (PyExc_AttributeError, "bad request identifier")); } - return ( PythonIncRef (Py_None) ); + return ( EXPP_incr_ret (Py_None) ); } /*****************************************************************************/ @@ -231,17 +231,17 @@ static PyObject *Blender_Get (PyObject *self, PyObject *args) requested data is unknown? else { - return (PythonReturnErrorObject (..., "message") ); + return (EXPP_ReturnPyObjError (..., "message") ); } */ } else { - return (PythonReturnErrorObject (PyExc_AttributeError, + return (EXPP_ReturnPyObjError (PyExc_AttributeError, "expected string argument")); } - return (PythonReturnErrorObject (PyExc_AttributeError, + return (EXPP_ReturnPyObjError (PyExc_AttributeError, "bad request identifier")); } diff --git a/source/blender/python/api2_2x/Camera.c b/source/blender/python/api2_2x/Camera.c index 04d96ed5fbd..efa1300359c 100644 --- a/source/blender/python/api2_2x/Camera.c +++ b/source/blender/python/api2_2x/Camera.c @@ -294,7 +294,7 @@ M_Camera_Get (PyObject * self, PyObject * args) cam_pylist = PyList_New (BLI_countlist (&(G.main->camera))); if (!cam_pylist) - return PythonReturnErrorObject (PyExc_MemoryError, + return EXPP_ReturnPyObjError (PyExc_MemoryError, "couldn't create PyList"); while (cam_iter) @@ -302,7 +302,7 @@ M_Camera_Get (PyObject * self, PyObject * args) pyobj = Camera_CreatePyObject (cam_iter); if (!pyobj) - return PythonReturnErrorObject (PyExc_MemoryError, + return EXPP_ReturnPyObjError (PyExc_MemoryError, "couldn't create Camera PyObject"); PyList_SET_ITEM (cam_pylist, index, pyobj); diff --git a/source/blender/python/api2_2x/Curve.c b/source/blender/python/api2_2x/Curve.c index c273a0302a3..d1fb62669ab 100644 --- a/source/blender/python/api2_2x/Curve.c +++ b/source/blender/python/api2_2x/Curve.c @@ -361,7 +361,7 @@ M_Curve_Get (PyObject * self, PyObject * args) curvlist = PyList_New (0); if (curvlist == NULL) - return (PythonReturnErrorObject (PyExc_MemoryError, + return (EXPP_ReturnPyObjError (PyExc_MemoryError, "couldn't create PyList")); while (curv_iter) diff --git a/source/blender/python/api2_2x/Draw.c b/source/blender/python/api2_2x/Draw.c index b99e9444bab..f22f9b7aeae 100644 --- a/source/blender/python/api2_2x/Draw.c +++ b/source/blender/python/api2_2x/Draw.c @@ -297,7 +297,7 @@ static struct PyMethodDef Draw_methods[] = { MethodDef (Redraw), MethodDef (Draw), MethodDef (Register), - {NULL, NULL} + {NULL, NULL,0,NULL} }; PyTypeObject Button_Type = { diff --git a/source/blender/python/api2_2x/Effect.c b/source/blender/python/api2_2x/Effect.c index ac6edead28a..94730b7f8c1 100644 --- a/source/blender/python/api2_2x/Effect.c +++ b/source/blender/python/api2_2x/Effect.c @@ -37,7 +37,7 @@ /* Python BPy_Effect methods table: */ /*****************************************************************************/ static PyMethodDef BPy_Effect_methods[] = { - {0} + {NULL, NULL, 0, NULL} }; /*****************************************************************************/ diff --git a/source/blender/python/api2_2x/Image.c b/source/blender/python/api2_2x/Image.c index 70fdd99c235..e897bb5c5ac 100644 --- a/source/blender/python/api2_2x/Image.c +++ b/source/blender/python/api2_2x/Image.c @@ -153,14 +153,14 @@ static PyObject *M_Image_Get(PyObject *self, PyObject *args) img_list = PyList_New (BLI_countlist (&(G.main->image))); if (img_list == NULL) - return (PythonReturnErrorObject (PyExc_MemoryError, + return (EXPP_ReturnPyObjError (PyExc_MemoryError, "couldn't create PyList")); while (img_iter) { pyobj = Image_CreatePyObject (img_iter); if (!pyobj) - return (PythonReturnErrorObject (PyExc_MemoryError, + return (EXPP_ReturnPyObjError (PyExc_MemoryError, "couldn't create PyObject")); PyList_SET_ITEM (img_list, index, pyobj); @@ -262,7 +262,7 @@ static PyMethodDef BPy_Image_methods[] = { "(int) - Change Image object x repetition value"}, {"setYRep", (PyCFunction)Image_setYRep, METH_VARARGS, "(int) - Change Image object y repetition value"}, - {0} + {NULL, NULL, 0, NULL} }; /*****************************************************************************/ diff --git a/source/blender/python/api2_2x/Ipo.c b/source/blender/python/api2_2x/Ipo.c index ee2769b4cc9..9033219e764 100644 --- a/source/blender/python/api2_2x/Ipo.c +++ b/source/blender/python/api2_2x/Ipo.c @@ -286,7 +286,7 @@ M_Ipo_Get (PyObject * self, PyObject * args) ipolist = PyList_New (BLI_countlist (&(G.main->ipo))); if (ipolist == NULL) - return (PythonReturnErrorObject (PyExc_MemoryError, + return (EXPP_ReturnPyObjError (PyExc_MemoryError, "couldn't create PyList")); while (ipo_iter) @@ -294,7 +294,7 @@ M_Ipo_Get (PyObject * self, PyObject * args) pyobj = Ipo_CreatePyObject (ipo_iter); if (!pyobj) - return (PythonReturnErrorObject (PyExc_MemoryError, + return (EXPP_ReturnPyObjError (PyExc_MemoryError, "couldn't create PyString")); PyList_SET_ITEM (ipolist, index, pyobj); diff --git a/source/blender/python/api2_2x/Lamp.c b/source/blender/python/api2_2x/Lamp.c index 6b6018c7dd2..c09113ab3fa 100644 --- a/source/blender/python/api2_2x/Lamp.c +++ b/source/blender/python/api2_2x/Lamp.c @@ -161,14 +161,14 @@ static PyObject *M_Lamp_Get(PyObject *self, PyObject *args) lamplist = PyList_New (BLI_countlist (&(G.main->lamp))); if (lamplist == NULL) - return (PythonReturnErrorObject (PyExc_MemoryError, + return (EXPP_ReturnPyObjError (PyExc_MemoryError, "couldn't create PyList")); while (lamp_iter) { pyobj = Lamp_CreatePyObject (lamp_iter); if (!pyobj) - return (PythonReturnErrorObject (PyExc_MemoryError, + return (EXPP_ReturnPyObjError (PyExc_MemoryError, "couldn't create PyString")); PyList_SET_ITEM (lamplist, index, pyobj); diff --git a/source/blender/python/api2_2x/Lamp.h b/source/blender/python/api2_2x/Lamp.h index cc3fe9e76b8..f3e2f92eda0 100644 --- a/source/blender/python/api2_2x/Lamp.h +++ b/source/blender/python/api2_2x/Lamp.h @@ -271,7 +271,7 @@ static PyMethodDef BPy_Lamp_methods[] = { "(float) - change light intensity value #2 for a Quad Lamp"}, {"setCol", (PyCFunction)Lamp_setCol, METH_VARARGS, "(f,f,f) or ([f,f,f]) - change light's rgb color triplet"}, - {0} + {NULL, NULL, 0, NULL} }; /*****************************************************************************/ diff --git a/source/blender/python/api2_2x/Lattice.h b/source/blender/python/api2_2x/Lattice.h index 8b733f1c199..fed500de2c2 100644 --- a/source/blender/python/api2_2x/Lattice.h +++ b/source/blender/python/api2_2x/Lattice.h @@ -175,7 +175,7 @@ static PyMethodDef BPy_Lattice_methods[] = { Lattice_applyDeform_doc}, {"insertKey", (PyCFunction)Lattice_insertKey, METH_VARARGS, Lattice_insertKey_doc}, - {0} + {NULL, NULL, 0, NULL} }; /*****************************************************************************/ diff --git a/source/blender/python/api2_2x/MTex.c b/source/blender/python/api2_2x/MTex.c index 3740e30cc8f..581b0bd16f0 100644 --- a/source/blender/python/api2_2x/MTex.c +++ b/source/blender/python/api2_2x/MTex.c @@ -63,7 +63,7 @@ static PyMethodDef BPy_MTex_methods[] = { /* name, method, flags, doc */ {"setTex", (PyCFunction)MTex_setTex, METH_VARARGS, "(i) - Set MTex Texture"}, - {0} + {NULL, NULL,0, NULL} }; /*****************************************************************************/ diff --git a/source/blender/python/api2_2x/Material.c b/source/blender/python/api2_2x/Material.c index abf2c349edc..f2cfbfb23e3 100644 --- a/source/blender/python/api2_2x/Material.c +++ b/source/blender/python/api2_2x/Material.c @@ -234,14 +234,14 @@ static PyObject *M_Material_Get(PyObject *self, PyObject *args) matlist = PyList_New (BLI_countlist (&(G.main->mat))); if (!matlist) - return (PythonReturnErrorObject (PyExc_MemoryError, + return (EXPP_ReturnPyObjError (PyExc_MemoryError, "couldn't create PyList")); while (mat_iter) { pyobj = Material_CreatePyObject (mat_iter); if (!pyobj) - return (PythonReturnErrorObject (PyExc_MemoryError, + return (EXPP_ReturnPyObjError (PyExc_MemoryError, "couldn't create PyObject")); PyList_SET_ITEM (matlist, index, pyobj); @@ -503,7 +503,7 @@ static PyMethodDef BPy_Material_methods[] = { "(n,tex,texco=0,mapto=0) - Set numbered texture to tex"}, {"clearTexture", (PyCFunction)Material_clearTexture, METH_VARARGS, "(n) - Remove texture from numbered slot"}, - {0} + {NULL, NULL, 0, NULL} }; /*****************************************************************************/ diff --git a/source/blender/python/api2_2x/Metaball.c b/source/blender/python/api2_2x/Metaball.c index ca1348e2ffa..7f9d13e4ccb 100644 --- a/source/blender/python/api2_2x/Metaball.c +++ b/source/blender/python/api2_2x/Metaball.c @@ -147,7 +147,7 @@ static PyObject *M_Metaball_Get(PyObject *self, PyObject *args) mballlist = PyList_New (0); if (mballlist == NULL) - return (PythonReturnErrorObject (PyExc_MemoryError, + return (EXPP_ReturnPyObjError (PyExc_MemoryError, "couldn't create PyList")); while (mball_iter) { diff --git a/source/blender/python/api2_2x/Metaball.h b/source/blender/python/api2_2x/Metaball.h index 8165f8c4c24..d97e36fd53c 100644 --- a/source/blender/python/api2_2x/Metaball.h +++ b/source/blender/python/api2_2x/Metaball.h @@ -179,7 +179,7 @@ static PyMethodDef BPy_Metaball_methods[] = { {"setsize", (PyCFunction)Metaball_setsize , \ METH_VARARGS, "(f f f) - Sets Metaball size values"}, /*end of MetaElem data*/ - {0} + {NULL, NULL, 0, NULL} }; /*****************************************************************************/ diff --git a/source/blender/python/api2_2x/NLA.c b/source/blender/python/api2_2x/NLA.c index 9ae6bd66bbc..650ae4fe413 100644 --- a/source/blender/python/api2_2x/NLA.c +++ b/source/blender/python/api2_2x/NLA.c @@ -204,7 +204,7 @@ M_NLA_GetActions(PyObject* self) Py_DECREF (py_action); } else { Py_DECREF ( dict ); - return (PythonReturnErrorObject (PyExc_RuntimeError, + return (EXPP_ReturnPyObjError (PyExc_RuntimeError, "NLA_GetActions: could not create Action object")); } } @@ -359,7 +359,7 @@ static PyObject *Action_getAllChannelIpos (BPy_Action *self) Py_DECREF (ipo_attr); } else { Py_DECREF ( dict ); - return (PythonReturnErrorObject (PyExc_RuntimeError, + return (EXPP_ReturnPyObjError (PyExc_RuntimeError, "Action_getAllChannelIpos: could not create Ipo object")); } } diff --git a/source/blender/python/api2_2x/NMesh.c b/source/blender/python/api2_2x/NMesh.c index a77828cf9c0..ca8cc46ebc0 100644 --- a/source/blender/python/api2_2x/NMesh.c +++ b/source/blender/python/api2_2x/NMesh.c @@ -237,7 +237,7 @@ static PyObject *NMFace_append(PyObject *self, PyObject *args) static struct PyMethodDef NMFace_methods[] = { MethodDef(append), - {NULL, NULL} + {NULL, NULL, 0, NULL} }; static PyObject *NMFace_getattr(PyObject *self, char *name) @@ -1088,7 +1088,7 @@ static struct PyMethodDef NMesh_methods[] = NMesh_getMaxSmoothAngle_doc}, {"getSubDivLevels", (PyCFunction)NMesh_getSubDivLevels, METH_NOARGS, NMesh_getSubDivLevels_doc}, - {NULL, NULL} + {NULL, NULL, 0, NULL} }; static PyObject *NMesh_getattr(PyObject *self, char *name) @@ -2044,7 +2044,7 @@ static struct PyMethodDef M_NMesh_methods[] = { MethodDef(GetRaw), MethodDef(GetRawFromObject), MethodDef(PutRaw), - {NULL, NULL} + {NULL, NULL, 0, NULL} }; static PyObject *M_NMesh_Modes (void) diff --git a/source/blender/python/api2_2x/Object.c b/source/blender/python/api2_2x/Object.c index 772e4bb86ea..b0081cd046a 100644 --- a/source/blender/python/api2_2x/Object.c +++ b/source/blender/python/api2_2x/Object.c @@ -289,7 +289,7 @@ PyObject *M_Object_New(PyObject *self, PyObject *args) if (!PyArg_ParseTuple(args, "s|s", &str_type, &name)) { - PythonReturnErrorObject (PyExc_TypeError, "string expected as argument"); + EXPP_ReturnPyObjError (PyExc_TypeError, "string expected as argument"); return (NULL); } @@ -307,7 +307,7 @@ PyObject *M_Object_New(PyObject *self, PyObject *args) else if (strcmp (str_type, "Empty") == 0) type = OB_EMPTY; else { - return (PythonReturnErrorObject (PyExc_AttributeError, + return (EXPP_ReturnPyObjError (PyExc_AttributeError, "Unknown type specified")); } @@ -401,7 +401,7 @@ PyObject *M_Object_Get(PyObject *self, PyObject *args) if (object == NULL) { /* No object exists with the name specified in the argument name. */ - return (PythonReturnErrorObject (PyExc_AttributeError, + return (EXPP_ReturnPyObjError (PyExc_AttributeError, "Unknown object specified.")); } blen_object = (BPy_Object*)PyObject_NEW (BPy_Object, &Object_Type); @@ -420,7 +420,7 @@ PyObject *M_Object_Get(PyObject *self, PyObject *args) if (obj_list == NULL) { - return (PythonReturnErrorObject (PyExc_SystemError, + return (EXPP_ReturnPyObjError (PyExc_SystemError, "List creation failed.")); } @@ -574,7 +574,7 @@ static PyObject *Object_clrParent (BPy_Object *self, PyObject *args) if (!PyArg_ParseTuple (args, "|ii", &mode, &fast)) { - return (PythonReturnErrorObject (PyExc_AttributeError, + return (EXPP_ReturnPyObjError (PyExc_AttributeError, "expected one or two integers as arguments")); } @@ -735,7 +735,7 @@ static PyObject *Object_getDeltaLocation (BPy_Object *self) if (attr) return (attr); - return (PythonReturnErrorObject (PyExc_RuntimeError, + return (EXPP_ReturnPyObjError (PyExc_RuntimeError, "couldn't get Object.dloc attributes")); } @@ -745,7 +745,7 @@ static PyObject *Object_getDrawMode (BPy_Object *self) if (attr) return (attr); - return (PythonReturnErrorObject (PyExc_RuntimeError, + return (EXPP_ReturnPyObjError (PyExc_RuntimeError, "couldn't get Object.drawMode attribute")); } @@ -790,7 +790,7 @@ static PyObject *Object_getDrawType (BPy_Object *self) if (attr) return (attr); - return (PythonReturnErrorObject (PyExc_RuntimeError, + return (EXPP_ReturnPyObjError (PyExc_RuntimeError, "couldn't get Object.drawType attribute")); } @@ -837,7 +837,7 @@ static PyObject *Object_getLocation (BPy_Object *self, PyObject *args) if (attr) return (attr); - return (PythonReturnErrorObject (PyExc_RuntimeError, + return (EXPP_ReturnPyObjError (PyExc_RuntimeError, "couldn't get Object.loc attributes")); } @@ -863,7 +863,7 @@ static PyObject *Object_getName (BPy_Object *self) if (attr) return (attr); - return (PythonReturnErrorObject (PyExc_RuntimeError, + return (EXPP_ReturnPyObjError (PyExc_RuntimeError, "couldn't get the name of the Object")); } @@ -881,7 +881,7 @@ static PyObject *Object_getParent (BPy_Object *self) return (attr); } - return (PythonReturnErrorObject (PyExc_RuntimeError, + return (EXPP_ReturnPyObjError (PyExc_RuntimeError, "couldn't get Object.parent attribute")); } @@ -894,7 +894,7 @@ static PyObject *Object_getSize (BPy_Object *self, PyObject *args) if (attr) return (attr); - return (PythonReturnErrorObject (PyExc_RuntimeError, + return (EXPP_ReturnPyObjError (PyExc_RuntimeError, "couldn't get Object.size attributes")); } @@ -904,7 +904,7 @@ static PyObject *Object_getTimeOffset (BPy_Object *self) if (attr) return (attr); - return (PythonReturnErrorObject (PyExc_RuntimeError, + return (EXPP_ReturnPyObjError (PyExc_RuntimeError, "couldn't get Object.sf attributes")); } @@ -923,7 +923,7 @@ static PyObject *Object_getTracked (BPy_Object *self) return (attr); } - return (PythonReturnErrorObject (PyExc_RuntimeError, + return (EXPP_ReturnPyObjError (PyExc_RuntimeError, "couldn't get Object.track attribute")); } @@ -1077,7 +1077,7 @@ static PyObject *Object_link (BPy_Object *self, PyObject *args) if (!PyArg_ParseTuple (args, "O", &py_data)) { - return (PythonReturnErrorObject (PyExc_AttributeError, + return (EXPP_ReturnPyObjError (PyExc_AttributeError, "expected an object as argument")); } if (Armature_CheckPyObject (py_data)) @@ -1096,7 +1096,7 @@ static PyObject *Object_link (BPy_Object *self, PyObject *args) /* have we set data to something good? */ if( !data ) { - return (PythonReturnErrorObject (PyExc_AttributeError, + return (EXPP_ReturnPyObjError (PyExc_AttributeError, "link argument type is not supported ")); } @@ -1109,47 +1109,47 @@ static PyObject *Object_link (BPy_Object *self, PyObject *args) case ID_AR: if (self->object->type != OB_ARMATURE) { - return (PythonReturnErrorObject (PyExc_AttributeError, + return (EXPP_ReturnPyObjError (PyExc_AttributeError, "The 'link' object is incompatible with the base object")); } break; case ID_CA: if (self->object->type != OB_CAMERA) { - return (PythonReturnErrorObject (PyExc_AttributeError, + return (EXPP_ReturnPyObjError (PyExc_AttributeError, "The 'link' object is incompatible with the base object")); } break; case ID_LA: if (self->object->type != OB_LAMP) { - return (PythonReturnErrorObject (PyExc_AttributeError, + return (EXPP_ReturnPyObjError (PyExc_AttributeError, "The 'link' object is incompatible with the base object")); } break; case ID_ME: if (self->object->type != OB_MESH) { - return (PythonReturnErrorObject (PyExc_AttributeError, + return (EXPP_ReturnPyObjError (PyExc_AttributeError, "The 'link' object is incompatible with the base object")); } break; case ID_CU: if (self->object->type != OB_CURVE) { - return (PythonReturnErrorObject (PyExc_AttributeError, + return (EXPP_ReturnPyObjError (PyExc_AttributeError, "The 'link' object is incompatible with the base object")); } break; case ID_LT: if (self->object->type != OB_LATTICE) { - return (PythonReturnErrorObject (PyExc_AttributeError, + return (EXPP_ReturnPyObjError (PyExc_AttributeError, "The 'link' object is incompatible with the base object")); } break; default: - return (PythonReturnErrorObject (PyExc_AttributeError, + return (EXPP_ReturnPyObjError (PyExc_AttributeError, "Linking this object type is not supported")); } self->object->data = data; @@ -1169,7 +1169,7 @@ static PyObject *Object_link (BPy_Object *self, PyObject *args) } else { - return (PythonReturnErrorObject (PyExc_RuntimeError, + return (EXPP_ReturnPyObjError (PyExc_RuntimeError, "old object reference count below 0")); } } @@ -1190,12 +1190,12 @@ static PyObject *Object_makeParent (BPy_Object *self, PyObject *args) /* Check if the arguments passed to makeParent are valid. */ if (!PyArg_ParseTuple (args, "O|ii", &list, &noninverse, &fast)) { - return (PythonReturnErrorObject (PyExc_AttributeError, + return (EXPP_ReturnPyObjError (PyExc_AttributeError, "expected a list of objects and one or two integers as arguments")); } if (!PySequence_Check (list)) { - return (PythonReturnErrorObject (PyExc_TypeError, + return (EXPP_ReturnPyObjError (PyExc_TypeError, "expected a list of objects")); } @@ -1209,14 +1209,14 @@ static PyObject *Object_makeParent (BPy_Object *self, PyObject *args) if (child == NULL) { - return (PythonReturnErrorObject (PyExc_TypeError, + return (EXPP_ReturnPyObjError (PyExc_TypeError, "Object Type expected")); } parent = (Object*)self->object; if (test_parent_loop (parent, child)) { - return (PythonReturnErrorObject (PyExc_RuntimeError, + return (EXPP_ReturnPyObjError (PyExc_RuntimeError, "parenting loop detected - parenting failed")); } child->partype = PAROBJECT; @@ -1248,7 +1248,7 @@ static PyObject *Object_makeParent (BPy_Object *self, PyObject *args) static PyObject *Object_materialUsage (BPy_Object *self, PyObject *args) { - return (PythonReturnErrorObject (PyExc_NotImplementedError, + return (EXPP_ReturnPyObjError (PyExc_NotImplementedError, "materialUsage: not yet implemented")); } @@ -1282,7 +1282,7 @@ static PyObject *Object_setDrawMode (BPy_Object *self, PyObject *args) if (!PyArg_ParseTuple (args, "b", &dtx)) { - return (PythonReturnErrorObject (PyExc_AttributeError, + return (EXPP_ReturnPyObjError (PyExc_AttributeError, "expected an integer as argument")); } self->object->dtx = dtx; @@ -1297,7 +1297,7 @@ static PyObject *Object_setDrawType (BPy_Object *self, PyObject *args) if (!PyArg_ParseTuple (args, "b", &dt)) { - return (PythonReturnErrorObject (PyExc_AttributeError, + return (EXPP_ReturnPyObjError (PyExc_AttributeError, "expected an integer as argument")); } self->object->dt = dt; @@ -1445,7 +1445,7 @@ static PyObject *Object_setMaterials (BPy_Object *self, PyObject *args) if (!PyArg_ParseTuple (args, "O", &list)) { - return (PythonReturnErrorObject (PyExc_AttributeError, + return (EXPP_ReturnPyObjError (PyExc_AttributeError, "expected a list of materials as argument")); } @@ -1455,12 +1455,12 @@ static PyObject *Object_setMaterials (BPy_Object *self, PyObject *args) matlist = EXPP_newMaterialList_fromPyList (list); if (!matlist) { - return (PythonReturnErrorObject (PyExc_AttributeError, + return (EXPP_ReturnPyObjError (PyExc_AttributeError, "material list must be a list of valid materials!")); } if ((len < 0) || (len > MAXMAT)) { - return (PythonReturnErrorObject (PyExc_RuntimeError, + return (EXPP_ReturnPyObjError (PyExc_RuntimeError, "illegal material index!")); } @@ -1501,7 +1501,7 @@ static PyObject *Object_setName (BPy_Object *self, PyObject *args) if (!PyArg_ParseTuple (args, "s", &name)) { - return (PythonReturnErrorObject (PyExc_AttributeError, + return (EXPP_ReturnPyObjError (PyExc_AttributeError, "expected a String as argument")); } @@ -1543,7 +1543,7 @@ static PyObject *Object_setTimeOffset (BPy_Object *self, PyObject *args) if (!PyArg_ParseTuple (args, "f", &newTimeOffset)) { - return (PythonReturnErrorObject (PyExc_AttributeError, + return (EXPP_ReturnPyObjError (PyExc_AttributeError, "expected a float as argument")); } @@ -1561,20 +1561,20 @@ static PyObject *Object_shareFrom (BPy_Object *self, PyObject *args) if (!PyArg_ParseTuple (args, "O", &object)) { - PythonReturnErrorObject (PyExc_AttributeError, + EXPP_ReturnPyObjError (PyExc_AttributeError, "expected an object argument"); return (NULL); } if (!Object_CheckPyObject ((PyObject*)object)) { - PythonReturnErrorObject (PyExc_TypeError, + EXPP_ReturnPyObjError (PyExc_TypeError, "argument 1 is not of type 'Object'"); return (NULL); } if (self->object->type != object->object->type) { - PythonReturnErrorObject (PyExc_TypeError, + EXPP_ReturnPyObjError (PyExc_TypeError, "objects are not of same data type"); return (NULL); } @@ -1605,14 +1605,14 @@ static PyObject *Object_shareFrom (BPy_Object *self, PyObject *args) } else { - return (PythonReturnErrorObject (PyExc_RuntimeError, + return (EXPP_ReturnPyObjError (PyExc_RuntimeError, "old object reference count below 0")); } } Py_INCREF (Py_None); return (Py_None); default: - PythonReturnErrorObject (PyExc_TypeError, + EXPP_ReturnPyObjError (PyExc_TypeError, "type not supported"); return (NULL); } @@ -2007,42 +2007,42 @@ static int Object_setAttr (BPy_Object *obj, char *name, PyObject *value) if (StringEqual (name, "parent")) { /* This is not allowed. */ - PythonReturnErrorObject (PyExc_AttributeError, + EXPP_ReturnPyObjError (PyExc_AttributeError, "Setting the parent is not allowed."); return (0); } if (StringEqual (name, "track")) { /* This is not allowed. */ - PythonReturnErrorObject (PyExc_AttributeError, + EXPP_ReturnPyObjError (PyExc_AttributeError, "Setting the track is not allowed."); return (0); } if (StringEqual (name, "data")) { /* This is not allowed. */ - PythonReturnErrorObject (PyExc_AttributeError, + EXPP_ReturnPyObjError (PyExc_AttributeError, "Setting the data is not allowed."); return (0); } if (StringEqual (name, "ipo")) { /* This is not allowed. */ - PythonReturnErrorObject (PyExc_AttributeError, + EXPP_ReturnPyObjError (PyExc_AttributeError, "Setting the ipo is not allowed."); return (0); } if (StringEqual (name, "mat")) { /* This is not allowed. */ - PythonReturnErrorObject (PyExc_AttributeError, + EXPP_ReturnPyObjError (PyExc_AttributeError, "Setting the matrix is not allowed."); return (0); } if (StringEqual (name, "matrix")) { /* This is not allowed. */ - PythonReturnErrorObject (PyExc_AttributeError, + EXPP_ReturnPyObjError (PyExc_AttributeError, "Please use .setMatrix(matrix)"); return (0); } diff --git a/source/blender/python/api2_2x/Particle.c b/source/blender/python/api2_2x/Particle.c index 4df78194cdb..87c7f19e2aa 100644 --- a/source/blender/python/api2_2x/Particle.c +++ b/source/blender/python/api2_2x/Particle.c @@ -120,7 +120,7 @@ static PyMethodDef BPy_Particle_methods[] = { METH_NOARGS,"()-Return particle life time"}, {"setDefvec",(PyCFunction)Particle_setDefvec, METH_VARARGS, "()- Sets particle life time "}, - {0} + {NULL, NULL, 0, NULL} }; diff --git a/source/blender/python/api2_2x/Scene.c b/source/blender/python/api2_2x/Scene.c index 4e978facf40..8fa1802fe24 100644 --- a/source/blender/python/api2_2x/Scene.c +++ b/source/blender/python/api2_2x/Scene.c @@ -166,7 +166,7 @@ static PyMethodDef BPy_Scene_methods[] = { {"currentFrame", (PyCFunction)Scene_currentFrame, METH_VARARGS, "(frame) - If frame is given, the current frame is set and" "\nreturned in any case"}, - {0} + {NULL, NULL, 0, NULL} }; //-----------------------BPy_Scene method def------------------------------------------------------------------------- PyTypeObject Scene_Type = @@ -421,14 +421,14 @@ static PyObject *M_Scene_Get(PyObject *self, PyObject *args) sce_pylist = PyList_New (BLI_countlist (&(G.main->scene))); if (sce_pylist == NULL) - return (PythonReturnErrorObject (PyExc_MemoryError, + return (EXPP_ReturnPyObjError (PyExc_MemoryError, "couldn't create PyList")); while (scene_iter) { pyobj = Scene_CreatePyObject (scene_iter); if (!pyobj) - return (PythonReturnErrorObject (PyExc_MemoryError, + return (EXPP_ReturnPyObjError (PyExc_MemoryError, "couldn't create PyString")); PyList_SET_ITEM (sce_pylist, index, pyobj); diff --git a/source/blender/python/api2_2x/Text.c b/source/blender/python/api2_2x/Text.c index 721747c3133..266f82ed086 100644 --- a/source/blender/python/api2_2x/Text.c +++ b/source/blender/python/api2_2x/Text.c @@ -136,7 +136,7 @@ static PyMethodDef BPy_Text_methods[] = { "(name, val) - Set attribute 'name' to value 'val'"}, {"asLines", (PyCFunction)Text_asLines, METH_VARARGS, "() - Return text buffer as a list of lines"}, - {0} + {NULL, NULL, 0, NULL} }; /*****************************************************************************/ diff --git a/source/blender/python/api2_2x/Texture.c b/source/blender/python/api2_2x/Texture.c index 4e96628ee6e..6c6dda84ed9 100644 --- a/source/blender/python/api2_2x/Texture.c +++ b/source/blender/python/api2_2x/Texture.c @@ -356,7 +356,7 @@ static PyMethodDef BPy_Texture_methods[] = { "(s) - Set Texture stype"}, {"setType", (PyCFunction)Texture_setType, METH_VARARGS, "(s) - Set Texture type"}, - {0} + {NULL, NULL, 0, NULL} }; /*****************************************************************************/ @@ -467,13 +467,13 @@ static PyObject *M_Texture_Get(PyObject *self, PyObject *args) tex_pylist = PyList_New (BLI_countlist (&(G.main->tex))); if (!tex_pylist) - return PythonReturnErrorObject(PyExc_MemoryError, + return EXPP_ReturnPyObjError(PyExc_MemoryError, "couldn't create PyList"); while (tex_iter) { pyobj = Texture_CreatePyObject(tex_iter); if (!pyobj) - return PythonReturnErrorObject(PyExc_MemoryError, + return EXPP_ReturnPyObjError(PyExc_MemoryError, "couldn't create Texture PyObject"); PyList_SET_ITEM(tex_pylist, index, pyobj); diff --git a/source/blender/python/api2_2x/Wave.c b/source/blender/python/api2_2x/Wave.c index f967ed0d08d..1dbdd94fb47 100644 --- a/source/blender/python/api2_2x/Wave.c +++ b/source/blender/python/api2_2x/Wave.c @@ -85,7 +85,7 @@ static PyMethodDef BPy_Wave_methods[] = { METH_NOARGS,"()-Return Wave lifetime"}, {"setLifetime",(PyCFunction)Wave_setLifetime, METH_VARARGS, "()- Sets Wave lifetime"}, - {0} + {NULL, NULL, 0, NULL} }; diff --git a/source/blender/python/api2_2x/World.c b/source/blender/python/api2_2x/World.c index ba3b3e1eea3..172a6c3ac4e 100644 --- a/source/blender/python/api2_2x/World.c +++ b/source/blender/python/api2_2x/World.c @@ -189,7 +189,7 @@ static PyObject *M_World_Get(PyObject *self, PyObject *args) else { /* return a list of all worlds in the scene */ worldlist = PyList_New (0); if (worldlist == NULL) - return (PythonReturnErrorObject (PyExc_MemoryError, + return (EXPP_ReturnPyObjError (PyExc_MemoryError, "couldn't create PyList")); while (world_iter) { diff --git a/source/blender/python/api2_2x/World.h b/source/blender/python/api2_2x/World.h index 8889888320a..76b6510faa9 100644 --- a/source/blender/python/api2_2x/World.h +++ b/source/blender/python/api2_2x/World.h @@ -142,7 +142,7 @@ static PyMethodDef BPy_World_methods[] = { "() - Return World Data mist"}, {"setMist", (PyCFunction)World_setMist, METH_VARARGS, "() - Return World Data mist"}, - {0} + {NULL, NULL, 0, NULL} }; /*****************************************************************************/ diff --git a/source/blender/python/api2_2x/constant.c b/source/blender/python/api2_2x/constant.c index 208d17777db..ab7956efb47 100644 --- a/source/blender/python/api2_2x/constant.c +++ b/source/blender/python/api2_2x/constant.c @@ -102,11 +102,11 @@ static PyObject *new_const(void) constant = (BPy_constant *)PyObject_NEW(BPy_constant, &constant_Type); if (constant == NULL) - return (PythonReturnErrorObject (PyExc_MemoryError, + return (EXPP_ReturnPyObjError (PyExc_MemoryError, "couldn't create constant object")); if ((constant->dict = PyDict_New()) == NULL) - return (PythonReturnErrorObject (PyExc_MemoryError, + return (EXPP_ReturnPyObjError (PyExc_MemoryError, "couldn't create constant object's dictionary")); return (PyObject *)constant; @@ -152,10 +152,10 @@ static PyObject *constant_getAttr (BPy_constant *self, char *name) return v; } - return (PythonReturnErrorObject (PyExc_AttributeError, + return (EXPP_ReturnPyObjError (PyExc_AttributeError, "attribute not found")); } - return (PythonReturnErrorObject (PyExc_RuntimeError, + return (EXPP_ReturnPyObjError (PyExc_RuntimeError, "constant object lacks a dictionary")); } diff --git a/source/blender/python/api2_2x/gen_utils.c b/source/blender/python/api2_2x/gen_utils.c index 4e7d4de36d6..44aa86f98c3 100644 --- a/source/blender/python/api2_2x/gen_utils.c +++ b/source/blender/python/api2_2x/gen_utils.c @@ -92,11 +92,6 @@ ID *GetIdFromList(ListBase *list, char *name) /* Description: These functions set an internal string with the given type */ /* and error_msg arguments. */ /*****************************************************************************/ -PyObject * PythonReturnErrorObject (PyObject * type, char * error_msg) -{ - PyErr_SetString (type, error_msg); - return (NULL); -} PyObject *EXPP_ReturnPyObjError (PyObject * type, char * error_msg) { /* same as above, just to change its name smoothly */ @@ -114,17 +109,13 @@ int EXPP_ReturnIntError (PyObject *type, char *error_msg) /* Description: This function increments the reference count of the given */ /* Python object (usually Py_None) and returns it. */ /*****************************************************************************/ -PyObject * PythonIncRef (PyObject *object) -{ - Py_INCREF (object); - return (object); -} PyObject *EXPP_incr_ret (PyObject *object) { Py_INCREF (object); return (object); } + /*****************************************************************************/ /* Description: This function maps the event identifier to a string. */ /*****************************************************************************/