From a0658707e12869c3a54c68c2261517d5b4a2242e Mon Sep 17 00:00:00 2001 From: Andrea Weikert Date: Sat, 24 Nov 2007 17:08:40 +0000 Subject: [PATCH] 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. --- source/blender/src/usiblender.c | 2 +- source/creator/creator.c | 20 +++++++++++++------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/source/blender/src/usiblender.c b/source/blender/src/usiblender.c index c9db00401af..16d55202a39 100644 --- a/source/blender/src/usiblender.c +++ b/source/blender/src/usiblender.c @@ -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 - G.relbase_valid = 1; + if (retval!=0) G.relbase_valid = 1; undo_editmode_clear(); BKE_reset_undo(); diff --git a/source/creator/creator.c b/source/creator/creator.c index 8588dc9db9c..1feaf075e1c 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -686,13 +686,19 @@ int main(int argc, char **argv) break; } } - else { - BKE_read_file(argv[a], NULL); - sound_initialize_sounds(); - - /* happens for the UI on file reading too */ - BKE_reset_undo(); - BKE_write_undo("original"); /* save current state */ + else { + if (G.background) { + BKE_read_file(argv[a], NULL); + sound_initialize_sounds(); + + /* happens for the UI on file reading too */ + 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]); + } } }