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>2010-10-18 10:41:16 +0400
committerCampbell Barton <ideasman42@gmail.com>2010-10-18 10:41:16 +0400
commit4d37cf90b9d9d8ed2f0339c8ccd72481e29a4514 (patch)
tree8442faaffb762a79497a45d90f503ccedc4cd0b4 /source/blender/blenloader
parentb3afc3618db09942f83d4a3ac62834e7b925d5d7 (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/blender/blenloader')
-rw-r--r--source/blender/blenloader/intern/readfile.c12
-rw-r--r--source/blender/blenloader/intern/writefile.c6
2 files changed, 9 insertions, 9 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index ebd407e7e21..b6515863c2b 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -9707,7 +9707,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
{
char str[FILE_MAX];
BLI_join_dirfile(str, seq->strip->dir, seq->strip->stripdata->name);
- BLI_path_abs(str, G.sce);
+ BLI_path_abs(str, G.main->name);
seq->sound = sound_new_file(main, str);
}
/* don't know, if anybody used that
@@ -12369,7 +12369,7 @@ static Main* library_append_begin(const bContext *C, FileData **fd, char *dir)
blo_split_main(&(*fd)->mainlist, mainvar);
/* which one do we need? */
- mainl = blo_find_main(*fd, &(*fd)->mainlist, dir, G.sce);
+ mainl = blo_find_main(*fd, &(*fd)->mainlist, dir, G.main->name);
/* needed for do_version */
mainl->versionfile= (*fd)->fileversion;
@@ -12453,7 +12453,7 @@ static void library_append_end(const bContext *C, Main *mainl, FileData **fd, in
BLI_strncpy(curlib->name, curlib->filepath, sizeof(curlib->name));
/* uses current .blend file as reference */
- BLI_path_rel(curlib->name, G.sce);
+ BLI_path_rel(curlib->name, G.main->name);
}
blo_join_main(&(*fd)->mainlist);
@@ -12462,7 +12462,7 @@ static void library_append_end(const bContext *C, Main *mainl, FileData **fd, in
lib_link_all(*fd, mainvar);
lib_verify_nodetree(mainvar, FALSE);
- fix_relpaths_library(G.sce, mainvar); /* make all relative paths, relative to the open blend file */
+ fix_relpaths_library(G.main->name, mainvar); /* make all relative paths, relative to the open blend file */
/* give a base to loose objects. If group append, do it for objects too */
if(scene) {
@@ -12578,7 +12578,7 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
while(fd==NULL) {
char newlib_path[240] = { 0 };
printf("Missing library...'\n");
- printf(" current file: %s\n", G.sce);
+ printf(" current file: %s\n", G.main->name);
printf(" absolute lib: %s\n", mainptr->curlib->filepath);
printf(" relative lib: %s\n", mainptr->curlib->name);
printf(" enter a new path:\n");
@@ -12586,7 +12586,7 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
if(scanf("%s", newlib_path) > 0) {
strcpy(mainptr->curlib->name, newlib_path);
strcpy(mainptr->curlib->filepath, newlib_path);
- cleanup_path(G.sce, mainptr->curlib->filepath);
+ cleanup_path(G.main->name, mainptr->curlib->filepath);
fd= blo_openblenderfile(mainptr->curlib->filepath, basefd->reports);
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index 440f1cc98a8..b5715353c6c 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -2471,14 +2471,14 @@ int BLO_write_file(Main *mainvar, char *dir, int write_flags, ReportList *report
if(strcmp(dir1, dir2)==0)
write_flags &= ~G_FILE_RELATIVE_REMAP;
else
- makeFilesAbsolute(G.sce, NULL);
+ makeFilesAbsolute(G.main->name, NULL);
}
- BLI_make_file_string(G.sce, userfilename, BLI_get_folder_create(BLENDER_USER_CONFIG, NULL), BLENDER_STARTUP_FILE);
+ BLI_make_file_string(G.main->name, userfilename, BLI_get_folder_create(BLENDER_USER_CONFIG, NULL), BLENDER_STARTUP_FILE);
write_user_block= BLI_streq(dir, userfilename);
if(write_flags & G_FILE_RELATIVE_REMAP)
- makeFilesRelative(dir, NULL); /* note, making relative to something OTHER then G.sce */
+ makeFilesRelative(dir, NULL); /* note, making relative to something OTHER then G.main->name */
/* actual file writing */
err= write_file_handle(mainvar, file, NULL,NULL, write_user_block, write_flags, thumb);