[Bf-blender-cvs] [f06ed97] asset-experiments: Do not show ID-types filtering when we are not browsing libs!

Bastien Montagne noreply at git.blender.org
Tue Dec 9 17:48:16 CET 2014


Commit: f06ed97ce759f7673dab702ba21ffd5ce37671ff
Author: Bastien Montagne
Date:   Tue Dec 9 14:56:30 2014 +0100
Branches: asset-experiments
https://developer.blender.org/rBf06ed97ce759f7673dab702ba21ffd5ce37671ff

Do not show ID-types filtering when we are not browsing libs!

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

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 5df0993..9c51acc 100644
--- a/release/scripts/startup/bl_ui/space_filebrowser.py
+++ b/release/scripts/startup/bl_ui/space_filebrowser.py
@@ -29,7 +29,7 @@ class FILEBROWSER_HT_header(Header):
 
         st = context.space_data
 
-        is_lib_browser = True  # TODO: Add a solid way to know whether we are browsing libs or not!!!
+        is_lib_browser = st.use_library_browsing
 
         layout.template_header()
 
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index 532437b..97e24d3 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -1375,6 +1375,13 @@ static void rna_SpaceClipEditor_view_type_update(Main *UNUSED(bmain), Scene *UNU
 	ED_area_tag_refresh(sa);
 }
 
+static int rna_SpaceFileBrowser_use_lib_get(PointerRNA *ptr)
+{
+	SpaceFile *sf = ptr->data;
+
+	return sf->params && (sf->params->type == FILE_LOADLIB);
+}
+
 #else
 
 static EnumPropertyItem dt_uv_items[] = {
@@ -3360,6 +3367,11 @@ static void rna_def_space_filebrowser(BlenderRNA *brna)
 	prop = RNA_def_property(srna, "operator", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "op");
 	RNA_def_property_ui_text(prop, "Active Operator", "");
+
+	prop = RNA_def_property(srna, "use_library_browsing", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_ui_text(prop, "Library Browser", "Whether this file browser may browse blender files or not");
+	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+	RNA_def_property_boolean_funcs(prop, "rna_SpaceFileBrowser_use_lib_get", NULL);
 }
 
 static void rna_def_space_info(BlenderRNA *brna)




More information about the Bf-blender-cvs mailing list