[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [20067] trunk/blender/source: Disable importing module python controller scripts at conversion time because it can run BGE functions and crash since the internal state isnt setup yet .

Campbell Barton ideasman42 at gmail.com
Tue May 5 07:57:09 CEST 2009


Revision: 20067
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=20067
Author:   campbellbarton
Date:     2009-05-05 07:57:08 +0200 (Tue, 05 May 2009)

Log Message:
-----------
Disable importing module python controller scripts at conversion time because it can run BGE functions and crash since the internal state isnt setup yet.

face-select mode wasnt working when used with projection paint.

Modified Paths:
--------------
    trunk/blender/source/blender/src/drawview.c
    trunk/blender/source/gameengine/Converter/KX_ConvertControllers.cpp
    trunk/blender/source/gameengine/GameLogic/SCA_PythonController.cpp

Modified: trunk/blender/source/blender/src/drawview.c
===================================================================
--- trunk/blender/source/blender/src/drawview.c	2009-05-05 04:07:08 UTC (rev 20066)
+++ trunk/blender/source/blender/src/drawview.c	2009-05-05 05:57:08 UTC (rev 20067)
@@ -977,7 +977,7 @@
 	int m;
 #endif
 
-	if(	G.f & G_VERTEXPAINT || G.f & G_WEIGHTPAINT );
+	if(	G.f & G_VERTEXPAINT || G.f & G_WEIGHTPAINT || (FACESEL_PAINT_TEST));
 	else if ((G.f & G_TEXTUREPAINT) && G.scene->toolsettings && (G.scene->toolsettings->imapaint.flag & IMAGEPAINT_PROJECT_DISABLE));
 	else if(G.obedit && G.vd->drawtype>OB_WIRE && (G.vd->flag & V3D_ZBUF_SELECT));
 	else {

Modified: trunk/blender/source/gameengine/Converter/KX_ConvertControllers.cpp
===================================================================
--- trunk/blender/source/gameengine/Converter/KX_ConvertControllers.cpp	2009-05-05 04:07:08 UTC (rev 20066)
+++ trunk/blender/source/gameengine/Converter/KX_ConvertControllers.cpp	2009-05-05 05:57:08 UTC (rev 20067)
@@ -216,8 +216,13 @@
 				 * gives more pradictable performance for larger scripts */
 				if(pyctrl->m_mode==SCA_PythonController::SCA_PYEXEC_SCRIPT)
 					pyctrl->Compile();
-				else
-					pyctrl->Import();
+				else {
+					/* We cant do this because importing runs the script which could end up accessing
+					 * internal BGE functions, this is unstable while we're converting the scene.
+					 * This is a pitty because its useful to see errors at startup but cant help it */
+					
+					// pyctrl->Import();
+				}
 			}
 			
 			//done with gamecontroller

Modified: trunk/blender/source/gameengine/GameLogic/SCA_PythonController.cpp
===================================================================
--- trunk/blender/source/gameengine/GameLogic/SCA_PythonController.cpp	2009-05-05 04:07:08 UTC (rev 20066)
+++ trunk/blender/source/gameengine/GameLogic/SCA_PythonController.cpp	2009-05-05 05:57:08 UTC (rev 20067)
@@ -164,6 +164,11 @@
 /* warning, self is not the SCA_PythonController, its a PyObjectPlus_Proxy */
 PyObject* SCA_PythonController::sPyGetCurrentController(PyObject *self)
 {
+	if(m_sCurrentController==NULL)
+	{
+		PyErr_SetString(PyExc_SystemError, "GameLogic.getCurrentController(), this function is being run outside the python controllers context, or blenders internal state is corrupt.");
+		return NULL;
+	}
 	return m_sCurrentController->GetProxy();
 }
 





More information about the Bf-blender-cvs mailing list