User Pref to not overwrite Recent Files list everytime you open a new

file

This is just a more formalised version of a local hack I've been
running locally for the past year now. It's especially useful when you
want to maintain your own set of recently opened test files (or
perhaps current project files), but then be able to quickly open some
.blend files downloaded from the web (i.e. checking out some bug
report, or how someone else sets up some node setup) without
loosing/polluting your existing recent files list as a result of doing
so, and having to either resort to some nasty methods to get it back.

Of course, this is still really hacky, as for instance, it means that
the currently opened file will not show up in the recent files list
for quick reload. However, that's why this is a userpref :)
This commit is contained in:
2011-06-04 01:54:34 +00:00
parent d1c542ce05
commit 56e20eafe9
4 changed files with 13 additions and 2 deletions

View File

@@ -743,6 +743,7 @@ class USERPREF_PT_file(bpy.types.Panel):
col.prop(paths, "save_version")
col.prop(paths, "recent_files")
col.prop(paths, "use_update_recent_files_on_load")
col.prop(paths, "use_save_preview_images")
col.label(text="Auto Save:")
col.prop(paths, "use_auto_save_temporary_files")

View File

@@ -435,6 +435,7 @@ extern UserDef U; /* from blenkernel blender.c */
#define USER_NONEGFRAMES (1 << 24)
#define USER_TXT_TABSTOSPACES_DISABLE (1 << 25)
#define USER_TOOLTIPS_PYTHON (1 << 26)
#define USER_NO_RECENTLOAD_UPDATE (1 << 27)
/* helper macro for checking frame clamping */
#define FRAMENUMBER_MIN_CLAMP(cfra) \

View File

@@ -2864,7 +2864,11 @@ static void rna_def_userdef_filepaths(BlenderRNA *brna)
prop= RNA_def_property(srna, "recent_files", PROP_INT, PROP_NONE);
RNA_def_property_range(prop, 0, 30);
RNA_def_property_ui_text(prop, "Recent Files", "Maximum number of recently opened files to remember");
prop= RNA_def_property(srna, "use_update_recent_files_on_load", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", USER_NO_RECENTLOAD_UPDATE);
RNA_def_property_ui_text(prop, "Update Recent on Load", "When enabled, opening files will update the recent files list. Otherwise, updates only occur when saving");
prop= RNA_def_property(srna, "use_save_preview_images", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_SAVE_PREVIEWS);
RNA_def_property_ui_text(prop, "Save Preview Images", "Enables automatic saving of preview images in the .blend file");

View File

@@ -376,7 +376,12 @@ void WM_read_file(bContext *C, const char *filepath, ReportList *reports)
if (retval != BKE_READ_FILE_FAIL) {
G.relbase_valid = 1;
if(!G.background) /* assume automated tasks with background, dont write recent file list */
/* dont write recent file list if:
* 1) assuming automated tasks with background
* 2) user preference to not do this is enabled (i.e. developer testing mode)
*/
if (!G.background && !(U.flag & USER_NO_RECENTLOAD_UPDATE))
write_history();
}