miscellaneous edits from python development branch merged back into trunk
authorCampbell Barton <ideasman42@gmail.com>
Fri, 7 Dec 2007 09:51:02 +0000 (09:51 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 7 Dec 2007 09:51:02 +0000 (09:51 +0000)
source/blender/python/BPY_interface.c
source/blender/python/api2_2x/Armature.c
source/blender/python/api2_2x/CurNurb.c
source/blender/python/api2_2x/Window.c
source/blender/python/api2_2x/doc/Render.py
source/blender/python/api2_2x/sceneRender.c
source/blender/python/api2_2x/sceneSequence.c

index a56a14b3db9a6cde2b1ae77743529b943832a712..770fbf13931769056cd88056c41847a362924b12 100644 (file)
@@ -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(""));
        }
index 6c22e831bd432d859fe5ec514c4d6c373b879596..05caca1cc2fca53e7b790d732751cd8c65bbd9e5 100644 (file)
@@ -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)
index e98b0da8f3d5c89515a7f37ccc8a8f43f8c0f15f..6b334c01c41f643370da029f4478f7d81dc4a12c 100644 (file)
@@ -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;
        }
 }
 
index c5c0860a9215d0308054685976b3998d407192f2..8c0b3ce74a9a8030d65d5312628a730ab8c44562 100644 (file)
@@ -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;
-}
-
+}      
 
 
 /*****************************************************************************/
index 61c8eda902698fdedf4d73e13306c05d5f38c14a..d75e07de8e3c65e7a4236b6d2b3f89f9b2cd1927 100644 (file)
@@ -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. 
index 187df27e79af13cfef8786bff6500e528dc0fd2b..aecd1d5b3563aef1fed33a2fc2f86b7de8228208 100644 (file)
@@ -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},
index fee1bde149cf048979387ab875d28b515f14c2fd..1d5e30589283aae8d045bfc78fb314ef8e6a4506 100644 (file)
@@ -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 );