Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDalai Felinto <dfelinto@gmail.com>2011-09-11 09:54:07 +0400
committerDalai Felinto <dfelinto@gmail.com>2011-09-11 09:54:07 +0400
commit5184476fe1bd6c61a50a047bdba1f4b9756f323c (patch)
tree44b5d4c1377682b532a151c926c92f2cde6b9278 /source/gameengine/GamePlayer/ghost/GPG_Application.cpp
parentcfa83b0888075996664e3614b4f6392139de8996 (diff)
bugfix: [bf-blender-Game Engine][28167] Restart game actuator don't get changed material mode
http://projects.blender.org/tracker/?func=detail&aid=28167&group_id=9&atid=306 Game Actuator (restart or load a new file) will not keep some settings alive (as we had in 2.49). In 2.49 the solution used was to use Blender globals (G.fileflags) to get/set those settings. That was causing the blender file to change if you change the material mode from the game. In 2.5 this never worked, and the implementation was buggy (it's relying in the scene settings, which get reset ever time we restart/load a new file). My idea for fixing this is to create a new struct (GlobalSettings) where we store any setting to be preserver during the course of the game. This is specially important for options that require the game to restart/load new file (graphic ones). But it later can be expanded to support other things such as audio settings (e.g. volume), ... I'm also planning to expand it for stereo and dome settings, but I prefer to first get this committed and then build a new patch on top of that. I had some problems in finding a correct way for build/link the blenderplayer changes, so although it's working I'm not sure this is the best code (e.g. I couldn't make forward declaration to work in GPG_Application.h for the struct GlobalSettings so I ended up including KX_KetsjiEngine.h) [note: I talked with Brecht and he find this is an ok solution. He implemented it originally so it's good to have his go. However I still think there must be a way to make forward declaration to work. I will see with other devs if there is a better solution] [also I'm likely renaming glsl to flags later if there are more settings stored in the flags to be used. But for now we are only handling glsl flags]
Diffstat (limited to 'source/gameengine/GamePlayer/ghost/GPG_Application.cpp')
-rw-r--r--source/gameengine/GamePlayer/ghost/GPG_Application.cpp20
1 files changed, 16 insertions, 4 deletions
diff --git a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp
index 5bc6093a9ff..7b47d74d424 100644
--- a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp
+++ b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp
@@ -151,7 +151,7 @@ GPG_Application::~GPG_Application(void)
-bool GPG_Application::SetGameEngineData(struct Main* maggie, Scene *scene, int argc, char **argv)
+bool GPG_Application::SetGameEngineData(struct Main* maggie, Scene *scene, GlobalSettings *gs, int argc, char **argv)
{
bool result = false;
@@ -168,6 +168,9 @@ bool GPG_Application::SetGameEngineData(struct Main* maggie, Scene *scene, int a
m_argc= argc;
m_argv= argv;
+ /* Global Settings */
+ m_globalSettings= gs;
+
return result;
}
@@ -511,6 +514,12 @@ int GPG_Application::getExitRequested(void)
}
+GlobalSettings* GPG_Application::getGlobalSettings(void)
+{
+ return m_ketsjiengine->GetGlobalSettings();
+}
+
+
const STR_String& GPG_Application::getExitString(void)
{
@@ -552,7 +561,7 @@ bool GPG_Application::initEngine(GHOST_IWindow* window, const int stereoMode)
if(GPU_glsl_support())
m_blenderglslmat = (SYS_GetCommandLineInt(syshandle, "blender_glsl_material", 1) != 0);
- else if(gm->matmode == GAME_MAT_GLSL)
+ else if(m_globalSettings->matmode == GAME_MAT_GLSL)
m_blendermat = false;
// create the canvas, rasterizer and rendertools
@@ -629,6 +638,9 @@ bool GPG_Application::initEngine(GHOST_IWindow* window, const int stereoMode)
m_ketsjiengine->SetTimingDisplay(frameRate, profile, properties);
m_ketsjiengine->SetRestrictAnimationFPS(restrictAnimFPS);
+ //set the global settings (carried over if restart/load new files)
+ m_ketsjiengine->SetGlobalSettings(m_globalSettings);
+
m_engineInitialized = true;
}
@@ -685,9 +697,9 @@ bool GPG_Application::startEngine(void)
// if (always_use_expand_framing)
// sceneconverter->SetAlwaysUseExpandFraming(true);
- if(m_blendermat && (m_startScene->gm.matmode != GAME_MAT_TEXFACE))
+ if(m_blendermat && (m_globalSettings->matmode != GAME_MAT_TEXFACE))
m_sceneconverter->SetMaterials(true);
- if(m_blenderglslmat && (m_startScene->gm.matmode == GAME_MAT_GLSL))
+ if(m_blenderglslmat && (m_globalSettings->matmode == GAME_MAT_GLSL))
m_sceneconverter->SetGLSLMaterials(true);
KX_Scene* startscene = new KX_Scene(m_keyboard,