Bugfix #7804 : Opened file is not registered correctly when started from command line

- treat file passed as parameter the same as if loaded from UI if Blender isn't running in background mode.
- only set relative base as valid if file loaded successfully.
This commit is contained in:
Andrea Weikert
2007-11-24 17:08:40 +00:00
parent af26256da4
commit a0658707e1
2 changed files with 14 additions and 8 deletions

View File

@@ -458,7 +458,7 @@ void BIF_read_file(char *name)
if(retval==2) init_userdef_file(); // in case a userdef is read from regular .blend if(retval==2) init_userdef_file(); // in case a userdef is read from regular .blend
G.relbase_valid = 1; if (retval!=0) G.relbase_valid = 1;
undo_editmode_clear(); undo_editmode_clear();
BKE_reset_undo(); BKE_reset_undo();

View File

@@ -686,13 +686,19 @@ int main(int argc, char **argv)
break; break;
} }
} }
else { else {
BKE_read_file(argv[a], NULL); if (G.background) {
sound_initialize_sounds(); BKE_read_file(argv[a], NULL);
sound_initialize_sounds();
/* happens for the UI on file reading too */
BKE_reset_undo(); /* happens for the UI on file reading too */
BKE_write_undo("original"); /* save current state */ BKE_reset_undo();
BKE_write_undo("original"); /* save current state */
} else {
/* we are not running in background mode here, but start blender in UI mode with
a file - this should do everything a 'load file' does */
BIF_read_file(argv[a]);
}
} }
} }