[Bf-blender-cvs] [dfe8884] asset-experiments: Add missing 'ID' icons, and a 'blenlib' filter to filetypes.

Bastien Montagne noreply at git.blender.org
Mon Dec 15 11:20:39 CET 2014


Commit: dfe8884e7a3c024a8b7655b425aa4333c0c30b43
Author: Bastien Montagne
Date:   Mon Dec 15 11:03:44 2014 +0100
Branches: asset-experiments
https://developer.blender.org/rBdfe8884e7a3c024a8b7655b425aa4333c0c30b43

Add missing 'ID' icons, and a 'blenlib' filter to filetypes.

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

M	release/scripts/startup/bl_ui/space_filebrowser.py
M	source/blender/blenloader/intern/writefile.c
M	source/blender/editors/space_file/filelist.c
M	source/blender/editors/space_file/filesel.c
M	source/blender/makesdna/DNA_space_types.h
M	source/blender/makesrna/intern/rna_space.c
M	source/blender/windowmanager/intern/wm_operators.c

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

diff --git a/release/scripts/startup/bl_ui/space_filebrowser.py b/release/scripts/startup/bl_ui/space_filebrowser.py
index 8d4acf5..5515baf 100644
--- a/release/scripts/startup/bl_ui/space_filebrowser.py
+++ b/release/scripts/startup/bl_ui/space_filebrowser.py
@@ -81,8 +81,10 @@ class FILEBROWSER_HT_header(Header):
                 row.prop(params, "use_filter_text", text="")
 
             if is_lib_browser:
-                row.separator()
-                row.prop(params, "filter_id", text="")
+                row.prop(params, "use_filter_blendid", text="")
+                if (params.use_filter_blendid) :
+                    row.separator()
+                    row.prop(params, "filter_id", text="")
 
             row.separator()
             row.prop(params, "filter_search", text="")
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index 45847a3..7a0d843 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -594,6 +594,10 @@ static void write_previews(WriteData *wd, PreviewImage *prv)
 		short w = prv->w[1];
 		short h = prv->h[1];
 		unsigned int *rect = prv->rect[1];
+
+		printf("\t\tsmall: %p (%d x %d)\n", prv->rect[0], prv->w[0], prv->h[0]);
+		printf("\t\t  big: %p (%d x %d)\n", prv->rect[1], prv->w[1], prv->h[1]);
+
 		/* don't write out large previews if not requested */
 		if (!(U.flag & USER_SAVE_PREVIEWS)) {
 			prv->w[1] = 0;
@@ -1680,6 +1684,7 @@ static void write_objects(WriteData *wd, ListBase *idbase)
 			writelist(wd, DATA, "LodLevel", &ob->lodlevels);
 		}
 
+		printf("write_previews: %s\n", ob->id.name);
 		write_previews(wd, ob->preview);
 
 		ob= ob->id.next;
@@ -2102,6 +2107,7 @@ static void write_images(WriteData *wd, ListBase *idbase)
 				writedata(wd, DATA, pf->size, pf->data);
 			}
 
+			printf("write_previews: %s\n", ima->id.name);
 			write_previews(wd, ima->preview);
 		}
 		ima= ima->id.next;
@@ -2140,6 +2146,7 @@ static void write_textures(WriteData *wd, ListBase *idbase)
 				write_nodetree(wd, tex->nodetree);
 			}
 			
+			printf("write_previews: %s\n", tex->id.name);
 			write_previews(wd, tex->preview);
 		}
 		tex= tex->id.next;
@@ -2181,6 +2188,7 @@ static void write_materials(WriteData *wd, ListBase *idbase)
 				write_nodetree(wd, ma->nodetree);
 			}
 
+			printf("write_previews: %s\n", ma->id.name);
 			write_previews(wd, ma->preview);
 		}
 		ma= ma->id.next;
@@ -2211,6 +2219,7 @@ static void write_worlds(WriteData *wd, ListBase *idbase)
 				write_nodetree(wd, wrld->nodetree);
 			}
 			
+			printf("write_previews: %s\n", wrld->id.name);
 			write_previews(wd, wrld->preview);
 		}
 		wrld= wrld->id.next;
@@ -2245,6 +2254,7 @@ static void write_lamps(WriteData *wd, ListBase *idbase)
 				write_nodetree(wd, la->nodetree);
 			}
 
