BGE: python API cleanup - bge submodules definitions
This commit is contained in:
@@ -734,7 +734,7 @@ static struct PyMethodDef physicsconstraints_methods[] = {
|
||||
};
|
||||
|
||||
static struct PyModuleDef PhysicsConstraints_module_def = {
|
||||
{}, /* m_base */
|
||||
PyModuleDef_HEAD_INIT,
|
||||
"PhysicsConstraints", /* m_name */
|
||||
PhysicsConstraints_module_documentation, /* m_doc */
|
||||
0, /* m_size */
|
||||
@@ -745,7 +745,7 @@ static struct PyModuleDef PhysicsConstraints_module_def = {
|
||||
0, /* m_free */
|
||||
};
|
||||
|
||||
PyObject *initPythonConstraintBinding()
|
||||
PyMODINIT_FUNC initConstraintPythonBinding()
|
||||
{
|
||||
|
||||
PyObject *ErrorObject;
|
||||
@@ -804,7 +804,7 @@ PyObject *initPythonConstraintBinding()
|
||||
Py_FatalError("can't initialize module PhysicsConstraints");
|
||||
}
|
||||
|
||||
return d;
|
||||
return m;
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
@@ -36,7 +36,8 @@
|
||||
|
||||
#include <Python.h>
|
||||
|
||||
PyObject* initPythonConstraintBinding();
|
||||
PyMODINIT_FUNC initConstraintPythonBinding();
|
||||
|
||||
void PHY_SetActiveEnvironment(class PHY_IPhysicsEnvironment* env);
|
||||
PHY_IPhysicsEnvironment* PHY_GetActiveEnvironment();
|
||||
#endif /* WITH_PYTHON */
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -36,6 +36,9 @@
|
||||
#include "STR_String.h"
|
||||
#include "MT_Vector3.h"
|
||||
|
||||
class KX_KetsjiEngine;
|
||||
class KX_Scene;
|
||||
|
||||
typedef enum {
|
||||
psl_Lowest = 0,
|
||||
psl_Highest,
|
||||
@@ -44,10 +47,10 @@ typedef enum {
|
||||
extern bool gUseVisibilityTemp;
|
||||
|
||||
#ifdef WITH_PYTHON
|
||||
PyObject *initGameLogic(class KX_KetsjiEngine *engine, class KX_Scene *ketsjiscene);
|
||||
PyObject *initGameKeys();
|
||||
PyObject *initRasterizer(class RAS_IRasterizer *rasty,class RAS_ICanvas *canvas);
|
||||
PyObject *initVideoTexture(void);
|
||||
PyMODINIT_FUNC initGameLogicPythonBinding(void);
|
||||
PyMODINIT_FUNC initGameKeysPythonBinding(void);
|
||||
PyMODINIT_FUNC initRasterizerPythonBinding(void);
|
||||
PyMODINIT_FUNC initVideoTexturePythonBinding(void);
|
||||
PyObject *initGamePlayerPythonScripting(struct Main *maggie, int argc, char **argv);
|
||||
PyObject *initGamePythonScripting(struct Main *maggie);
|
||||
|
||||
@@ -68,9 +71,9 @@ void removeImportMain(struct Main *maggie);
|
||||
class KX_KetsjiEngine;
|
||||
class KX_Scene;
|
||||
|
||||
void KX_SetActiveScene(class KX_Scene *scene);
|
||||
class KX_Scene *KX_GetActiveScene();
|
||||
class KX_KetsjiEngine *KX_GetActiveEngine();
|
||||
void KX_SetActiveScene(KX_Scene *scene);
|
||||
KX_Scene *KX_GetActiveScene();
|
||||
KX_KetsjiEngine *KX_GetActiveEngine();
|
||||
|
||||
typedef int (*PyNextFrameFunc)(void *);
|
||||
|
||||
|
||||
@@ -162,7 +162,7 @@ PyDoc_STRVAR(VideoTexture_module_documentation,
|
||||
);
|
||||
|
||||
static struct PyModuleDef VideoTexture_module_def = {
|
||||
{}, /* m_base */
|
||||
PyModuleDef_HEAD_INIT,
|
||||
"VideoTexture", /* m_name */
|
||||
VideoTexture_module_documentation, /* m_doc */
|
||||
0, /* m_size */
|
||||
@@ -173,7 +173,7 @@ static struct PyModuleDef VideoTexture_module_def = {
|
||||
0, /* m_free */
|
||||
};
|
||||
|
||||
PyObject *initVideoTexture(void)
|
||||
PyMODINIT_FUNC initVideoTexturePythonBinding(void)
|
||||
{
|
||||
PyObject *m;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user