Revision: 15561
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=15561
Author:   campbellbarton
Date:     2008-07-14 02:47:07 +0200 (Mon, 14 Jul 2008)

Log Message:
-----------
importing the GameLogic module was being done by adding the text "import 
GameLogic" to the start of all scripts used in the game engine, this meant 
every error line number was off by 1 (quite annoying). better to do this to the 
dictionary that the scripts run with.

Modified Paths:
--------------
    trunk/blender/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
    trunk/blender/source/gameengine/GameLogic/SCA_PythonController.cpp

Modified: 
trunk/blender/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
===================================================================
--- trunk/blender/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp     
2008-07-13 21:07:44 UTC (rev 15560)
+++ trunk/blender/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp     
2008-07-14 00:47:07 UTC (rev 15561)
@@ -332,6 +332,7 @@
                        ketsjiengine->SetPythonDictionary(dictionaryobject);
                        initRasterizer(rasterizer, canvas);
                        PyObject *gameLogic = initGameLogic(startscene);
+                       PyDict_SetItemString(dictionaryobject, "GameLogic", 
gameLogic); // Same as importing the module.
                        initGameKeys();
                        initPythonConstraintBinding();
 
@@ -591,6 +592,7 @@
                        ketsjiengine->SetPythonDictionary(dictionaryobject);
                        initRasterizer(rasterizer, canvas);
                        PyObject *gameLogic = initGameLogic(startscene);
+                       PyDict_SetItemString(dictionaryobject, "GameLogic", 
gameLogic); // Same as importing the module
                        initGameKeys();
                        initPythonConstraintBinding();
 

Modified: trunk/blender/source/gameengine/GameLogic/SCA_PythonController.cpp
===================================================================
--- trunk/blender/source/gameengine/GameLogic/SCA_PythonController.cpp  
2008-07-13 21:07:44 UTC (rev 15560)
+++ trunk/blender/source/gameengine/GameLogic/SCA_PythonController.cpp  
2008-07-14 00:47:07 UTC (rev 15561)
@@ -116,7 +116,7 @@
 
 void SCA_PythonController::SetScriptText(const STR_String& text)
 { 
-       m_scriptText = "import GameLogic\n" + text;
+       m_scriptText = text;
        m_bModified = true;
 }
 
@@ -354,8 +354,10 @@
                        return sensor->AddRef();
                }
        }
-               
-       PyErr_SetString(PyExc_AttributeError, "Unable to find requested 
sensor");
+       
+       char emsg[96];
+       PyOS_snprintf( emsg, sizeof( emsg ), "Unable to find requested sensor 
\"%s\"", scriptArg );
+       PyErr_SetString(PyExc_AttributeError, emsg);
        return NULL;
 }
 
@@ -382,8 +384,10 @@
                        return actua->AddRef();
                }
        }
-               
-       PyErr_SetString(PyExc_AttributeError, "Unable to find requested 
actuator");
+       
+       char emsg[96];
+       PyOS_snprintf( emsg, sizeof( emsg ), "Unable to find requested actuator 
\"%s\"", scriptArg );
+       PyErr_SetString(PyExc_AttributeError, emsg);
        return NULL;
 }
 


_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to