[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [51696] trunk/blender: == file browser ==

Andrea Weikert elubie at gmx.net
Sat Oct 27 20:31:53 CEST 2012


Revision: 51696
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=51696
Author:   elubie
Date:     2012-10-27 18:31:52 +0000 (Sat, 27 Oct 2012)
Log Message:
-----------
== file browser ==
PATCH: [#32989] Activate backup files filter in File Browser
Contributed by Georg Kronthaler, many thanks!
(I just moved the icon to a different place reserved for file browser icons)

* enables the filtering of backup files in the file browser
* adds a 'filter backup files'-icon to the filter buttons
* adds new icons for backup files in list and thumbnail view
* enables file preview for the backup files

Modified Paths:
--------------
    trunk/blender/release/datafiles/blender_icons.png
    trunk/blender/release/datafiles/prvicons.png
    trunk/blender/release/scripts/startup/bl_ui/space_filebrowser.py
    trunk/blender/source/blender/editors/include/UI_icons.h
    trunk/blender/source/blender/editors/space_file/file_draw.c
    trunk/blender/source/blender/editors/space_file/filelist.c
    trunk/blender/source/blender/makesrna/intern/rna_space.c

Modified: trunk/blender/release/datafiles/blender_icons.png
===================================================================
(Binary files differ)

Modified: trunk/blender/release/datafiles/prvicons.png
===================================================================
(Binary files differ)

Modified: trunk/blender/release/scripts/startup/bl_ui/space_filebrowser.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/space_filebrowser.py	2012-10-27 17:47:58 UTC (rev 51695)
+++ trunk/blender/release/scripts/startup/bl_ui/space_filebrowser.py	2012-10-27 18:31:52 UTC (rev 51696)
@@ -67,6 +67,7 @@
                 row.label(params.filter_glob)
             else:
                 row.prop(params, "use_filter_blender", text="")
+                row.prop(params, "use_filter_backup", text="")
                 row.prop(params, "use_filter_image", text="")
                 row.prop(params, "use_filter_movie", text="")
                 row.prop(params, "use_filter_script", text="")

Modified: trunk/blender/source/blender/editors/include/UI_icons.h
===================================================================
--- trunk/blender/source/blender/editors/include/UI_icons.h	2012-10-27 17:47:58 UTC (rev 51695)
+++ trunk/blender/source/blender/editors/include/UI_icons.h	2012-10-27 18:31:52 UTC (rev 51696)
@@ -799,13 +799,12 @@
 DEF_ICON(LAYER_USED)
 DEF_ICON(LAYER_ACTIVE)
 #ifndef DEF_ICON_BLANK_SKIP
+	/* available */
 	DEF_ICON(BLANK254)
 	DEF_ICON(BLANK255)
 	DEF_ICON(BLANK256)
 	DEF_ICON(BLANK257)
 	DEF_ICON(BLANK257b)
-
-	/* available */
 	DEF_ICON(BLANK258)
 	DEF_ICON(BLANK259)
 	DEF_ICON(BLANK260)
@@ -890,8 +889,8 @@
 	DEF_ICON(BLANK313)
 	DEF_ICON(BLANK314)
 	DEF_ICON(BLANK315)
-	DEF_ICON(BLANK316)
 #endif
+DEF_ICON(FILE_BACKUP)
 DEF_ICON(DISK_DRIVE)
 	
 	/* SHADING / TEXT */

Modified: trunk/blender/source/blender/editors/space_file/file_draw.c
===================================================================
--- trunk/blender/source/blender/editors/space_file/file_draw.c	2012-10-27 17:47:58 UTC (rev 51695)
+++ trunk/blender/source/blender/editors/space_file/file_draw.c	2012-10-27 18:31:52 UTC (rev 51696)
@@ -257,7 +257,7 @@
 	else if (file->flags & BLENDERFILE)
 		return ICON_FILE_BLEND;
 	else if (file->flags & BLENDERFILE_BACKUP)
-		return ICON_FILE_BLEND;
+		return ICON_FILE_BACKUP;
 	else if (file->flags & IMAGEFILE)
 		return ICON_FILE_IMAGE;
 	else if (file->flags & MOVIEFILE)

Modified: trunk/blender/source/blender/editors/space_file/filelist.c
===================================================================
--- trunk/blender/source/blender/editors/space_file/filelist.c	2012-10-27 17:47:58 UTC (rev 51695)
+++ trunk/blender/source/blender/editors/space_file/filelist.c	2012-10-27 18:31:52 UTC (rev 51696)
@@ -143,7 +143,8 @@
 #define SPECIAL_IMG_FONTFILE 8
 #define SPECIAL_IMG_UNKNOWNFILE 9
 #define SPECIAL_IMG_LOADING 10
-#define SPECIAL_IMG_MAX SPECIAL_IMG_LOADING + 1
+#define SPECIAL_IMG_BACKUP 11
+#define SPECIAL_IMG_MAX SPECIAL_IMG_BACKUP + 1
 
 static ImBuf *gSpecialFileImages[SPECIAL_IMG_MAX];
 
@@ -683,6 +684,9 @@
 	else if (file->flags & IMAGEFILE) {
 		ibuf = gSpecialFileImages[SPECIAL_IMG_LOADING];
 	}
+	else if (file->flags & BLENDERFILE_BACKUP) {
+		ibuf = gSpecialFileImages[SPECIAL_IMG_BACKUP];
+	}
 
 	return ibuf;
 }
@@ -817,8 +821,10 @@
 {
 	int type = file_extension_type(relname);
 	
-	if (type == BLENDERFILE || type == BLENDERFILE_BACKUP)
+	if (type == BLENDERFILE)
 		return ICON_FILE_BLEND;
+	else if (type == BLENDERFILE_BACKUP)
+		return ICON_FILE_BACKUP;
 	else if (type == IMAGEFILE)
 		return ICON_FILE_IMAGE;
 	else if (type == MOVIEFILE)
@@ -1303,7 +1309,7 @@
 		if (limg->flags & IMAGEFILE) {
 			limg->img = IMB_thumb_manage(limg->path, THB_NORMAL, THB_SOURCE_IMAGE);
 		}
-		else if (limg->flags & BLENDERFILE) {
+		else if (limg->flags & (BLENDERFILE | BLENDERFILE_BACKUP)) {
 			limg->img = IMB_thumb_manage(limg->path, THB_NORMAL, THB_SOURCE_BLEND);
 		}
 		else if (limg->flags & MOVIEFILE) {
@@ -1360,7 +1366,7 @@
 	tj->filelist = filelist;
 	for (idx = 0; idx < filelist->numfiles; idx++) {
 		if (!filelist->filelist[idx].image) {
-			if ( (filelist->filelist[idx].flags & (IMAGEFILE | MOVIEFILE | BLENDERFILE)) ) {
+			if ( (filelist->filelist[idx].flags & (IMAGEFILE | MOVIEFILE | BLENDERFILE | BLENDERFILE_BACKUP)) ) {
 				FileImage *limg = MEM_callocN(sizeof(struct FileImage), "loadimage");
 				BLI_strncpy(limg->path, filelist->filelist[idx].path, FILE_MAX);
 				limg->index = idx;

Modified: trunk/blender/source/blender/makesrna/intern/rna_space.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_space.c	2012-10-27 17:47:58 UTC (rev 51695)
+++ trunk/blender/source/blender/makesrna/intern/rna_space.c	2012-10-27 18:31:52 UTC (rev 51696)
@@ -2826,6 +2826,12 @@
 	RNA_def_property_ui_icon(prop, ICON_FILE_BLEND, 0);
 	RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL);
 
+	prop = RNA_def_property(srna, "use_filter_backup", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "filter", BLENDERFILE_BACKUP);
+	RNA_def_property_ui_text(prop, "Filter BlenderBackup files", "Show .blend1, .blend2, etc. files");
+	RNA_def_property_ui_icon(prop, ICON_FILE_BACKUP, 0);
+	RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL);
+
 	prop = RNA_def_property(srna, "use_filter_movie", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "filter", MOVIEFILE);
 	RNA_def_property_ui_text(prop, "Filter Movies", "Show movie files");




More information about the Bf-blender-cvs mailing list