Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Golter <paulgolter>2021-10-14 15:40:48 +0300
committerSebastian Parborg <darkdefende@gmail.com>2021-10-14 15:42:43 +0300
commit240345842dd1594709433df1ff3448c55968254d (patch)
treee16d86c3e2b1f43e1c2750cb9631b81f64aaa551 /source/blender/makesrna/intern/rna_space_api.c
parent9ca567bc4e99403c2574f823922933da5cbc20ec (diff)
Filebrowser: Expose file select functions for File Browser to Python API.
This patch adds activate_file_by_relative_path(relative_path="") and deselect_all() function to the space api of the File Browser. While the first sets the active file and adds it to the selection based on a relative path to the current File Browser directory the second one deselects all files but does not change the active file. Differential Revision: https://developer.blender.org/D12826 Reviewed by: Julian Eisel
Diffstat (limited to 'source/blender/makesrna/intern/rna_space_api.c')
-rw-r--r--source/blender/makesrna/intern/rna_space_api.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_space_api.c b/source/blender/makesrna/intern/rna_space_api.c
index 205a88edf84..295ecf590bb 100644
--- a/source/blender/makesrna/intern/rna_space_api.c
+++ b/source/blender/makesrna/intern/rna_space_api.c
@@ -134,6 +134,18 @@ void RNA_api_space_filebrowser(StructRNA *srna)
0,
"",
"Whether to activate the ID immediately (false) or after the file browser refreshes (true)");
+
+ /* Select file by relative path. */
+ func = RNA_def_function(
+ srna, "activate_file_by_relative_path", "ED_fileselect_activate_by_relpath");
+ RNA_def_function_ui_description(func,
+ "Set active file and add to selection based on relative path to "
+ "current File Browser directory");
+ RNA_def_property(func, "relative_path", PROP_STRING, PROP_FILEPATH);
+
+ /* Deselect all files. */
+ func = RNA_def_function(srna, "deselect_all", "ED_fileselect_deselect_all");
+ RNA_def_function_ui_description(func, "Deselect all files");
}
#endif