BGE: python API cleanup - bge submodules definitions
This commit is contained in:
@@ -1568,15 +1568,12 @@ static struct PyModuleDef GameLogic_module_def = {
|
||||
0, /* m_free */
|
||||
};
|
||||
|
||||
PyObject *initGameLogic(KX_KetsjiEngine *engine, KX_Scene* scene) // quick hack to get gravity hook
|
||||
PyMODINIT_FUNC initGameLogicPythonBinding()
|
||||
{
|
||||
PyObject *m;
|
||||
PyObject *d;
|
||||
PyObject *item; /* temp PyObject *storage */
|
||||
|
||||
gp_KetsjiEngine = engine;
|
||||
gp_KetsjiScene = scene;
|
||||
|
||||
gUseVisibilityTemp=false;
|
||||
|
||||
PyObjectPlus::ClearDeprecationWarning(); /* Not that nice to call here but makes sure warnings are reset between loading scenes */
|
||||
@@ -2257,19 +2254,24 @@ void setupGamePython(KX_KetsjiEngine* ketsjiengine, KX_Scene *startscene, Main *
|
||||
dictionaryobject= initGamePythonScripting(blenderdata);
|
||||
|
||||
ketsjiengine->SetPyNamespace(dictionaryobject);
|
||||
initRasterizer(ketsjiengine->GetRasterizer(), ketsjiengine->GetCanvas());
|
||||
*gameLogic = initGameLogic(ketsjiengine, startscene);
|
||||
gp_Canvas = ketsjiengine->GetCanvas();
|
||||
gp_Rasterizer = ketsjiengine->GetRasterizer();
|
||||
gp_KetsjiEngine = ketsjiengine;
|
||||
gp_KetsjiScene = startscene;
|
||||
|
||||
/* is set in initGameLogic so only set here if we want it to persist between scenes */
|
||||
initGameLogicPythonBinding();
|
||||
initRasterizerPythonBinding();
|
||||
initGameKeysPythonBinding();
|
||||
initConstraintPythonBinding();
|
||||
initVideoTexturePythonBinding();
|
||||
|
||||
*gameLogic = PyDict_GetItemString(PyImport_GetModuleDict(), "GameLogic");
|
||||
/* is set in initGameLogicPythonBinding so only set here if we want it to persist between scenes */
|
||||
if (pyGlobalDict)
|
||||
PyDict_SetItemString(PyModule_GetDict(*gameLogic), "globalDict", pyGlobalDict); // Same as importing the module.
|
||||
|
||||
*gameLogic_keys = PyDict_Keys(PyModule_GetDict(*gameLogic));
|
||||
|
||||
initGameKeys();
|
||||
initPythonConstraintBinding();
|
||||
initVideoTexture();
|
||||
|
||||
/* could be done a lot more nicely, but for now a quick way to get bge.* working */
|
||||
PyRun_SimpleString("sys = __import__('sys');"
|
||||
"bge = type(sys)('bge');"
|
||||
@@ -2293,7 +2295,7 @@ void setupGamePython(KX_KetsjiEngine* ketsjiengine, KX_Scene *startscene, Main *
|
||||
}
|
||||
|
||||
static struct PyModuleDef Rasterizer_module_def = {
|
||||
{}, /* m_base */
|
||||
PyModuleDef_HEAD_INIT,
|
||||
"Rasterizer", /* m_name */
|
||||
Rasterizer_module_documentation, /* m_doc */
|
||||
0, /* m_size */
|
||||
@@ -2304,11 +2306,8 @@ static struct PyModuleDef Rasterizer_module_def = {
|
||||
0, /* m_free */
|
||||
};
|
||||
|
||||
PyObject *initRasterizer(RAS_IRasterizer* rasty,RAS_ICanvas* canvas)
|
||||
PyMODINIT_FUNC initRasterizerPythonBinding()
|
||||
{
|
||||
gp_Canvas = canvas;
|
||||
gp_Rasterizer = rasty;
|
||||
|
||||
PyObject *m;
|
||||
PyObject *d;
|
||||
|
||||
@@ -2358,7 +2357,7 @@ PyObject *initRasterizer(RAS_IRasterizer* rasty,RAS_ICanvas* canvas)
|
||||
Py_FatalError("can't initialize module Rasterizer");
|
||||
}
|
||||
|
||||
return d;
|
||||
return m;
|
||||
}
|
||||
|
||||
|
||||
@@ -2432,7 +2431,7 @@ static struct PyMethodDef gamekeys_methods[] = {
|
||||
};
|
||||
|
||||
static struct PyModuleDef GameKeys_module_def = {
|
||||
{}, /* m_base */
|
||||
PyModuleDef_HEAD_INIT,
|
||||
"GameKeys", /* m_name */
|
||||
GameKeys_module_documentation, /* m_doc */
|
||||
0, /* m_size */
|
||||
@@ -2443,7 +2442,7 @@ static struct PyModuleDef GameKeys_module_def = {
|
||||
0, /* m_free */
|
||||
};
|
||||
|
||||
PyObject *initGameKeys()
|
||||
PyMODINIT_FUNC initGameKeysPythonBinding()
|
||||
{
|
||||
PyObject *m;
|
||||
PyObject *d;
|
||||
@@ -2605,7 +2604,7 @@ PyObject *initGameKeys()
|
||||
Py_FatalError("can't initialize module GameKeys");
|
||||
}
|
||||
|
||||
return d;
|
||||
return m;
|
||||
}
|
||||
|
||||
// utility function for loading and saving the globalDict
|
||||
|
||||
Reference in New Issue
Block a user