[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [12813] trunk/blender/source/blender/ python: miscellaneous edits from python development branch merged back into trunk

Campbell Barton ideasman42 at gmail.com
Fri Dec 7 10:51:02 CET 2007


Revision: 12813
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=12813
Author:   campbellbarton
Date:     2007-12-07 10:51:02 +0100 (Fri, 07 Dec 2007)

Log Message:
-----------
miscellaneous edits from python development branch merged back into trunk

Modified Paths:
--------------
    trunk/blender/source/blender/python/BPY_interface.c
    trunk/blender/source/blender/python/api2_2x/Armature.c
    trunk/blender/source/blender/python/api2_2x/CurNurb.c
    trunk/blender/source/blender/python/api2_2x/Window.c
    trunk/blender/source/blender/python/api2_2x/doc/Render.py
    trunk/blender/source/blender/python/api2_2x/sceneRender.c
    trunk/blender/source/blender/python/api2_2x/sceneSequence.c

Modified: trunk/blender/source/blender/python/BPY_interface.c
===================================================================
--- trunk/blender/source/blender/python/BPY_interface.c	2007-12-07 04:24:02 UTC (rev 12812)
+++ trunk/blender/source/blender/python/BPY_interface.c	2007-12-07 09:51:02 UTC (rev 12813)
@@ -1078,8 +1078,6 @@
 		PyDict_SetItemString(d, "m", mod);
 		Py_DECREF(mod);
 	} 
-	
-	
 
 	mod = PyImport_ImportModule("Blender.Noise");
 	if (mod) {
@@ -1111,7 +1109,8 @@
 			Py_DECREF(fcn);
 		}
 	}
-
+	
+	/* TODO - change these */
 	/* me(meshname) == Blender.Mesh.Get(meshname) */
 	mod = PyImport_ImportModule("Blender.Mesh");
 	if (mod) {
@@ -1316,7 +1315,7 @@
 	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 @@
 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 @@
 		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 @@
 		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 @@
 		/* 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 @@
 		}
 		
 		/* 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 @@
 
 		}
 
-		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(""));
 	}

Modified: trunk/blender/source/blender/python/api2_2x/Armature.c
===================================================================
--- trunk/blender/source/blender/python/api2_2x/Armature.c	2007-12-07 04:24:02 UTC (rev 12812)
+++ trunk/blender/source/blender/python/api2_2x/Armature.c	2007-12-07 09:51:02 UTC (rev 12813)
@@ -882,9 +882,9 @@
 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)

Modified: trunk/blender/source/blender/python/api2_2x/CurNurb.c
===================================================================
--- trunk/blender/source/blender/python/api2_2x/CurNurb.c	2007-12-07 04:24:02 UTC (rev 12812)
+++ trunk/blender/source/blender/python/api2_2x/CurNurb.c	2007-12-07 09:51:02 UTC (rev 12813)
@@ -776,9 +776,9 @@
 	 */
 
 	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 @@
         /* 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;
 	}
 }
 

Modified: trunk/blender/source/blender/python/api2_2x/Window.c
===================================================================
--- trunk/blender/source/blender/python/api2_2x/Window.c	2007-12-07 04:24:02 UTC (rev 12812)
+++ trunk/blender/source/blender/python/api2_2x/Window.c	2007-12-07 09:51:02 UTC (rev 12813)
@@ -197,7 +197,6 @@
 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,10 +1507,9 @@
 		G.vd->around = pivot;
 	}
 	Py_RETURN_NONE;
-}
+}	
 
 
-
 /*****************************************************************************/
 /* Function:	Window_Init						*/
 /*****************************************************************************/

Modified: trunk/blender/source/blender/python/api2_2x/doc/Render.py
===================================================================
--- trunk/blender/source/blender/python/api2_2x/doc/Render.py	2007-12-07 04:24:02 UTC (rev 12812)
+++ trunk/blender/source/blender/python/api2_2x/doc/Render.py	2007-12-07 09:51:02 UTC (rev 12813)
@@ -293,11 +293,11 @@
   @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. 

Modified: trunk/blender/source/blender/python/api2_2x/sceneRender.c
===================================================================
--- trunk/blender/source/blender/python/api2_2x/sceneRender.c	2007-12-07 04:24:02 UTC (rev 12812)
+++ trunk/blender/source/blender/python/api2_2x/sceneRender.c	2007-12-07 09:51:02 UTC (rev 12813)
@@ -2566,7 +2566,7 @@
 	 (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},

Modified: trunk/blender/source/blender/python/api2_2x/sceneSequence.c
===================================================================
--- trunk/blender/source/blender/python/api2_2x/sceneSequence.c	2007-12-07 04:24:02 UTC (rev 12812)
+++ trunk/blender/source/blender/python/api2_2x/sceneSequence.c	2007-12-07 09:51:02 UTC (rev 12813)
@@ -569,7 +569,7 @@
 		break;
 	default:
 		return EXPP_ReturnPyObjError( PyExc_RuntimeError, 
-				"undefined type in getFloatAttr" );
+				"undefined type in getIntAttr" );
 	}
 
 	return PyInt_FromLong( param );





More information about the Bf-blender-cvs mailing list