diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-10-18 10:41:16 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-10-18 10:41:16 +0400 |
commit | 4d37cf90b9d9d8ed2f0339c8ccd72481e29a4514 (patch) | |
tree | 8442faaffb762a79497a45d90f503ccedc4cd0b4 /source/gameengine | |
parent | b3afc3618db09942f83d4a3ac62834e7b925d5d7 (diff) |
remove G.sce, use G.main->name instead.
Both stored the filename of the blend file, but G.sce stored the last opened file.
This will make blender act differently in some cases since a relative path to the last opened file will no longer resolve (which is correct IMHO since that file isnt open and the path might not even be valid anymore).
Tested linking with durian files and rendering to relative paths when no files is loaded however we may need to have some operators give an error if they are used on the default startup.blend.
Diffstat (limited to 'source/gameengine')
-rw-r--r-- | source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp | 10 | ||||
-rw-r--r-- | source/gameengine/BlenderRoutines/KX_BlenderGL.cpp | 3 | ||||
-rw-r--r-- | source/gameengine/GamePlayer/ghost/GPG_ghost.cpp | 4 |
3 files changed, 9 insertions, 8 deletions
diff --git a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp index d65993581b5..858a5964a52 100644 --- a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp +++ b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp @@ -141,10 +141,10 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c BlendFileData *bfd= NULL; BLI_strncpy(pathname, blenderdata->name, sizeof(pathname)); - BLI_strncpy(oldsce, G.sce, sizeof(oldsce)); + BLI_strncpy(oldsce, G.main->name, sizeof(oldsce)); #ifndef DISABLE_PYTHON resetGamePythonPath(); // need this so running a second time wont use an old blendfiles path - setGamePythonPath(G.sce); + setGamePythonPath(G.main->name); // Acquire Python's GIL (global interpreter lock) // so we can safely run Python code and API calls @@ -309,10 +309,10 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c startscenename = bfd->curscene->id.name + 2; if(blenderdata) { - BLI_strncpy(G.sce, blenderdata->name, sizeof(G.sce)); + BLI_strncpy(G.main->name, blenderdata->name, sizeof(G.main->name)); BLI_strncpy(pathname, blenderdata->name, sizeof(pathname)); #ifndef DISABLE_PYTHON - setGamePythonPath(G.sce); + setGamePythonPath(G.main->name); #endif } } @@ -573,7 +573,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c if (bfd) BLO_blendfiledata_free(bfd); - BLI_strncpy(G.sce, oldsce, sizeof(G.sce)); + BLI_strncpy(G.main->name, oldsce, sizeof(G.main->name)); #ifndef DISABLE_PYTHON Py_DECREF(pyGlobalDict); diff --git a/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp b/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp index e1cd1c6d488..5e1e213c570 100644 --- a/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp +++ b/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp @@ -67,6 +67,7 @@ extern "C" { #include "DNA_windowmanager_types.h" #include "BKE_global.h" +#include "BKE_main.h" #include "BKE_bmfont.h" #include "BKE_image.h" @@ -247,7 +248,7 @@ void BL_MakeScreenShot(ScrArea *curarea, const char* filename) dumprect= screenshot(curarea, &dumpsx, &dumpsy); if(dumprect) { ImBuf *ibuf; - BLI_path_abs(path, G.sce); + BLI_path_abs(path, G.main->name); /* BKE_add_image_extension() checks for if extension was already set */ BKE_add_image_extension(path, R_PNG); /* scene->r.imtype */ ibuf= IMB_allocImBuf(dumpsx, dumpsy, 24, 0); diff --git a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp index 9c0b5a24aeb..e9dfd2a6e26 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp @@ -821,8 +821,8 @@ int main(int argc, char** argv) app.SetGameEngineData(maggie, scene, argc, argv); /* this argc cant be argc_py_clamped, since python uses it */ BLI_strncpy(pathname, maggie->name, sizeof(pathname)); - BLI_strncpy(G.sce, maggie->name, sizeof(G.sce)); - setGamePythonPath(G.sce); + BLI_strncpy(G.main->name, maggie->name, sizeof(G.main->name)); + setGamePythonPath(G.main->name); if (firstTimeRunning) { |