[Bf-blender-cvs] [b95d371a83e] filebrowser_redesign: Disable the file name button for directory-only browsing

Julian Eisel noreply at git.blender.org
Tue Aug 27 14:18:50 CEST 2019


Commit: b95d371a83eaf3bc7a86c0ae6221d281ecfac5dc
Author: Julian Eisel
Date:   Tue Aug 27 14:18:25 2019 +0200
Branches: filebrowser_redesign
https://developer.blender.org/rBb95d371a83eaf3bc7a86c0ae6221d281ecfac5dc

Disable the file name button for directory-only browsing

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

M	source/blender/makesrna/intern/rna_space.c

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

diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index 99853739c01..dbb9c101773 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -2142,6 +2142,18 @@ static void rna_SpaceClipEditor_view_type_update(Main *UNUSED(bmain),
 
 /* File browser. */
 
+int rna_FileSelectParams_filename_editable(struct PointerRNA *ptr, const char **r_info)
+{
+  FileSelectParams *params = ptr->data;
+
+  if (params && (params->flag & FILE_DIRSEL_ONLY)) {
+    *r_info = "Only directories can be chosen for the current operation.";
+    return 0;
+  }
+
+  return params ? PROP_EDITABLE : 0;
+}
+
 static bool rna_FileSelectParams_use_lib_get(PointerRNA *ptr)
 {
   FileSelectParams *params = ptr->data;
@@ -5283,6 +5295,7 @@ static void rna_def_fileselect_params(BlenderRNA *brna)
   prop = RNA_def_property(srna, "filename", PROP_STRING, PROP_FILENAME);
   RNA_def_property_string_sdna(prop, NULL, "file");
   RNA_def_property_ui_text(prop, "File Name", "Active file in the file browser");
+  RNA_def_property_editable_func(prop, "rna_FileSelectParams_filename_editable");
   RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL);
 
   prop = RNA_def_property(srna, "use_library_browsing", PROP_BOOLEAN, PROP_NONE);



More information about the Bf-blender-cvs mailing list