diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/BKE_blendfile.h | 6 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/blender_undo.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/blendfile.c | 10 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_files.c | 11 |
4 files changed, 8 insertions, 21 deletions
diff --git a/source/blender/blenkernel/BKE_blendfile.h b/source/blender/blenkernel/BKE_blendfile.h index 76c05b0411a..7fc27321fc7 100644 --- a/source/blender/blenkernel/BKE_blendfile.h +++ b/source/blender/blenkernel/BKE_blendfile.h @@ -32,12 +32,6 @@ struct ReportList; struct UserDef; struct bContext; -enum { - BKE_BLENDFILE_READ_FAIL = 0, /* no load */ - BKE_BLENDFILE_READ_OK = 1, /* OK */ - BKE_BLENDFILE_READ_OK_USERPREFS = 2, /* OK, and with new user settings */ -}; - int BKE_blendfile_read(struct bContext *C, const char *filepath, const struct BlendFileReadParams *params, diff --git a/source/blender/blenkernel/intern/blender_undo.c b/source/blender/blenkernel/intern/blender_undo.c index 6c077ac75ba..7c12747283c 100644 --- a/source/blender/blenkernel/intern/blender_undo.c +++ b/source/blender/blenkernel/intern/blender_undo.c @@ -73,7 +73,7 @@ bool BKE_memfile_undo_decode(MemFileUndoData *mfu, bContext *C) G.fileflags |= G_FILE_NO_UI; if (UNDO_DISK) { - success = (BKE_blendfile_read(C, mfu->filename, NULL, 0) != BKE_BLENDFILE_READ_FAIL); + success = BKE_blendfile_read(C, mfu->filename, NULL, 0); } else { success = BKE_blendfile_read_from_memfile( diff --git a/source/blender/blenkernel/intern/blendfile.c b/source/blender/blenkernel/intern/blendfile.c index afbd2627a2a..6b71e7e8d43 100644 --- a/source/blender/blenkernel/intern/blendfile.c +++ b/source/blender/blenkernel/intern/blendfile.c @@ -405,7 +405,7 @@ int BKE_blendfile_read(bContext *C, ReportList *reports) { BlendFileData *bfd; - int retval = BKE_BLENDFILE_READ_OK; + bool success = false; /* don't print user-pref loading */ if (strstr(filepath, BLENDER_STARTUP_FILE) == NULL) { @@ -414,26 +414,22 @@ int BKE_blendfile_read(bContext *C, bfd = BLO_read_from_file(filepath, params->skip_flags, reports); if (bfd) { - if (bfd->user) { - retval = BKE_BLENDFILE_READ_OK_USERPREFS; - } - if (0 == handle_subversion_warning(bfd->main, reports)) { BKE_main_free(bfd->main); MEM_freeN(bfd); bfd = NULL; - retval = BKE_BLENDFILE_READ_FAIL; } else { setup_app_blend_file_data(C, bfd, filepath, params, reports); BLO_blendfiledata_free(bfd); + success = true; } } else { BKE_reports_prependf(reports, "Loading '%s' failed: ", filepath); } - return (bfd ? retval : BKE_BLENDFILE_READ_FAIL); + return success; } bool BKE_blendfile_read_from_memory(bContext *C, diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index 9de0f08f20b..3e965fc2f55 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -605,7 +605,6 @@ bool WM_file_read(bContext *C, const char *filepath, ReportList *reports) /* assume automated tasks with background, don't write recent file list */ const bool do_history = (G.background == false) && (CTX_wm_manager(C)->op_undo_depth == 0); bool success = false; - int retval; /* so we can get the error message */ errno = 0; @@ -619,7 +618,7 @@ bool WM_file_read(bContext *C, const char *filepath, ReportList *reports) /* first try to append data from exotic file formats... */ /* it throws error box when file doesn't exist and returns -1 */ /* note; it should set some error message somewhere... (ton) */ - retval = wm_read_exotic(filepath); + const int retval = wm_read_exotic(filepath); /* we didn't succeed, now try to read Blender file */ if (retval == BKE_READ_EXOTIC_OK_BLEND) { @@ -632,7 +631,7 @@ bool WM_file_read(bContext *C, const char *filepath, ReportList *reports) /* confusing this global... */ G.relbase_valid = 1; - retval = BKE_blendfile_read( + success = BKE_blendfile_read( C, filepath, /* Loading preferences when the user intended to load a regular file is a security risk, @@ -668,7 +667,7 @@ bool WM_file_read(bContext *C, const char *filepath, ReportList *reports) wm_window_match_do(C, &wmbase, &bmain->wm, &bmain->wm); WM_check(C); /* opens window(s), checks keymaps */ - if (retval != BKE_BLENDFILE_READ_FAIL) { + if (success) { if (do_history) { wm_history_file_update(); } @@ -677,8 +676,6 @@ bool WM_file_read(bContext *C, const char *filepath, ReportList *reports) const bool use_data = true; const bool use_userdef = false; wm_file_read_post(C, false, false, use_data, use_userdef, false); - - success = true; } #if 0 else if (retval == BKE_READ_EXOTIC_OK_OTHER) { @@ -941,7 +938,7 @@ void wm_homefile_read(bContext *C, .is_startup = true, .skip_flags = skip_flags, }, - NULL) != BKE_BLENDFILE_READ_FAIL; + NULL); } if (BLI_listbase_is_empty(&U.themes)) { if (G.debug & G_DEBUG) { |