From df2fd95faa7b1428003a2c56c541b8fee0ed4c8f Mon Sep 17 00:00:00 2001 From: Ken Hughes Date: Tue, 26 Dec 2006 19:13:13 +0000 Subject: [PATCH] Python API ---------- Bugfix for at least one annoying "DeprecationWarning: integer argument expected, got float" followed by garbage printed to the console. The message happens when PyArg_Parse() is called to parse an integer but is passed a float. This happens in a few other places, bun unfortunately I can't fix them all right now. --- source/blender/python/api2_2x/Blender.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/source/blender/python/api2_2x/Blender.c b/source/blender/python/api2_2x/Blender.c index 23f3d7eaab5..684ad6b17d2 100644 --- a/source/blender/python/api2_2x/Blender.c +++ b/source/blender/python/api2_2x/Blender.c @@ -236,17 +236,19 @@ static PyObject *Blender_Set( PyObject * self, PyObject * args ) { char *name, *dir = NULL; PyObject *arg; - int framenum; if( !PyArg_ParseTuple( args, "sO", &name, &arg ) ) return EXPP_ReturnPyObjError( PyExc_ValueError, "expected 2 args, where the first is always a string" ); if( StringEqual( name, "curframe" ) ) { - if( !PyArg_Parse( arg, "i", &framenum ) ) - return ( NULL ); /* TODO: Do we need to generate a nice error message here? */ - G.scene->r.cfra = (short)framenum; - /* update all objects, so python scripts can export all objects in a scene - without worrying about the view layers */ + if( !PyInt_Check( arg ) ) + return EXPP_ReturnPyObjError( PyExc_ValueError, + "expected an integer" ); + + G.scene->r.cfra = (short)PyInt_AsLong( arg ) ; + + /* update all objects, so python scripts can export all objects + in a scene without worrying about the view layers */ scene_update_for_newframe(G.scene, (1<<20) - 1); } else if (StringEqual( name , "uscriptsdir" ) ) { @@ -975,9 +977,6 @@ void M_Blender_Init(void) EXPP_dict_set_item_str(dict, "event", PyString_FromString("")); EXPP_dict_set_item_str(dict, "mode", smode); - PyDict_SetItemString(dict, "IDGroupType", &IDGroup_Type); - PyDict_SetItemString(dict, "IDArrayType", &IDArray_Type); - PyDict_SetItemString(dict, "Armature", Armature_Init()); PyDict_SetItemString(dict, "BezTriple", BezTriple_Init()); PyDict_SetItemString(dict, "BGL", BGL_Init());