diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-10-08 07:56:46 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-10-08 08:00:01 +0300 |
commit | b349297861b999e4203d06dbe7999072aea1797f (patch) | |
tree | a6763e2d6f276d189336d7dde99899bcd34c2737 /source/blender/windowmanager/intern/wm_files.c | |
parent | a5e631171bdcdb12f508528f391d3916014e23e8 (diff) |
File Read: de-duplicate command line file-load
WM_file_read must support background mode already
since it can be called by Python scripts in background mode.
Diffstat (limited to 'source/blender/windowmanager/intern/wm_files.c')
-rw-r--r-- | source/blender/windowmanager/intern/wm_files.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index 58b4c914ad1..c54b06b4a2e 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -81,6 +81,7 @@ #include "BKE_packedFile.h" #include "BKE_report.h" #include "BKE_sound.h" +#include "BKE_scene.h" #include "BKE_screen.h" #include "BLO_readfile.h" @@ -476,6 +477,12 @@ static void wm_file_read_post(bContext *C, bool is_startup_file) BLI_callback_exec(CTX_data_main(C), NULL, BLI_CB_EVT_VERSION_UPDATE); BLI_callback_exec(CTX_data_main(C), NULL, BLI_CB_EVT_LOAD_POST); + /* would otherwise be handled by event loop */ + if (G.background) { + Main *bmain = CTX_data_main(C); + BKE_scene_update_tagged(bmain->eval_ctx, bmain, CTX_data_scene(C)); + } + WM_event_add_notifier(C, NC_WM | ND_FILEREAD, NULL); /* report any errors. @@ -491,9 +498,11 @@ static void wm_file_read_post(bContext *C, bool is_startup_file) CTX_wm_window_set(C, NULL); /* exits queues */ } -// undo_editmode_clear(); - BKE_undo_reset(); - BKE_undo_write(C, "original"); /* save current state */ + if (!G.background) { +// undo_editmode_clear(); + BKE_undo_reset(); + BKE_undo_write(C, "original"); /* save current state */ + } } bool WM_file_read(bContext *C, const char *filepath, ReportList *reports) |