diff options
author | Benoit Bolsee <benoit.bolsee@online.be> | 2010-01-30 21:23:13 +0300 |
---|---|---|
committer | Benoit Bolsee <benoit.bolsee@online.be> | 2010-01-30 21:23:13 +0300 |
commit | cfdd53a4f8e7e80754fd1c6c796bf4410a0213a5 (patch) | |
tree | 5be1cfe234713339ef4e9075e0c39d6e6db0c4ef /source/gameengine/Ketsji/KX_Scene.cpp | |
parent | 0c899f7ded58ef25e29bb60d393b101c40a6ccc5 (diff) |
BGE: patch #20399 Python control over adding/removing scenes.
Diffstat (limited to 'source/gameengine/Ketsji/KX_Scene.cpp')
-rw-r--r-- | source/gameengine/Ketsji/KX_Scene.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/source/gameengine/Ketsji/KX_Scene.cpp b/source/gameengine/Ketsji/KX_Scene.cpp index c8c5b33693b..4d25b2742d7 100644 --- a/source/gameengine/Ketsji/KX_Scene.cpp +++ b/source/gameengine/Ketsji/KX_Scene.cpp @@ -33,6 +33,7 @@ #endif //WIN32 #include "KX_Scene.h" +#include "KX_PythonInit.h" #include "MT_assert.h" #include "KX_KetsjiEngine.h" #include "KX_BlenderMaterial.h" @@ -1864,6 +1865,9 @@ PyTypeObject KX_Scene::Type = { PyMethodDef KX_Scene::Methods[] = { KX_PYMETHODTABLE(KX_Scene, addObject), + KX_PYMETHODTABLE(KX_Scene, end), + KX_PYMETHODTABLE(KX_Scene, restart), + KX_PYMETHODTABLE(KX_Scene, replace), /* dict style access */ KX_PYMETHODTABLE(KX_Scene, get), @@ -2136,6 +2140,39 @@ KX_PYMETHODDEF_DOC(KX_Scene, addObject, return replica->GetProxy(); } +KX_PYMETHODDEF_DOC(KX_Scene, end, +"end()\n" +"Removes this scene from the game.\n") +{ + + KX_GetActiveEngine()->RemoveScene(m_sceneName); + + Py_RETURN_NONE; +} + +KX_PYMETHODDEF_DOC(KX_Scene, restart, + "restart()\n" + "Restarts this scene.\n") +{ + KX_GetActiveEngine()->ReplaceScene(m_sceneName, m_sceneName); + + Py_RETURN_NONE; +} + +KX_PYMETHODDEF_DOC(KX_Scene, replace, + "replace(newScene)\n" + "Replaces this scene with another one.\n") +{ + char* name; + + if (!PyArg_ParseTuple(args, "s:replace", &name)) + return NULL; + + KX_GetActiveEngine()->ReplaceScene(m_sceneName, name); + + Py_RETURN_NONE; +} + /* Matches python dict.get(key, [default]) */ KX_PYMETHODDEF_DOC(KX_Scene, get, "") { |