[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [31236] branches/soc-2010-nexyon/source: Blender Py API: GameLogic -> bge.logic

Joerg Mueller nexyon at gmail.com
Wed Aug 11 14:14:16 CEST 2010


Revision: 31236
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=31236
Author:   nexyon
Date:     2010-08-11 14:14:16 +0200 (Wed, 11 Aug 2010)

Log Message:
-----------
Blender Py API: GameLogic -> bge.logic

Modified Paths:
--------------
    branches/soc-2010-nexyon/source/blender/editors/space_logic/logic_window.c
    branches/soc-2010-nexyon/source/blender/makesrna/intern/rna_actuator.c
    branches/soc-2010-nexyon/source/gameengine/GameLogic/SCA_PythonController.cpp
    branches/soc-2010-nexyon/source/gameengine/Ketsji/KX_BlenderMaterial.cpp
    branches/soc-2010-nexyon/source/gameengine/Ketsji/KX_Camera.cpp
    branches/soc-2010-nexyon/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
    branches/soc-2010-nexyon/source/gameengine/Ketsji/KX_PythonInit.cpp

Modified: branches/soc-2010-nexyon/source/blender/editors/space_logic/logic_window.c
===================================================================
--- branches/soc-2010-nexyon/source/blender/editors/space_logic/logic_window.c	2010-08-11 12:09:56 UTC (rev 31235)
+++ branches/soc-2010-nexyon/source/blender/editors/space_logic/logic_window.c	2010-08-11 12:14:16 UTC (rev 31236)
@@ -2530,7 +2530,7 @@
 			}
 
 			//str = "Scene %t|Load game%x0|Start loaded game%x1|Restart this game%x2|Quit this game %x3";
-			str = "Scene %t|Start new game%x0|Restart this game%x2|Quit this game %x3|Save GameLogic.globalDict %x4|Load GameLogic.globalDict %x5";
+			str = "Scene %t|Start new game%x0|Restart this game%x2|Quit this game %x3|Save bge.logic.globalDict %x4|Load bge.logic.globalDict %x5";
 			uiDefButS(block, MENU, B_REDR, str, xco+40, yco-24, (width-80), 19, &gma->type, 0.0, 0.0, 0, 0, ""); 
 			
 			yco -= ysize; 

Modified: branches/soc-2010-nexyon/source/blender/makesrna/intern/rna_actuator.c
===================================================================
--- branches/soc-2010-nexyon/source/blender/makesrna/intern/rna_actuator.c	2010-08-11 12:09:56 UTC (rev 31235)
+++ branches/soc-2010-nexyon/source/blender/makesrna/intern/rna_actuator.c	2010-08-11 12:14:16 UTC (rev 31236)
@@ -1557,8 +1557,8 @@
 		{ACT_GAME_LOAD, "START", 0, "Start new game", ""},
 		{ACT_GAME_RESTART, "RESTART", 0, "Restart this game", ""},
 		{ACT_GAME_QUIT, "QUIT", 0, "Quit this game", ""},
-		{ACT_GAME_SAVECFG, "SAVECFG", 0, "Save GameLogic.globalDict", ""},
-		{ACT_GAME_LOADCFG, "LOADCFG", 0, "Load GameLogic.globalDict", ""},
+		{ACT_GAME_SAVECFG, "SAVECFG", 0, "Save bge.logic.globalDict", ""},
+		{ACT_GAME_LOADCFG, "LOADCFG", 0, "Load bge.logic.globalDict", ""},
 		{0, NULL, 0, NULL, NULL}};
 	
 	srna= RNA_def_struct(brna, "GameActuator", "Actuator");

Modified: branches/soc-2010-nexyon/source/gameengine/GameLogic/SCA_PythonController.cpp
===================================================================
--- branches/soc-2010-nexyon/source/gameengine/GameLogic/SCA_PythonController.cpp	2010-08-11 12:09:56 UTC (rev 31235)
+++ branches/soc-2010-nexyon/source/gameengine/GameLogic/SCA_PythonController.cpp	2010-08-11 12:14:16 UTC (rev 31236)
@@ -178,7 +178,7 @@
 {
 	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.");
+		PyErr_SetString(PyExc_SystemError, "bge.logic.getCurrentController(), this function is being run outside the python controllers context, or blenders internal state is corrupt.");
 		return NULL;
 	}
 	return m_sCurrentController->GetProxy();

