Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2009-02-28 02:53:09 +0300
committerCampbell Barton <ideasman42@gmail.com>2009-02-28 02:53:09 +0300
commit8d3dcfb104bcfc4fa9fdfecaa8e5c8fd9a900e98 (patch)
tree0fa6ffbaff90c088e346a14a2462796d5c0735fb /source/gameengine/Ketsji/KX_PythonInit.cpp
parente872843c85434efad2c1a082c4ecad2008ab1ef5 (diff)
BGE Python API
* Scene's and GameObjects can now be printed (raised an exception) * Added GameLogic.getSceneList()
Diffstat (limited to 'source/gameengine/Ketsji/KX_PythonInit.cpp')
-rw-r--r--source/gameengine/Ketsji/KX_PythonInit.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp
index b3e8d15189f..93f57986181 100644
--- a/source/gameengine/Ketsji/KX_PythonInit.cpp
+++ b/source/gameengine/Ketsji/KX_PythonInit.cpp
@@ -329,6 +329,32 @@ static PyObject* gPyGetCurrentScene(PyObject* self)
return (PyObject*) gp_KetsjiScene;
}
+static STR_String gPyGetSceneList_doc =
+"getSceneList()\n"
+"Return a list of converted scenes.\n";
+static PyObject* gPyGetSceneList(PyObject* self)
+{
+ KX_KetsjiEngine* m_engine = KX_GetActiveEngine();
+ //CListValue* list = new CListValue();
+ PyObject* list;
+ KX_SceneList* scenes = m_engine->CurrentScenes();
+ int numScenes = scenes->size();
+ int i;
+
+ list = PyList_New(numScenes);
+
+ for (i=0;i<numScenes;i++)
+ {
+ KX_Scene* scene = scenes->at(i);
+ //list->Add(scene);
+ PyList_SET_ITEM(list, i, scene);
+ Py_INCREF(scene);
+
+ }
+
+ return (PyObject*)list;
+}
+
static PyObject *pyPrintExt(PyObject *,PyObject *,PyObject *)
{
#define pprint(x) std::cout << x << std::endl;
@@ -408,6 +434,8 @@ static struct PyMethodDef game_methods[] = {
METH_NOARGS, (PY_METHODCHAR)SCA_PythonController::sPyGetCurrentController__doc__},
{"getCurrentScene", (PyCFunction) gPyGetCurrentScene,
METH_NOARGS, (PY_METHODCHAR)gPyGetCurrentScene_doc.Ptr()},
+ {"getSceneList", (PyCFunction) gPyGetSceneList,
+ METH_NOARGS, (PY_METHODCHAR)gPyGetSceneList_doc.Ptr()},
{"addActiveActuator",(PyCFunction) SCA_PythonController::sPyAddActiveActuator,
METH_VARARGS, (PY_METHODCHAR)SCA_PythonController::sPyAddActiveActuator__doc__},
{"getRandomFloat",(PyCFunction) gPyGetRandomFloat,