diff options
author | Ines Almeida <britalmeida@gmail.com> | 2015-02-09 23:56:38 +0300 |
---|---|---|
committer | Ines Almeida <britalmeida@gmail.com> | 2015-02-09 23:56:38 +0300 |
commit | a088b9488d1be7388ddff34c0708616643900940 (patch) | |
tree | 733c11413999533ba674e795e873061513a6055c /source/gameengine/Ketsji/KX_PyConstraintBinding.cpp | |
parent | 31e26bb83bd0a538c76fd8bb6ebce65027dde94c (diff) |
Recreating bge python modules instead of using existing
All of the initXPythonBinding functions are changed to always creating the module instead of importing if previously existing.
I can instead only remove the module return when the import is ok, so that it always inits. But then, I don't see the point in importing.
I make sure that these functions are called only once per run, inside initBGE.
This was not the case with GameTypes. I moved initPyTypes inside of initGameTypesPythonBinding due to that.
I reorganized initGamePlayerPythonScripting and initGamePythonScripting so that they run things in the same order.
initGamePlayerPythonScripting imports mathutils and aud, the other only aud. Shouldn't it be the same for both?
Reviewers: campbellbarton
Subscribers: sybren
Projects: #game_engine, #game_python
Differential Revision: https://developer.blender.org/D1070
Diffstat (limited to 'source/gameengine/Ketsji/KX_PyConstraintBinding.cpp')
-rw-r--r-- | source/gameengine/Ketsji/KX_PyConstraintBinding.cpp | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp b/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp index ccb80fac05d..1b69eab8e28 100644 --- a/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp +++ b/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp @@ -753,19 +753,8 @@ PyMODINIT_FUNC initConstraintPythonBinding() PyObject *d; PyObject *item; - /* Use existing module where possible - * be careful not to init any runtime vars after this */ - m = PyImport_ImportModule( "PhysicsConstraints" ); - if (m) { - Py_DECREF(m); - return m; - } - else { - PyErr_Clear(); - - m = PyModule_Create(&PhysicsConstraints_module_def); - PyDict_SetItemString(PySys_GetObject("modules"), PhysicsConstraints_module_def.m_name, m); - } + m = PyModule_Create(&PhysicsConstraints_module_def); + PyDict_SetItemString(PySys_GetObject("modules"), PhysicsConstraints_module_def.m_name, m); // Add some symbolic constants to the module d = PyModule_GetDict(m); |