[Bf-blender-cvs] [7d28585] master: Skip save-as history running from another Operator

Campbell Barton noreply at git.blender.org
Fri Jan 29 07:10:15 CET 2016


Commit: 7d285854b0e36a4cb7720f0b910fb4f9c2d8804b
Author: Campbell Barton
Date:   Fri Jan 29 17:00:32 2016 +1100
Branches: master
https://developer.blender.org/rB7d285854b0e36a4cb7720f0b910fb4f9c2d8804b

Skip save-as history running from another Operator

So scripts can call Save-As without adjusting 'Recent Files'.
Uses same logic and file reading,

===================================================================

M	source/blender/windowmanager/intern/wm_files.c

===================================================================

diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index 845e190..e3172de 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -1068,6 +1068,8 @@ int wm_file_write(bContext *C, const char *filepath, int fileflags, ReportList *
 	G.main->recovered = 0;
 	
 	if (BLO_write_file(CTX_data_main(C), filepath, fileflags, reports, thumb)) {
+		const bool do_history = (G.background == false) && (CTX_wm_manager(C)->op_undo_depth == 0);
+
 		if (!(fileflags & G_FILE_SAVE_COPY)) {
 			G.relbase_valid = 1;
 			BLI_strncpy(G.main->name, filepath, sizeof(G.main->name));  /* is guaranteed current file */
@@ -1079,7 +1081,7 @@ int wm_file_write(bContext *C, const char *filepath, int fileflags, ReportList *
 		BKE_BIT_TEST_SET(G.fileflags, fileflags & G_FILE_AUTOPLAY, G_FILE_AUTOPLAY);
 
 		/* prevent background mode scripts from clobbering history */
-		if (!G.background) {
+		if (do_history) {
 			wm_history_file_update();
 		}




More information about the Bf-blender-cvs mailing list