diff options
Diffstat (limited to 'source/gameengine/GamePlayer')
6 files changed, 34 insertions, 14 deletions
diff --git a/source/gameengine/GamePlayer/common/SConscript b/source/gameengine/GamePlayer/common/SConscript index b8fb9cbd2e2..dc105491c98 100644 --- a/source/gameengine/GamePlayer/common/SConscript +++ b/source/gameengine/GamePlayer/common/SConscript @@ -68,7 +68,8 @@ incs = [ '#/intern/glew-mx', ] -defs = env['BF_GL_DEFINITIONS'] +defs = [] +defs += env['BF_GL_DEFINITIONS'] if env['WITH_BF_PYTHON']: incs.extend(Split(env['BF_PYTHON_INC'])) diff --git a/source/gameengine/GamePlayer/ghost/CMakeLists.txt b/source/gameengine/GamePlayer/ghost/CMakeLists.txt index 48938b11cb9..283f222115c 100644 --- a/source/gameengine/GamePlayer/ghost/CMakeLists.txt +++ b/source/gameengine/GamePlayer/ghost/CMakeLists.txt @@ -42,6 +42,7 @@ set(INC ../../../blender/blenkernel ../../../blender/blenlib ../../../blender/blenloader + ../../../blender/blentranslation ../../../blender/gpu ../../../blender/imbuf ../../../blender/makesdna diff --git a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp index c3eb07d18a1..2b357f43031 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp @@ -112,6 +112,7 @@ GPG_Application::GPG_Application(GHOST_ISystem* system) : m_startSceneName(""), m_startScene(0), m_maggie(0), + m_kxStartScene(NULL), m_exitRequested(0), m_system(system), m_mainWindow(0), @@ -714,7 +715,7 @@ bool GPG_Application::startEngine(void) m_sceneconverter = new KX_BlenderSceneConverter(m_maggie, m_ketsjiengine); if (m_sceneconverter) { - STR_String startscenename = m_startSceneName.Ptr(); + STR_String m_kxStartScenename = m_startSceneName.Ptr(); m_ketsjiengine->SetSceneConverter(m_sceneconverter); // if (always_use_expand_framing) @@ -726,17 +727,17 @@ bool GPG_Application::startEngine(void) if (m_startScene->gm.flag & GAME_NO_MATERIAL_CACHING) m_sceneconverter->SetCacheMaterials(false); - KX_Scene* startscene = new KX_Scene(m_keyboard, + m_kxStartScene = new KX_Scene(m_keyboard, m_mouse, m_networkdevice, - startscenename, + m_kxStartScenename, m_startScene, m_canvas); #ifdef WITH_PYTHON // some python things PyObject *gameLogic, *gameLogic_keys; - setupGamePython(m_ketsjiengine, startscene, m_maggie, NULL, &gameLogic, &gameLogic_keys, m_argc, m_argv); + setupGamePython(m_ketsjiengine, m_kxStartScene, m_maggie, NULL, &gameLogic, &gameLogic_keys, m_argc, m_argv); #endif // WITH_PYTHON //initialize Dome Settings @@ -755,10 +756,10 @@ bool GPG_Application::startEngine(void) loadGamePythonConfig(m_pyGlobalDictString, m_pyGlobalDictString_Length); #endif m_sceneconverter->ConvertScene( - startscene, + m_kxStartScene, m_rasterizer, m_canvas); - m_ketsjiengine->AddScene(startscene); + m_ketsjiengine->AddScene(m_kxStartScene); // Create a timer that is used to kick the engine if (!m_frameTimer) { @@ -771,7 +772,7 @@ bool GPG_Application::startEngine(void) // Set the animation playback rate for ipo's and actions // the framerate below should patch with FPS macro defined in blendef.h // Could be in StartEngine set the framerate, we need the scene to do this - Scene *scene= startscene->GetBlenderScene(); // needed for macro + Scene *scene= m_kxStartScene->GetBlenderScene(); // needed for macro m_ketsjiengine->SetAnimFrameRate(FPS); } diff --git a/source/gameengine/GamePlayer/ghost/GPG_Application.h b/source/gameengine/GamePlayer/ghost/GPG_Application.h index 2d21b50e664..b6f545c2de8 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_Application.h +++ b/source/gameengine/GamePlayer/ghost/GPG_Application.h @@ -40,6 +40,7 @@ #include "KX_KetsjiEngine.h" class KX_KetsjiEngine; +class KX_Scene; class KX_ISceneConverter; class NG_LoopBackNetworkDeviceInterface; class RAS_IRasterizer; @@ -83,6 +84,12 @@ public: int getExitRequested(void); const STR_String& getExitString(void); GlobalSettings* getGlobalSettings(void); + + inline KX_Scene *GetStartScene() const + { + return m_kxStartScene; + } + bool StartGameEngine(int stereoMode); void StopGameEngine(); void EngineNextFrame(); @@ -118,6 +125,7 @@ protected: STR_String m_startSceneName; struct Scene* m_startScene; struct Main* m_maggie; + KX_Scene *m_kxStartScene; /* Exit state. */ int m_exitRequested; diff --git a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp index a56d5b6d027..137f4cd6bc8 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp @@ -43,6 +43,7 @@ #include "KX_KetsjiEngine.h" #include "KX_PythonInit.h" #include "KX_PythonMain.h" +#include "KX_PyConstraintBinding.h" // for PHY_SetActiveEnvironment /********************************** * Begin Blender include block @@ -87,7 +88,8 @@ extern "C" // For BLF #include "BLF_api.h" -#include "BLF_translation.h" +#include "BLT_translation.h" +#include "BLT_lang.h" extern int datatoc_bfont_ttf_size; extern char datatoc_bfont_ttf[]; extern int datatoc_bmonofont_ttf_size; @@ -472,8 +474,8 @@ int main(int argc, char** argv) // Setup builtin font for BLF (mostly copied from creator.c, wm_init_exit.c and interface_style.c) BLF_init(11, U.dpi); - BLF_lang_init(); - BLF_lang_set(""); + BLT_lang_init(); + BLT_lang_set(""); BLF_load_mem("default", (unsigned char*)datatoc_bfont_ttf, datatoc_bfont_ttf_size); if (blf_mono_font == -1) @@ -853,7 +855,7 @@ int main(int argc, char** argv) get_filename(argc_py_clamped, argv, filename); if (filename[0]) - BLI_path_cwd(filename); + BLI_path_cwd(filename, sizeof(filename)); // fill the GlobalSettings with the first scene files @@ -1079,6 +1081,11 @@ int main(int argc, char** argv) char *python_code = KX_GetPythonCode(maggie, python_main); if (python_code) { #ifdef WITH_PYTHON + // Set python environement variable. + KX_Scene *startscene = app.GetStartScene(); + KX_SetActiveScene(startscene); + PHY_SetActiveEnvironment(startscene->GetPhysicsEnvironment()); + gpg_nextframestate.system = system; gpg_nextframestate.app = &app; gpg_nextframestate.gs = &gs; @@ -1140,7 +1147,7 @@ int main(int argc, char** argv) #ifdef WITH_INTERNATIONAL BLF_free_unifont(); BLF_free_unifont_mono(); - BLF_lang_free(); + BLT_lang_free(); #endif IMB_exit(); diff --git a/source/gameengine/GamePlayer/ghost/SConscript b/source/gameengine/GamePlayer/ghost/SConscript index c31bd0c2f08..be9f50f40fb 100644 --- a/source/gameengine/GamePlayer/ghost/SConscript +++ b/source/gameengine/GamePlayer/ghost/SConscript @@ -52,6 +52,7 @@ incs = [ '#source/blender/blenfont', '#source/blender/blenlib', '#source/blender/blenkernel', + '#source/blender/blentranslation', '#source/blender', '#source/blender/include', '#source/blender/makesdna', @@ -74,7 +75,8 @@ incs = [ incs.append(env['BF_PTHREADS_INC']) incs.append(env['BF_BOOST_INC']) -defs = env['BF_GL_DEFINITIONS'] +defs = [] +defs += env['BF_GL_DEFINITIONS'] if env['WITH_BF_PYTHON']: incs += Split(env['BF_PYTHON_INC']) |