forked from bartvdbraak/blender
Replace deprecated methods from old api:
PythonReturnErrorObject PythonIncRef Fix some compiler warnings about missing initializers in method tables.
This commit is contained in:
parent
d97e3e5527
commit
a703837179
@ -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);
|
||||
|
@ -41,7 +41,8 @@
|
||||
|
||||
typedef struct
|
||||
{
|
||||
PyObject_HEAD BezTriple *beztriple;
|
||||
PyObject_HEAD /* required python macro */
|
||||
BezTriple *beztriple;
|
||||
}
|
||||
C_BezTriple;
|
||||
|
||||
|
@ -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"));
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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)
|
||||
|
@ -297,7 +297,7 @@ static struct PyMethodDef Draw_methods[] = {
|
||||
MethodDef (Redraw),
|
||||
MethodDef (Draw),
|
||||
MethodDef (Register),
|
||||
{NULL, NULL}
|
||||
{NULL, NULL,0,NULL}
|
||||
};
|
||||
|
||||
PyTypeObject Button_Type = {
|
||||
|
@ -37,7 +37,7 @@
|
||||
/* Python BPy_Effect methods table: */
|
||||
/*****************************************************************************/
|
||||
static PyMethodDef BPy_Effect_methods[] = {
|
||||
{0}
|
||||
{NULL, NULL, 0, NULL}
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -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}
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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}
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -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}
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -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}
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -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}
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -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) {
|
||||
|
@ -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}
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -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"));
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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}
|
||||
};
|
||||
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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}
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -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);
|
||||
|
@ -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}
|
||||
};
|
||||
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -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}
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -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"));
|
||||
}
|
||||
|
||||
|
@ -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. */
|
||||
/*****************************************************************************/
|
||||
|
Loading…
Reference in New Issue
Block a user