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:
authorXiao Xiangquan <xiaoxiangquan@gmail.com>2011-07-14 21:29:53 +0400
committerXiao Xiangquan <xiaoxiangquan@gmail.com>2011-07-14 21:29:53 +0400
commitfa46278e347ca173e9e6d6b734a59c268f4fc9d0 (patch)
treea14148822e60cb1f8f36dba0481b830cb9675db1 /source/blender/windowmanager/intern/wm_files.c
parent470a5017fb80f21bac08373e4b5816c92d42990a (diff)
parent4da4943b5ce9514e9fb3d9458f3e52d6b0d310ca (diff)
merge from trunk 38379
Diffstat (limited to 'source/blender/windowmanager/intern/wm_files.c')
-rw-r--r--source/blender/windowmanager/intern/wm_files.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index 6bec3b60df1..df00c2b83cb 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -57,6 +57,7 @@
#include "BLI_blenlib.h"
#include "BLI_linklist.h"
#include "BLI_utildefines.h"
+#include "BLI_callbacks.h"
#include "BLF_api.h"
@@ -344,6 +345,8 @@ void WM_read_file(bContext *C, const char *filepath, ReportList *reports)
WM_cursor_wait(1);
+ BLI_exec_cb(CTX_data_main(C), NULL, BLI_CB_EVT_LOAD_PRE);
+
/* first try to append data from exotic file formats... */
/* it throws error box when file doesnt exist and returns -1 */
/* note; it should set some error message somewhere... (ton) */
@@ -394,6 +397,7 @@ void WM_read_file(bContext *C, const char *filepath, ReportList *reports)
#ifdef WITH_PYTHON
/* run any texts that were loaded in and flagged as modules */
BPY_driver_reset();
+ BPY_app_handlers_reset();
BPY_modules_load_user(C);
#endif
CTX_wm_window_set(C, NULL); /* exits queues */
@@ -413,7 +417,8 @@ void WM_read_file(bContext *C, const char *filepath, ReportList *reports)
// XXX undo_editmode_clear();
BKE_reset_undo();
BKE_write_undo(C, "original"); /* save current state */
-
+
+ BLI_exec_cb(CTX_data_main(C), NULL, BLI_CB_EVT_LOAD_POST);
}
else if(retval == BKE_READ_EXOTIC_OK_OTHER)
BKE_write_undo(C, "Import file");
@@ -520,6 +525,7 @@ int WM_read_homefile(bContext *C, ReportList *reports, short from_memory)
BPY_string_exec(C, "__import__('addon_utils').reset_all()");
BPY_driver_reset();
+ BPY_app_handlers_reset();
BPY_modules_load_user(C);
}
#endif
@@ -631,8 +637,9 @@ static ImBuf *blend_file_thumb(Scene *scene, int **thumb_pt)
char err_out[256]= "unknown";
*thumb_pt= NULL;
-
- if(G.background || scene->camera==NULL)
+
+ /* scene can be NULL if running a script at startup and calling the save operator */
+ if(G.background || scene==NULL || scene->camera==NULL)
return NULL;
/* gets scaled to BLEN_THUMB_SIZE */
@@ -718,6 +725,14 @@ int WM_write_file(bContext *C, const char *target, int fileflags, ReportList *re
}
}
+ /* blend file thumbnail */
+ /* save before exit_editmode, otherwise derivedmeshes for shared data corrupt #27765) */
+ if(U.flag & USER_SAVE_PREVIEWS) {
+ ibuf_thumb= blend_file_thumb(CTX_data_scene(C), &thumb);
+ }
+
+ BLI_exec_cb(G.main, NULL, BLI_CB_EVT_SAVE_PRE);
+
/* operator now handles overwrite checks */
if (G.fileflags & G_AUTOPACK) {
@@ -730,9 +745,6 @@ int WM_write_file(bContext *C, const char *target, int fileflags, ReportList *re
/* don't forget not to return without! */
WM_cursor_wait(1);
- /* blend file thumbnail */
- ibuf_thumb= blend_file_thumb(CTX_data_scene(C), &thumb);
-
fileflags |= G_FILE_HISTORY; /* write file history */
if (BLO_write_file(CTX_data_main(C), filepath, fileflags, reports, thumb)) {
@@ -754,6 +766,8 @@ int WM_write_file(bContext *C, const char *target, int fileflags, ReportList *re
write_history();
}
+ BLI_exec_cb(G.main, NULL, BLI_CB_EVT_SAVE_POST);
+
/* run this function after because the file cant be written before the blend is */
if (ibuf_thumb) {
ibuf_thumb= IMB_thumb_create(filepath, THB_NORMAL, THB_SOURCE_BLEND, ibuf_thumb);