[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [22937] branches/ge_dyn_load/source/ gameengine: minor fixes for python loading demo.

Campbell Barton ideasman42 at gmail.com
Tue Sep 1 22:45:46 CEST 2009


Revision: 22937
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=22937
Author:   campbellbarton
Date:     2009-09-01 22:45:45 +0200 (Tue, 01 Sep 2009)

Log Message:
-----------
minor fixes for python loading demo.
http://www.graphicall.org/ftp/ideasman42/dyn_py_load.ogv

Modified Paths:
--------------
    branches/ge_dyn_load/source/gameengine/Converter/BL_BlenderDataConversion.cpp
    branches/ge_dyn_load/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
    branches/ge_dyn_load/source/gameengine/Ketsji/KX_PythonInit.cpp

Modified: branches/ge_dyn_load/source/gameengine/Converter/BL_BlenderDataConversion.cpp
===================================================================
--- branches/ge_dyn_load/source/gameengine/Converter/BL_BlenderDataConversion.cpp	2009-09-01 18:49:33 UTC (rev 22936)
+++ branches/ge_dyn_load/source/gameengine/Converter/BL_BlenderDataConversion.cpp	2009-09-01 20:45:45 UTC (rev 22937)
@@ -842,7 +842,7 @@
 		if(blenderobj)
 			ma = give_current_material(blenderobj, mface->mat_nr+1);
 		else
-			ma = mesh->mat[mface->mat_nr];
+			ma = mesh->mat ? mesh->mat[mface->mat_nr]:NULL;
 
 		{
 			bool visible = true;

Modified: branches/ge_dyn_load/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
===================================================================
--- branches/ge_dyn_load/source/gameengine/Converter/KX_BlenderSceneConverter.cpp	2009-09-01 18:49:33 UTC (rev 22936)
+++ branches/ge_dyn_load/source/gameengine/Converter/KX_BlenderSceneConverter.cpp	2009-09-01 20:45:45 UTC (rev 22937)
@@ -333,7 +333,7 @@
 				ccdPhysEnv->setDeactivationAngularTreshold(1.0f); // default, can be overridden by Python
 
 				SYS_SystemHandle syshandle = SYS_GetSystem(); /*unused*/
-				int visualizePhysics = 0; // SYS_GetCommandLineInt(syshandle,"show_physics",0);
+				int visualizePhysics = SYS_GetCommandLineInt(syshandle,"show_physics",0);
 				if (visualizePhysics)
 					ccdPhysEnv->setDebugMode(btIDebugDraw::DBG_DrawWireframe|btIDebugDraw::DBG_DrawAabb|btIDebugDraw::DBG_DrawContactPoints|btIDebugDraw::DBG_DrawText|btIDebugDraw::DBG_DrawConstraintLimits|btIDebugDraw::DBG_DrawConstraints);
 		
@@ -1248,6 +1248,9 @@
 	int maggie_index;
 	int i=0;
 
+	if(maggie==NULL)
+		return false;
+	
 	/* tag all false except the one we remove */
 	for (vector<Main*>::iterator it=m_DynamicMaggie.begin(); !(it==m_DynamicMaggie.end()); it++) {
 		Main *main= *it;
@@ -1289,7 +1292,6 @@
 					{	
 						STR_HashedString mn = meshobj->GetName();
 						mapStringToMeshes.remove(mn);
-						printf("REMIOVE %d\n", i);
 						i--;
 					}
 				}

Modified: branches/ge_dyn_load/source/gameengine/Ketsji/KX_PythonInit.cpp
===================================================================
--- branches/ge_dyn_load/source/gameengine/Ketsji/KX_PythonInit.cpp	2009-09-01 18:49:33 UTC (rev 22936)
+++ branches/ge_dyn_load/source/gameengine/Ketsji/KX_PythonInit.cpp	2009-09-01 20:45:45 UTC (rev 22937)
@@ -666,8 +666,13 @@
 	if (!PyArg_ParseTuple(args,"s:FreeLibrary",&path))
 		return NULL;
 
-	kx_scene->GetSceneConverter()->FreeBlendFile(path);
-	Py_RETURN_NONE;
+	if (kx_scene->GetSceneConverter()->FreeBlendFile(path))
+	{
+		Py_RETURN_TRUE;
+	}
+	else {
+		Py_RETURN_FALSE;
+	}
 }
 
 static PyObject *gListLibrary(PyObject*, PyObject* args)





More information about the Bf-blender-cvs mailing list