diff options
author | Andrea Weikert <elubie@gmx.net> | 2012-11-07 00:29:14 +0400 |
---|---|---|
committer | Andrea Weikert <elubie@gmx.net> | 2012-11-07 00:29:14 +0400 |
commit | ecda79a8b82fb583cbea2a0c4bf430c649b46e33 (patch) | |
tree | ae1c5989ebbbc4dd399be9eb3172acf268cfef33 /source/blender/editors | |
parent | 0ba9e04c5be13f9c5b49a86ee00d1a97841ebe76 (diff) |
== file browser ==
[#33080] Backup icons - further integration
Contributed by Georg Kronthaler, many thanks!
* enables display of correct file icon on splash screen and in Open Recent menu
* exposes filter_backup in the python api
* enables setting BLENDERFILE_BACKUP as active filter in file browser from wm_operators.c (and from .blend in case this setting will be saved in the future)
* adds a comment to slightly misleading function name file_is_blend_backup()
* Updates icon for backup files to be more consistent with icon for .blend files
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/space_file/filelist.c | 1 | ||||
-rw-r--r-- | source/blender/editors/space_file/filesel.c | 2 | ||||
-rw-r--r-- | source/blender/editors/space_info/space_info.c | 8 |
3 files changed, 10 insertions, 1 deletions
diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index 8f94086013c..a49b75477e4 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -744,6 +744,7 @@ void filelist_setfilter_types(struct FileList *filelist, const char *filter_glob BLI_strncpy(filelist->filter_glob, filter_glob, sizeof(filelist->filter_glob)); } +/* would recognize .blend as well */ static int file_is_blend_backup(const char *str) { short a, b; diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c index 49562958f82..778a3f4df3e 100644 --- a/source/blender/editors/space_file/filesel.c +++ b/source/blender/editors/space_file/filesel.c @@ -164,6 +164,8 @@ short ED_fileselect_set_params(SpaceFile *sfile) params->filter = 0; if (RNA_struct_find_property(op->ptr, "filter_blender")) params->filter |= RNA_boolean_get(op->ptr, "filter_blender") ? BLENDERFILE : 0; + if (RNA_struct_find_property(op->ptr, "filter_backup")) + params->filter |= RNA_boolean_get(op->ptr, "filter_backup") ? BLENDERFILE_BACKUP : 0; if (RNA_struct_find_property(op->ptr, "filter_image")) params->filter |= RNA_boolean_get(op->ptr, "filter_image") ? IMAGEFILE : 0; if (RNA_struct_find_property(op->ptr, "filter_movie")) diff --git a/source/blender/editors/space_info/space_info.c b/source/blender/editors/space_info/space_info.c index f108881091a..cba0a808d63 100644 --- a/source/blender/editors/space_info/space_info.c +++ b/source/blender/editors/space_info/space_info.c @@ -58,6 +58,7 @@ #include "UI_view2d.h" #include "info_intern.h" /* own include */ +#include "BLO_readfile.h" /* ******************** default callbacks for info space ***************** */ @@ -271,11 +272,16 @@ static void info_header_listener(ARegion *ar, wmNotifier *wmn) static void recent_files_menu_draw(const bContext *UNUSED(C), Menu *menu) { struct RecentFile *recent; + char file [FILE_MAX]; uiLayout *layout = menu->layout; uiLayoutSetOperatorContext(layout, WM_OP_EXEC_REGION_WIN); if (G.recent_files.first) { for (recent = G.recent_files.first; (recent); recent = recent->next) { - uiItemStringO(layout, BLI_path_basename(recent->filepath), ICON_FILE_BLEND, "WM_OT_open_mainfile", "filepath", recent->filepath); + BLI_split_file_part(recent->filepath, file, sizeof(file)); + if (BLO_has_bfile_extension(file)) + uiItemStringO(layout, BLI_path_basename(recent->filepath), ICON_FILE_BLEND, "WM_OT_open_mainfile", "filepath", recent->filepath); + else + uiItemStringO(layout, BLI_path_basename(recent->filepath), ICON_FILE_BACKUP, "WM_OT_open_mainfile", "filepath", recent->filepath); } } else { |