Modified: branches/soc-2010-nexyon/source/gameengine/Ketsji/KX_BlenderMaterial.cpp
===================================================================
--- branches/soc-2010-nexyon/source/gameengine/Ketsji/KX_BlenderMaterial.cpp	2010-08-11 12:09:56 UTC (rev 31235)
+++ branches/soc-2010-nexyon/source/gameengine/Ketsji/KX_BlenderMaterial.cpp	2010-08-11 12:14:16 UTC (rev 31236)
@@ -939,7 +939,7 @@
 	GL_SRC_ALPHA_SATURATE
 };
 
-KX_PYMETHODDEF_DOC( KX_BlenderMaterial, setBlending , "setBlending( GameLogic.src, GameLogic.dest)")
+KX_PYMETHODDEF_DOC( KX_BlenderMaterial, setBlending , "setBlending( bge.logic.src, bge.logic.dest)")
 {
 	unsigned int b[2];
 	if(PyArg_ParseTuple(args, "ii:setBlending", &b[0], &b[1]))

Modified: branches/soc-2010-nexyon/source/gameengine/Ketsji/KX_Camera.cpp
===================================================================
--- branches/soc-2010-nexyon/source/gameengine/Ketsji/KX_Camera.cpp	2010-08-11 12:09:56 UTC (rev 31235)
+++ branches/soc-2010-nexyon/source/gameengine/Ketsji/KX_Camera.cpp	2010-08-11 12:14:16 UTC (rev 31236)
@@ -553,8 +553,8 @@
 "\tcenter = the center of the sphere (in world coordinates.)\n"
 "\tradius = the radius of the sphere\n\n"
 "\tExample:\n"
-"\timport GameLogic\n\n"
-"\tco = GameLogic.getCurrentController()\n"
+"\timport bge.logic\n\n"
+"\tco = bge.logic.getCurrentController()\n"
 "\tcam = co.GetOwner()\n\n"
 "\t# A sphere of radius 4.0 located at [x, y, z] = [1.0, 1.0, 1.0]\n"
 "\tif (cam.sphereInsideFrustum([1.0, 1.0, 1.0], 4) != cam.OUTSIDE):\n"
@@ -586,8 +586,8 @@
 "\tinside/outside/intersects this camera's viewing frustum.\n\n"
 "\tbox = a list of the eight (8) corners of the box (in world coordinates.)\n\n"
 "\tExample:\n"
-"\timport GameLogic\n\n"
-"\tco = GameLogic.getCurrentController()\n"
+"\timport bge.logic\n\n"
+"\tco = bge.logic.getCurrentController()\n"
 "\tcam = co.GetOwner()\n\n"
 "\tbox = []\n"
 "\tbox.append([-1.0, -1.0, -1.0])\n"
@@ -630,8 +630,8 @@
 "\treturns 1 if the given point is inside this camera's viewing frustum.\n\n"
 "\tpoint = The point to test (in world coordinates.)\n\n"
 "\tExample:\n"
-"\timport GameLogic\n\n"
-"\tco = GameLogic.getCurrentController()\n"
+"\timport bge.logic\n\n"
+"\tco = bge.logic.getCurrentController()\n"
 "\tcam = co.GetOwner()\n\n"
 "\t# Test point [0.0, 0.0, 0.0]"
 "\tif (cam.pointInsideFrustum([0.0, 0.0, 0.0])):\n"

Modified: branches/soc-2010-nexyon/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
===================================================================
--- branches/soc-2010-nexyon/source/gameengine/Ketsji/KX_KetsjiEngine.cpp	2010-08-11 12:09:56 UTC (rev 31235)
+++ branches/soc-2010-nexyon/source/gameengine/Ketsji/KX_KetsjiEngine.cpp	2010-08-11 12:14:16 UTC (rev 31236)
@@ -235,7 +235,7 @@
 
 #ifndef DISABLE_PYTHON
 /*
- * At the moment the GameLogic module is imported into 'pythondictionary' after this function is called.
+ * At the moment the bge.logic module is imported into 'pythondictionary' after this function is called.
  * if this function ever changes to assign a copy, make sure the game logic module is imported into this dictionary before hand.
  */
 void KX_KetsjiEngine::SetPyNamespace(PyObject* pythondictionary)

Modified: branches/soc-2010-nexyon/source/gameengine/Ketsji/KX_PythonInit.cpp
===================================================================
--- branches/soc-2010-nexyon/source/gameengine/Ketsji/KX_PythonInit.cpp	2010-08-11 12:09:56 UTC (rev 31235)
+++ branches/soc-2010-nexyon/source/gameengine/Ketsji/KX_PythonInit.cpp	2010-08-11 12:14:16 UTC (rev 31236)
@@ -266,8 +266,8 @@
 }
 
 static char gPySaveGlobalDict_doc[] =
