diff options
author | Benoit Bolsee <benoit.bolsee@online.be> | 2012-09-02 01:23:05 +0400 |
---|---|---|
committer | Benoit Bolsee <benoit.bolsee@online.be> | 2012-09-02 01:23:05 +0400 |
commit | 53f343edd785f346dccdf39dedfe7626260b63a5 (patch) | |
tree | a9c3ac907eae3dd1247168e4cd9dff2760669b27 /source/gameengine/Ketsji/KX_PythonInit.cpp | |
parent | 779ecb06dd3f3b5c47391675622fb96d041b23ae (diff) |
..\commmit_hive.txt
Diffstat (limited to 'source/gameengine/Ketsji/KX_PythonInit.cpp')
-rw-r--r-- | source/gameengine/Ketsji/KX_PythonInit.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp index 581b3712f97..86928803502 100644 --- a/source/gameengine/Ketsji/KX_PythonInit.cpp +++ b/source/gameengine/Ketsji/KX_PythonInit.cpp @@ -811,6 +811,23 @@ static PyObject *gLibList(PyObject*, PyObject* args) return list; } +struct PyNextFrameState pynextframestate; +static PyObject *gPyNextFrame(PyObject *) +{ + if (pynextframestate.func == NULL) Py_RETURN_NONE; + if (pynextframestate.state == NULL) Py_RETURN_NONE; //should never happen; raise exception instead? + + if (pynextframestate.func(pynextframestate.state)) //nonzero = stop + { + Py_RETURN_TRUE; + } + else // 0 = go on + { + Py_RETURN_FALSE; + } +} + + static struct PyMethodDef game_methods[] = { {"expandPath", (PyCFunction)gPyExpandPath, METH_VARARGS, (const char *)gPyExpandPath_doc}, {"startGame", (PyCFunction)gPyStartGame, METH_VARARGS, (const char *)gPyStartGame_doc}, @@ -840,7 +857,7 @@ static struct PyMethodDef game_methods[] = { {"getBlendFileList", (PyCFunction)gPyGetBlendFileList, METH_VARARGS, (const char *)"Gets a list of blend files in the same directory as the current blend file"}, {"PrintGLInfo", (PyCFunction)pyPrintExt, METH_NOARGS, (const char *)"Prints GL Extension Info"}, {"PrintMemInfo", (PyCFunction)pyPrintStats, METH_NOARGS, (const char *)"Print engine statistics"}, - + {"NextFrame", (PyCFunction)gPyNextFrame, METH_NOARGS, (const char *)"Render next frame (if Python has control)"}, /* library functions */ {"LibLoad", (PyCFunction)gLibLoad, METH_VARARGS|METH_KEYWORDS, (const char *)""}, {"LibNew", (PyCFunction)gLibNew, METH_VARARGS, (const char *)""}, |