+			printf("write_previews: %s\n", la->id.name);
 			write_previews(wd, la->preview);
 			
 		}
@@ -2936,6 +2946,7 @@ static void write_groups(WriteData *wd, ListBase *idbase)
 			writestruct(wd, ID_GR, "Group", 1, group);
 			if (group->id.properties) IDP_WriteProperty(group->id.properties, wd);
 
+			printf("write_previews: %s\n", group->id.name);
 			write_previews(wd, group->preview);
 
 			go= group->gobject.first;
@@ -3043,9 +3054,9 @@ static void write_brushes(WriteData *wd, ListBase *idbase)
 				write_curvemapping(wd, brush->curve);
 			if (brush->curve)
 				writestruct(wd, DATA, "ColorBand", 1, brush->gradient);
-			if (brush->preview) {
-				write_previews(wd, brush->preview);
-			}
+
+			printf("write_previews: %s\n", brush->id.name);
+			write_previews(wd, brush->preview);
 		}
 	}
 }
diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c
index c28540d..454b064 100644
--- a/source/blender/editors/space_file/filelist.c
+++ b/source/blender/editors/space_file/filelist.c
@@ -932,15 +932,15 @@ int filelist_geticon(struct FileList *filelist, const int index)
 				case ID_ME:
 					return ICON_MESH_DATA;
 				case ID_MSK:
-					return ICON_FILE_BLANK;  /* TODO! */
+					return ICON_MOD_MASK;  /* TODO! this would need its own icon! */
 				case ID_NT:
 					return ICON_NODETREE;
 				case ID_OB:
 					return ICON_OBJECT_DATA;
 				case ID_PAL:
-					return ICON_FILE_BLANK;  /* TODO! */
+					return ICON_COLOR;  /* TODO! this would need its own icon! */
 				case ID_PC:
-					return ICON_FILE_BLANK;  /* TODO! */
+					return ICON_CURVE_BEZCURVE;  /* TODO! this would need its own icon! */
 				case ID_SCE:
 					return ICON_SCENE_DATA;
 				case ID_SPK:
diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c
index dfbad42..930564e 100644
--- a/source/blender/editors/space_file/filesel.c
+++ b/source/blender/editors/space_file/filesel.c
@@ -159,6 +159,8 @@ short ED_fileselect_set_params(SpaceFile *sfile)
 		params->filter = 0;
 		if ((prop = RNA_struct_find_property(op->ptr, "filter_blender")))
 			params->filter |= RNA_property_boolean_get(op->ptr, prop) ? BLENDERFILE : 0;
+		if ((prop = RNA_struct_find_property(op->ptr, "filter_blenlib")))
+			params->filter |= RNA_property_boolean_get(op->ptr, prop) ? BLENDERLIB : 0;
 		if ((prop = RNA_struct_find_property(op->ptr, "filter_backup")))
 			params->filter |= RNA_property_boolean_get(op->ptr, prop) ? BLENDERFILE_BACKUP : 0;
 		if ((prop = RNA_struct_find_property(op->ptr, "filter_image")))
diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h
index b5a5d2e..675c290 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -597,10 +597,11 @@ typedef struct FileSelectParams {
 	short flag; /* settings for filter, hiding dots files,...  */
 	short sort; /* sort order */
 	short display; /* display mode flag */
-	short filter; /* filter when (flags & FILE_FILTER) is true */
+	int filter; /* filter when (flags & FILE_FILTER) is true */
 
 	/* XXX --- still unused -- */
 	short f_fp; /* show font preview */
+	short pad_s1;
 	char fp_str[8]; /* string to use for font preview */
 
 	/* XXX --- end unused -- */
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index eb09504..1955679 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -3216,11 +3216,11 @@ static void rna_def_fileselect_params(BlenderRNA *brna)
 		{FILTER_ID_MB, "FILTER_ID_MB", ICON_META_DATA, "Metaballs", "Show/hide Mateball datablocks"},
 		{FILTER_ID_MC, "FILTER_ID_MC", ICON_CLIP, "Movie Clips", "Show/hide Movie Clip datablocks"},
 		{FILTER_ID_ME, "FILTER_ID_ME", ICON_MESH_DATA, "Meshes", "Show/hide Mesh datablocks"},
-		{FILTER_ID_MSK, "FILTER_ID_MSK", ICON_FILE_BLANK, "Masks", "Show/hide Mask datablocks"},  /* TODO */
+		{FILTER_ID_MSK, "FILTER_ID_MSK", ICON_MOD_MASK, "Masks", "Show/hide Mask datablocks"},
 		{FILTER_ID_NT, "FILTER_ID_NT", ICON_NODETREE, "Node Trees", "Show/hide Node Tree datablocks"},
 		{FILTER_ID_OB, "FILTER_ID_OB", ICON_OBJECT_DATA, "Objects", "Show/hide Object datablocks"},
-		{FILTER_ID_PAL, "FILTER_ID_PAL", ICON_FILE_BLANK, "Palettes", "Show/hide Palette datablocks"},  /* TODO */
-		{FILTER_ID_PC, "FILTER_ID_PC", ICON_FILE_BLANK, "Paint Curves", "Show/hide Paint Curve datablocks"},  /* TODO */
+		{FILTER_ID_PAL, "FILTER_ID_PAL", ICON_COLOR, "Palettes", "Show/hide Palette datablocks"},
+		{FILTER_ID_PC, "FILTER_ID_PC", ICON_CURVE_BEZCURVE, "Paint Curves", "Show/hide Paint Curve datablocks"},
 		{FILTER_ID_SCE, "FILTER_ID_SCE", ICON_SCENE_DATA, "Scenes", "Show/hide Scene datablocks"},
 		{FILTER_ID_SPK, "FILTER_ID_SPK", ICON_SPEAKER, "Speakers", "Show/hide Speaker datablocks"},
 		{FILTER_ID_SO, "FILTER_ID_SO", ICON_SOUND, "Sounds", "Show/hide Sound datablocks"},
@@ -3330,6 +3330,12 @@ static void rna_def_fileselect_params(BlenderRNA *brna)
 	RNA_def_property_ui_icon(prop, ICON_FILE_FOLDER, 0);
 	RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL);
 
+	prop = RNA_def_property(srna, "use_filter_blendid", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "filter", BLENDERLIB);
+	RNA_def_property_ui_text(prop, "Filter Blender IDs", "Show .blend files items (objects, materials, etc.)");
+	RNA_def_property_ui_icon(prop, ICON_BLENDER, 0);
+	RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL);
+
 	prop = RNA_def_property(srna, "filter_id", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "filter_id");
 	RNA_def_property_enum_items(prop, file_filter_idtypes_items);
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index 6acefbf..c4a91ae 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -1249,6 +1249,8 @@ void WM_operator_properties_filesel(wmOperatorType *ot, int filter, short type,
 	RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
 	prop = RNA_def_boolean(ot->srna, "filter_folder", (filter & FOLDERFILE) != 0, "Filter folders", "");
 	RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
+	prop = RNA_def_boolean(ot->srna, "filter_blenlib", (filter & BLENDERLIB) != 0, "Filter Blender IDs", "");
+	RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
 
 	prop = RNA_def_int(ot->srna, "filemode", type, FILE_LOADLIB, FILE_SPECIAL,
 	                   "File Browser Mode", "The setting for the file browser mode to load a .blend file, a library or a special file",
@@ -2812,7 +2814,7 @@ static void WM_OT_link(wmOperatorType *ot)
 	ot->flag |= OPTYPE_UNDO;
 
 	WM_operator_properties_filesel(
-	        ot, FOLDERFILE | BLENDERFILE, FILE_LOADLIB, FILE_OPENFILE,
+	        ot, FOLDERFILE | BLENDERFILE | BLENDERLIB, FILE_LOADLIB, FILE_OPENFILE,
 	        WM_FILESEL_FILEPATH | WM_FILESEL_DIRECTORY | WM_FILESEL_FILENAME | WM_FILESEL_RELPATH | WM_FILESEL_FILES,
 	        FILE_DEFAULTDISPLAY);
 	
@@ -2832,7 +2834,7 @@ static void WM_OT_append(wmOperatorType *ot)
 	ot->flag |= OPTYPE_UNDO;
 
 	WM_operator_properties_filesel(
-		ot, FOLDERFILE | BLENDERFILE, FILE_LOADLIB, FILE_OPENFILE,
+		ot, FOLDERFILE | BLENDERFILE | BLENDERLIB, 

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list