diff options
author | Campbell Barton <ideasman42@gmail.com> | 2007-12-07 12:51:02 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2007-12-07 12:51:02 +0300 |
commit | 9723e3ef39d0a0c8b7a47f145c52982481109f2f (patch) | |
tree | 656060f63fc7b23ffc078591b2dc8c8f0095ab28 /source | |
parent | ab02e9140e6c8b1d8c9169b18fa5025a1fb54377 (diff) |
miscellaneous edits from python development branch merged back into trunk
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/python/BPY_interface.c | 33 | ||||
-rw-r--r-- | source/blender/python/api2_2x/Armature.c | 4 | ||||
-rw-r--r-- | source/blender/python/api2_2x/CurNurb.c | 8 | ||||
-rw-r--r-- | source/blender/python/api2_2x/Window.c | 4 | ||||
-rw-r--r-- | source/blender/python/api2_2x/doc/Render.py | 4 | ||||
-rw-r--r-- | source/blender/python/api2_2x/sceneRender.c | 2 | ||||
-rw-r--r-- | source/blender/python/api2_2x/sceneSequence.c | 2 |
7 files changed, 23 insertions, 34 deletions
diff --git a/source/blender/python/BPY_interface.c b/source/blender/python/BPY_interface.c index a56a14b3db9..770fbf13931 100644 --- a/source/blender/python/BPY_interface.c +++ b/source/blender/python/BPY_interface.c @@ -1078,8 +1078,6 @@ static int bpy_pydriver_create_dict(void) PyDict_SetItemString(d, "m", mod); Py_DECREF(mod); } - - mod = PyImport_ImportModule("Blender.Noise"); if (mod) { @@ -1111,7 +1109,8 @@ static int bpy_pydriver_create_dict(void) Py_DECREF(fcn); } } - + + /* TODO - change these */ /* me(meshname) == Blender.Mesh.Get(meshname) */ mod = PyImport_ImportModule("Blender.Mesh"); if (mod) { @@ -1316,7 +1315,7 @@ void BPY_pyconstraint_eval(bPythonConstraint *con, bConstraintOb *cob, ListBase tarmats= PyList_New(con->tarnum); for (ct=targets->first, index=0; ct; ct=ct->next, index++) { tarmat = newMatrixObject((float *)ct->matrix, 4, 4, Py_NEW); - PyList_SetItem(tarmats, index, tarmat); + PyList_SET_ITEM(tarmats, index, tarmat); } @@ -1717,7 +1716,7 @@ struct Object **BPY_pydriver_get_objects(IpoDriver *driver) float BPY_pydriver_eval(IpoDriver *driver) { char *expr = NULL; - PyObject *retval, *floatval, *bpy_ob = NULL; + PyObject *retval, *bpy_ob = NULL; float result = 0.0f; /* default return */ int setitem_retval; @@ -1755,15 +1754,11 @@ float BPY_pydriver_eval(IpoDriver *driver) return pydriver_error(driver); } - floatval = PyNumber_Float(retval); - Py_DECREF(retval); - - if (floatval == NULL) + result = ( float )PyFloat_AsDouble( retval ); + + if (result == -1 && PyErr_Occurred()) return pydriver_error(driver); - result = (float)PyFloat_AsDouble(floatval); - Py_DECREF(floatval); - /* remove 'self', since this dict is also used by py buttons */ if (setitem_retval == 0) PyDict_DelItemString(bpy_pydriver_Dict, "self"); @@ -1970,13 +1965,11 @@ void BPY_do_pyscript( ID * id, short event ) disable_where_scriptlink( (short)during_slink ); /* set globals in Blender module to identify scriptlink */ - EXPP_dict_set_item_str( g_blenderdict, "bylink", EXPP_incr_ret_True() ); - + PyDict_SetItemString( g_blenderdict, "bylink", Py_True); EXPP_dict_set_item_str( g_blenderdict, "link", value ); EXPP_dict_set_item_str( g_blenderdict, "event", PyString_FromString( event_to_name ( event ) ) ); - if (event == SCRIPT_POSTRENDER) event = SCRIPT_RENDER; for( index = 0; index < scriptlink->totscript; index++ ) { @@ -2012,10 +2005,9 @@ void BPY_do_pyscript( ID * id, short event ) /* cleanup bylink flag and clear link so PyObject * can be released */ - EXPP_dict_set_item_str( g_blenderdict, "bylink", EXPP_incr_ret_False() ); + PyDict_SetItemString(g_blenderdict, "bylink", Py_False); PyDict_SetItemString( g_blenderdict, "link", Py_None ); - EXPP_dict_set_item_str( g_blenderdict, "event", - PyString_FromString( "" ) ); + EXPP_dict_set_item_str( g_blenderdict, "event", PyString_FromString( "" ) ); } } @@ -2196,12 +2188,11 @@ int BPY_do_spacehandlers( ScrArea *sa, unsigned short event, } /* set globals in Blender module to identify space handler scriptlink */ - EXPP_dict_set_item_str(g_blenderdict, "bylink", EXPP_incr_ret_True()); + PyDict_SetItemString(g_blenderdict, "bylink", Py_True); /* unlike normal scriptlinks, here Blender.link is int (space event type) */ EXPP_dict_set_item_str(g_blenderdict, "link", PyInt_FromLong(space_event)); /* note: DRAW space_events set event to 0 */ EXPP_dict_set_item_str(g_blenderdict, "event", PyInt_FromLong(event)); - /* now run all assigned space handlers for this space and space_event */ for( index = 0; index < scriptlink->totscript; index++ ) { @@ -2256,7 +2247,7 @@ int BPY_do_spacehandlers( ScrArea *sa, unsigned short event, } - EXPP_dict_set_item_str(g_blenderdict, "bylink", EXPP_incr_ret_False()); + PyDict_SetItemString(g_blenderdict, "bylink", Py_False); PyDict_SetItemString(g_blenderdict, "link", Py_None ); EXPP_dict_set_item_str(g_blenderdict, "event", PyString_FromString("")); } diff --git a/source/blender/python/api2_2x/Armature.c b/source/blender/python/api2_2x/Armature.c index 6c22e831bd4..05caca1cc2f 100644 --- a/source/blender/python/api2_2x/Armature.c +++ b/source/blender/python/api2_2x/Armature.c @@ -882,9 +882,9 @@ AttributeError: static PyObject *Armature_getVertexGroups(BPy_Armature *self, void *closure) { if (self->armature->deformflag & ARM_DEF_VGROUP) - return EXPP_incr_ret(Py_True); + Py_RETURN_TRUE; else - return EXPP_incr_ret(Py_False); + Py_RETURN_FALSE; } //------------------------Armature.vertexGroups (setter) static int Armature_setVertexGroups(BPy_Armature *self, PyObject *value, void *closure) diff --git a/source/blender/python/api2_2x/CurNurb.c b/source/blender/python/api2_2x/CurNurb.c index e98b0da8f3d..6b334c01c41 100644 --- a/source/blender/python/api2_2x/CurNurb.c +++ b/source/blender/python/api2_2x/CurNurb.c @@ -776,9 +776,9 @@ static PyObject *CurNurb_isNurb( BPy_CurNurb * self ) */ if( self->nurb->bp ) { - return EXPP_incr_ret_True(); + Py_RETURN_TRUE; } else { - return EXPP_incr_ret_False(); + Py_RETURN_FALSE; } } @@ -792,9 +792,9 @@ static PyObject *CurNurb_isCyclic( BPy_CurNurb * self ) /* supposing that the flagu is always set */ if( self->nurb->flagu & CU_CYCLIC ) { - return EXPP_incr_ret_True(); + Py_RETURN_TRUE; } else { - return EXPP_incr_ret_False(); + Py_RETURN_FALSE; } } diff --git a/source/blender/python/api2_2x/Window.c b/source/blender/python/api2_2x/Window.c index c5c0860a921..8c0b3ce74a9 100644 --- a/source/blender/python/api2_2x/Window.c +++ b/source/blender/python/api2_2x/Window.c @@ -197,7 +197,6 @@ static char M_Window_EditMode_doc[] = Returns the current status. This function is mostly useful to leave\n\ edit mode before applying changes to a mesh (otherwise the changes will\n\ be lost) and then returning to it upon leaving."; - static char M_Window_PoseMode_doc[] = "() - Get the current status -- 0: not in pose mode; 1: in edit mode"; @@ -1508,8 +1507,7 @@ static PyObject *M_Window_SetPivot( PyObject * self, PyObject * value) G.vd->around = pivot; } Py_RETURN_NONE; -} - +} /*****************************************************************************/ diff --git a/source/blender/python/api2_2x/doc/Render.py b/source/blender/python/api2_2x/doc/Render.py index 61c8eda9026..d75e07de8e3 100644 --- a/source/blender/python/api2_2x/doc/Render.py +++ b/source/blender/python/api2_2x/doc/Render.py @@ -293,11 +293,11 @@ class RenderData: @type oversampling: boolean @ivar fps: Frames per second. Values are clamped to the range [1,120]. - @ivar fps_base: Frames per second base: used to generate fractional frames + @ivar fpsBase: Frames per second base: used to generate fractional frames per second values. For example, setting fps to 30 and fps_base to 1.001 will approximate the NTSC frame rate of 29.97 fps. Values are clamped to the range [1,120]. - @type fps_base: float + @type fpsBase: float @ivar timeCode: Get the current frame in HH:MM:SS:FF format. Read-only. @type timeCode: string @ivar environmentMap: Environment map rendering enabled. diff --git a/source/blender/python/api2_2x/sceneRender.c b/source/blender/python/api2_2x/sceneRender.c index 187df27e79a..aecd1d5b356 100644 --- a/source/blender/python/api2_2x/sceneRender.c +++ b/source/blender/python/api2_2x/sceneRender.c @@ -2566,7 +2566,7 @@ static PyGetSetDef BPy_RenderData_getseters[] = { (getter)RenderData_getIValueAttr, (setter)RenderData_setIValueAttrClamp, "Frames per second", (void *)EXPP_RENDER_ATTR_FPS}, - {"fps_base", + {"fpsBase", (getter)RenderData_getFloatAttr, (setter)RenderData_setFloatAttrClamp, "Frames per second base", (void *)EXPP_RENDER_ATTR_FPS_BASE}, diff --git a/source/blender/python/api2_2x/sceneSequence.c b/source/blender/python/api2_2x/sceneSequence.c index fee1bde149c..1d5e3058928 100644 --- a/source/blender/python/api2_2x/sceneSequence.c +++ b/source/blender/python/api2_2x/sceneSequence.c @@ -569,7 +569,7 @@ static PyObject *getIntAttr( BPy_Sequence *self, void *type ) break; default: return EXPP_ReturnPyObjError( PyExc_RuntimeError, - "undefined type in getFloatAttr" ); + "undefined type in getIntAttr" ); } return PyInt_FromLong( param ); |