-"saveGlobalDict()\n\
-Saves GameLogic.globalDict to a file";
+	"saveGlobalDict()\n"
+	"Saves bge.logic.globalDict to a file";
 
 static PyObject* gPySaveGlobalDict(PyObject*)
 {
@@ -303,8 +303,8 @@
 }
 
 static char gPyLoadGlobalDict_doc[] =
-"LoadGlobalDict()\n\
-Loads GameLogic.globalDict from a file";
+	"LoadGlobalDict()\n"
+	"Loads bge.logic.globalDict from a file";
 
 static PyObject* gPyLoadGlobalDict(PyObject*)
 {
@@ -1225,7 +1225,7 @@
 // Initialization function for the module (*must* be called initGameLogic)
 
 static char GameLogic_module_documentation[] =
-"This is the Python API for the game engine of GameLogic"
+"This is the Python API for the game engine of bge.logic"
 ;
 
 static char Rasterizer_module_documentation[] =
@@ -1574,7 +1574,7 @@
 	// Check for errors
 	if (PyErr_Occurred())
     {
-		Py_FatalError("can't initialize module GameLogic");
+		Py_FatalError("can't initialize module bge.logic");
     }
 
 	return m;
@@ -1971,7 +1971,6 @@
 		PyDict_SetItemString(PyModule_GetDict(*gameLogic), "globalDict", pyGlobalDict); // Same as importing the module.
 
 	*gameLogic_keys = PyDict_Keys(PyModule_GetDict(*gameLogic));
-	PyDict_SetItemString(dictionaryobject, "GameLogic", *gameLogic); // Same as importing the module.
 
 	initGameKeys();
 	initPythonConstraintBinding();
@@ -1983,7 +1982,7 @@
 	initVideoTexture();
 
 	/* could be done a lot more nicely, but for now a quick way to get bge.* working */
-	PyRun_SimpleString("sys = __import__('sys');mod = sys.modules['bge'] = type(sys)('bge');mod.__dict__.update({'logic':__import__('GameLogic'), 'render':__import__('Rasterizer'), 'events':__import__('GameKeys'), 'constraints':__import__('PhysicsConstraints'), 'types':__import__('GameTypes')})");
+	PyRun_SimpleString("sys = __import__('sys');mod = sys.modules['bge'] = type(sys)('bge');mod.__dict__.update({'logic':__import__('GameLogic'), 'render':__import__('Rasterizer'), 'events':__import__('GameKeys'), 'constraints':__import__('PhysicsConstraints'), 'types':__import__('GameTypes')});import bge");
 }
 
 static struct PyModuleDef Rasterizer_module_def = {
@@ -2331,15 +2330,15 @@
 				memcpy(*marshal_buffer, marshal_cstring, marshal_length);
 				Py_DECREF(pyGlobalDictMarshal);
 			} else {
-				printf("Error, GameLogic.globalDict could not be marshal'd\n");
+				printf("Error, bge.logic.globalDict could not be marshal'd\n");
 			}
 		} else {
-			printf("Error, GameLogic.globalDict was removed\n");
+			printf("Error, bge.logic.globalDict was removed\n");
 		}
 		Py_DECREF(gameLogic);
 	} else {
 		PyErr_Clear();
-		printf("Error, GameLogic failed to import GameLogic.globalDict will be lost\n");
+		printf("Error, bge.logic failed to import bge.logic.globalDict will be lost\n");
 	}
 	return marshal_length;
 }
@@ -2371,7 +2370,7 @@
 			}
 		} else {
 			PyErr_Clear();
-			printf("Error, GameLogic failed to import GameLogic.globalDict will be lost\n");
+			printf("Error, bge.logic failed to import bge.logic.globalDict will be lost\n");
 		}	
 	}
 	return 0;





More information about the Bf-blender-cvs mailing list