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:
authorCampbell Barton <ideasman42@gmail.com>2008-08-20 10:11:11 +0400
committerCampbell Barton <ideasman42@gmail.com>2008-08-20 10:11:11 +0400
commit7608dcfc51fd74af9617b83c66a11e7ca3fb5df5 (patch)
tree5c4a575b929dfd4790e7c082db5c5fb5bec863da /source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
parentb23f3f62c2f610644821ce104b8f64041d077a80 (diff)
GameLogic.globalDict blenderplayer now keeps settings when loading new blend files.
workaround for python stopping and starting by storing the dictionary as marshal'd data. this means only python types are supported. This feature is needed so when switching from a menu to a level blendfile, the configuration isnt lost.
Diffstat (limited to 'source/gameengine/GamePlayer/ghost/GPG_ghost.cpp')
-rw-r--r--source/gameengine/GamePlayer/ghost/GPG_ghost.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
index 8222e5c8bac..26a85128025 100644
--- a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
+++ b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
@@ -293,7 +293,9 @@ int main(int argc, char** argv)
GHOST_TUns32 fullScreenHeight= 0;
int fullScreenBpp = 32;
int fullScreenFrequency = 60;
-
+ char* pyGlobalDictString = NULL; /* store python dict data between blend file loading */
+ int pyGlobalDictString_Length = 0;
+
#ifdef __linux__
#ifdef __alpha__
signal (SIGFPE, SIG_IGN);
@@ -625,6 +627,10 @@ int main(int argc, char** argv)
titlename = maggie->name;
+ // Set the GameLogic.globalDict from marshal'd data, so we can load new blend files
+ // abd keep data in GameLogic.globalDict
+ app.SetPyGlobalDictMarshal(pyGlobalDictString, pyGlobalDictString_Length);
+
// Check whether the game should be displayed full-screen
if ((!fullScreenParFound) && (!windowParFound))
{
@@ -750,6 +756,12 @@ int main(int argc, char** argv)
}
}
app.StopGameEngine();
+
+ // GameLogic.globalDict has been converted into a buffer
+ // store in pyGlobalDictString so we can restore after python has stopped and started.
+ pyGlobalDictString = app.GetPyGlobalDictMarshal();
+ pyGlobalDictString_Length = app.GetPyGlobalDictMarshalLength();
+
BLO_blendfiledata_free(bfd);
#ifdef __APPLE__
@@ -772,6 +784,11 @@ int main(int argc, char** argv)
}
}
+ if (pyGlobalDictString) {
+ free(pyGlobalDictString);
+ pyGlobalDictString = NULL;
+ }
+
return error ? -1 : 0;
}