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>2014-01-28 22:33:05 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-01-28 22:33:05 +0400
commit8c688a052c79e006b586598d2ac55a550cea3550 (patch)
treeacd4aec837cd8c38b2cdde3f3b54cb1d91c4a60b /source/blender/windowmanager/intern/wm_files.c
parent39202a53b559debb5ce1413c08f131173515c3cd (diff)
File Reading: add wrapper function for WM_file_read
also return cancelled when an operator fails to load a file
Diffstat (limited to 'source/blender/windowmanager/intern/wm_files.c')
-rw-r--r--source/blender/windowmanager/intern/wm_files.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index b99246dc34b..7bbf78ef089 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -388,8 +388,9 @@ void WM_file_autoexec_init(const char *filepath)
}
}
-void WM_file_read(bContext *C, const char *filepath, ReportList *reports)
+bool WM_file_read(bContext *C, const char *filepath, ReportList *reports)
{
+ bool success = false;
int retval;
/* so we can get the error message */
@@ -412,7 +413,7 @@ void WM_file_read(bContext *C, const char *filepath, ReportList *reports)
ListBase wmbase;
/* assume automated tasks with background, don't write recent file list */
- const int do_history = (G.background == FALSE) && (CTX_wm_manager(C)->op_undo_depth == 0);
+ const bool do_history = (G.background == FALSE) && (CTX_wm_manager(C)->op_undo_depth == 0);
/* put aside screens to match with persistent windows later */
/* also exit screens and editors */
@@ -496,6 +497,8 @@ void WM_file_read(bContext *C, const char *filepath, ReportList *reports)
BKE_reset_undo();
BKE_write_undo(C, "original"); /* save current state */
+
+ success = true;
}
else if (retval == BKE_READ_EXOTIC_OK_OTHER)
BKE_write_undo(C, "Import file");
@@ -516,6 +519,8 @@ void WM_file_read(bContext *C, const char *filepath, ReportList *reports)
WM_cursor_wait(0);
+ return success;
+
}