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/VideoTexture | |
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/VideoTexture')
-rw-r--r-- | source/gameengine/VideoTexture/blendVideoTex.cpp | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/source/gameengine/VideoTexture/blendVideoTex.cpp b/source/gameengine/VideoTexture/blendVideoTex.cpp index 50b973d76f3..6c9294873a6 100644 --- a/source/gameengine/VideoTexture/blendVideoTex.cpp +++ b/source/gameengine/VideoTexture/blendVideoTex.cpp @@ -191,20 +191,9 @@ PyMODINIT_FUNC initVideoTexturePythonBinding(void) if (PyType_Ready(&TextureType) < 0) return NULL; - /* Use existing module where possible - * be careful not to init any runtime vars after this */ - m = PyImport_ImportModule( "VideoTexture" ); - if (m) { - Py_DECREF(m); - return m; - } - else { - PyErr_Clear(); - - m = PyModule_Create(&VideoTexture_module_def); - PyDict_SetItemString(PySys_GetObject("modules"), VideoTexture_module_def.m_name, m); - } - + m = PyModule_Create(&VideoTexture_module_def); + PyDict_SetItemString(PySys_GetObject("modules"), VideoTexture_module_def.m_name, m); + if (m == NULL) return NULL; |