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.
This commit is contained in:
2010-10-18 06:41:16 +00:00
parent b3afc3618d
commit 4d37cf90b9
49 changed files with 147 additions and 148 deletions

View File

@@ -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);