Commit: 047525019a9a1924ade3826430ef3854d3785c50
Author: Bastien Montagne
Date:   Sat Jul 4 12:56:09 2015 +0200
Branches: asset-experiments
https://developer.blender.org/rB047525019a9a1924ade3826430ef3854d3785c50

Expose fewest more generic ID filtering options.

Full precise filtering remains possible in new 'Advanced filter' panel.

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

M       release/scripts/startup/bl_ui/space_filebrowser.py
M       source/blender/makesrna/intern/rna_space.c

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

diff --git a/release/scripts/startup/bl_ui/space_filebrowser.py 
b/release/scripts/startup/bl_ui/space_filebrowser.py
index 1f9c470..0b9c847 100644
--- a/release/scripts/startup/bl_ui/space_filebrowser.py
+++ b/release/scripts/startup/bl_ui/space_filebrowser.py
@@ -86,7 +86,7 @@ class FILEBROWSER_HT_header(Header):
                 row.prop(params, "use_filter_blendid", text="")
                 if params.use_filter_blendid:
                     row.separator()
-                    row.prop(params, "filter_id", text="")
+                    row.prop(params, "filter_id_category", text="")
 
             row.separator()
             row.prop(params, "filter_search", text="", icon='VIEWZOOM')
@@ -223,5 +223,24 @@ class FILEBROWSER_PT_recent_folders(Panel):
             col.operator("file.reset_recent", icon='X', text="")
 
 
+class FILEBROWSER_PT_advanced_filter(Panel):
+    bl_space_type = 'FILE_BROWSER'
+    bl_region_type = 'TOOLS'
+    bl_category = "Filter"
+    bl_label = "Advanced Filter"
+
+    def draw(self, context):
+        layout = self.layout
+        space = context.space_data
+        params = space.params
+
+        if params and params.use_library_browsing:
+            layout.prop(params, "use_filter_blendid")
+            if params.use_filter_blendid:
+                layout.separator()
+                col = layout.column()
+                col.prop(params, "filter_id")
+
+
 if __name__ == "__main__":  # only for live edit.
     bpy.utils.register_module(__name__)
diff --git a/source/blender/makesrna/intern/rna_space.c 
b/source/blender/makesrna/intern/rna_space.c
index 8a43dd8..5cbef4e 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -3754,7 +3754,7 @@ static void rna_def_fileselect_params(BlenderRNA *brna)
        static EnumPropertyItem file_filter_idtypes_items[] = {
                {FILTER_ID_AC, "ACTION", ICON_ANIM_DATA, "Actions", "Show/hide 
Action datablocks"},
                {FILTER_ID_AR, "ARMATURE", ICON_ARMATURE_DATA, "Armatures", 
"Show/hide Armature datablocks"},
-               {FILTER_ID_BR, "BRUSH", ICON_BRUSH_DATA, "Brushes", "Show/hide 
Brushe datablocks"},
+               {FILTER_ID_BR, "BRUSH", ICON_BRUSH_DATA, "Brushes", "Show/hide 
Brushes datablocks"},
                {FILTER_ID_CA, "CAMERA", ICON_CAMERA_DATA, "Cameras", 
"Show/hide Camera datablocks"},
                {FILTER_ID_CU, "CURVE", ICON_CURVE_DATA, "Curves", "Show/hide 
Curve datablocks"},
                {FILTER_ID_GD, "GREASE_PENCIL", ICON_GREASEPENCIL, "Grease 
Pencil", "Show/hide Grease pencil datablocks"},
@@ -3782,6 +3782,27 @@ static void rna_def_fileselect_params(BlenderRNA *brna)
                {0, NULL, 0, NULL, NULL}
        };
 
+       static EnumPropertyItem file_filter_idcategories_items[] = {
+           {FILTER_ID_SCE,
+            "SCENE", ICON_SCENE_DATA, "Scenes", "Show/hide scenes"},
+           {FILTER_ID_AC,
+            "ANIMATION", ICON_ANIM_DATA, "Animations", "Show/hide animation 
data"},
+               {FILTER_ID_OB | FILTER_ID_GR,
+            "OBJECT", ICON_GROUP, "Objects & Groups", "Show/hide objects and 
groups"},
+               {FILTER_ID_AR | FILTER_ID_CU | FILTER_ID_LT | FILTER_ID_MB | 
FILTER_ID_ME,
+            "GEOMETRY", ICON_MESH_DATA, "Geometry", "Show/hide meshes, curves, 
lattice, armatures and metaballs data"},
+               {FILTER_ID_LS | FILTER_ID_MA | FILTER_ID_NT | FILTER_ID_TE,
+            "SHADING", ICON_MATERIAL_DATA, "Shading",
+            "Show/hide materials, nodetrees, textures and Freestyle's 
linestyles"},
+               {FILTER_ID_IM | FILTER_ID_MC | FILTER_ID_MSK | FILTER_ID_SO,
+            "IMAGE", ICON_IMAGE_DATA, "Images & Sounds", "Show/hide images, 
movie clips, sounds and masks"},
+               {FILTER_ID_CA | FILTER_ID_LA | FILTER_ID_SPK | FILTER_ID_WO,
+            "ENVIRONMENT", ICON_WORLD_DATA, "Environment", "Show/hide worlds, 
lamps, cameras and speakers"},
+               {FILTER_ID_BR | FILTER_ID_GD | FILTER_ID_PAL | FILTER_ID_PC | 
FILTER_ID_TXT | FILTER_ID_VF,
+            "MISC", ICON_GREASEPENCIL, "Miscellaneous", "Show/hide other data 
types"},
+           {0, NULL, 0, NULL, NULL}
+       };
+
        srna = RNA_def_struct(brna, "FileSelectParams", NULL);
        RNA_def_struct_ui_text(srna, "File Select Parameters", "File Select 
Parameters");
 
@@ -3900,6 +3921,13 @@ static void rna_def_fileselect_params(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "Filter ID types", "Which ID types to 
show/hide, when browsing a library");
        RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL);
 
+       prop = RNA_def_property(srna, "filter_id_category", PROP_ENUM, 
PROP_NONE);
+       RNA_def_property_enum_sdna(prop, NULL, "filter_id");
+       RNA_def_property_enum_items(prop, file_filter_idcategories_items);
+       RNA_def_property_flag(prop, PROP_ENUM_FLAG);
+       RNA_def_property_ui_text(prop, "Filter ID categories", "Which ID 
categories to show/hide, when browsing a library");
+       RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL);
+
        prop = RNA_def_property(srna, "filter_glob", PROP_STRING, PROP_NONE);
        RNA_def_property_string_sdna(prop, NULL, "filter_glob");
        RNA_def_property_ui_text(prop, "Extension Filter", "");

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to