diff options
author | Ken Hughes <khughes@pacific.edu> | 2006-12-26 22:13:13 +0300 |
---|---|---|
committer | Ken Hughes <khughes@pacific.edu> | 2006-12-26 22:13:13 +0300 |
commit | df2fd95faa7b1428003a2c56c541b8fee0ed4c8f (patch) | |
tree | 781843fba42849bd3b933175ed214dcc4bdaf3b3 /source/blender/python/api2_2x/Blender.c | |
parent | d2d86d34d3b745ebf428ca5c0fb0f857c9180b61 (diff) |
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.
Diffstat (limited to 'source/blender/python/api2_2x/Blender.c')
-rw-r--r-- | source/blender/python/api2_2x/Blender.c | 17 |
1 files 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()); |