[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [13837] trunk/blender/source/blender/ python/BPY_interface.c: Purge of warnings from BPY_interface.c

Joshua Leung aligorith at gmail.com
Sun Feb 24 11:36:21 CET 2008


Revision: 13837
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=13837
Author:   aligorith
Date:     2008-02-24 11:36:19 +0100 (Sun, 24 Feb 2008)

Log Message:
-----------
Purge of warnings from BPY_interface.c
* missing include for depsgraph from previous commit
* various problems related to gilstate calls being added in strange places (could someone familiar with python double check that they're in the right places now)?

Modified Paths:
--------------
    trunk/blender/source/blender/python/BPY_interface.c

Modified: trunk/blender/source/blender/python/BPY_interface.c
===================================================================
--- trunk/blender/source/blender/python/BPY_interface.c	2008-02-24 09:51:07 UTC (rev 13836)
+++ trunk/blender/source/blender/python/BPY_interface.c	2008-02-24 10:36:19 UTC (rev 13837)
@@ -61,6 +61,7 @@
 #include "BKE_global.h"
 #include "BKE_main.h"
 #include "BKE_armature.h"
+#include "BKE_depsgraph.h"
 #include "api2_2x/EXPP_interface.h"
 #include "api2_2x/constant.h"
 #include "api2_2x/gen_utils.h"
@@ -1774,18 +1775,20 @@
 	
 	idprop = BPy_Wrap_IDProperty( NULL, con->prop, NULL);
 	
+	gilstate = PyGILState_Ensure();
+	
 	retval = RunPython(con->text, globals);
 
 	if (retval == NULL) {
 		BPY_Err_Handle(con->text->id.name);
 		ReleaseGlobalDictionary(globals);
 		con->flag |= PYCON_SCRIPTERROR;
-	
+		
 		/* free temp objects */
 		Py_XDECREF(idprop);
-
+		
 		PyGILState_Release(gilstate);
-
+		
 		return;
 	}
 
@@ -1814,9 +1817,9 @@
 		ReleaseGlobalDictionary( globals );
 		
 		Py_XDECREF(idprop);
-
+		
 		PyGILState_Release(gilstate);
-
+		
 		return;
 	}
 	
@@ -1827,9 +1830,9 @@
 		/* free temp objects */
 		ReleaseGlobalDictionary(globals);
 		Py_XDECREF(idprop);
-
+		
 		PyGILState_Release(gilstate);
-
+		
 		return;
 	}
 	else {
@@ -1839,9 +1842,9 @@
 		/* free temp objects */
 		Py_XDECREF(idprop);
 		Py_DECREF(retval);
-
+		
 		PyGILState_Release(gilstate);
-
+		
 		return;
 	}
 }
@@ -2398,9 +2401,9 @@
 			during_slink++;
 			disable_where_scriptlink( (short)during_slink );
 		}
-
+		
 		gilstate = PyGILState_Ensure();
-
+		
 		if( !setup_armature_weakrefs()){
 			printf("Oops - weakref dict, this is a bug\n");
 			PyGILState_Release(gilstate);
@@ -2415,7 +2418,7 @@
 		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++ ) {
-
+			
 			/* for DRAW handlers: */
 			if (event == 0) {
 				glPushAttrib(GL_ALL_ATTRIB_BITS);
@@ -2424,7 +2427,7 @@
 				glMatrixMode(GL_MODELVIEW);
 				glPushMatrix();
 			}
-
+			
 			if( ( scriptlink->flag[index] == space_event ) &&
 			    ( scriptlink->scripts[index] != NULL ) ) {
 				dict = CreateGlobalDictionary();
@@ -2444,7 +2447,7 @@
 					if (event && (PyDict_GetItemString(g_blenderdict,"event") == Py_None))
 						retval = 1; /* event was swallowed */
 				}
-
+				
 				/* If a scriptlink has just loaded a new .blend file, the
 				 * scriptlink pointer became invalid (see api2_2x/Blender.c),
 				 * so we stop here. */
@@ -2454,7 +2457,7 @@
 					break;
 				}
 			}
-
+			
 			/* for DRAW handlers: */
 			if (event == 0) {
 				glMatrixMode(GL_PROJECTION);
@@ -2464,12 +2467,14 @@
 				glPopAttrib();
 				disable_where_scriptlink( (short)(during_slink - 1) );
 			}
-
+		
 		}
-
+		
 		PyDict_SetItemString(g_blenderdict, "bylink", Py_False);
 		PyDict_SetItemString(g_blenderdict, "link", Py_None );
 		EXPP_dict_set_item_str(g_blenderdict, "event", PyString_FromString(""));
+		
+		PyGILState_Release(gilstate);
 	}
 	
 	/* retval:
@@ -2479,8 +2484,6 @@
 	 * space_event is of type DRAW:
 	 * 0 always */
 
-	PyGILState_Release(gilstate);
-
 	return retval;
 }
 





More information about the Bf-blender-cvs mailing list