diff options
Diffstat (limited to 'source/blender/makesrna/intern/rna_space.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_space.c | 69 |
1 files changed, 52 insertions, 17 deletions
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index b0226b09b88..ca857fb7be8 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -420,19 +420,19 @@ const EnumPropertyItem rna_enum_file_sort_items[] = { {FILE_SORT_ALPHA, "FILE_SORT_ALPHA", ICON_SORTALPHA, - "Sort alphabetically", + "Name", "Sort the file list alphabetically"}, {FILE_SORT_EXTENSION, "FILE_SORT_EXTENSION", ICON_SORTBYEXT, - "Sort by extension", + "Extension", "Sort the file list by extension/type"}, {FILE_SORT_TIME, "FILE_SORT_TIME", ICON_SORTTIME, - "Sort by time", + "Modified Date", "Sort files by modification time"}, - {FILE_SORT_SIZE, "FILE_SORT_SIZE", ICON_SORTSIZE, "Sort by size", "Sort files by size"}, + {FILE_SORT_SIZE, "FILE_SORT_SIZE", ICON_SORTSIZE, "Size", "Sort files by size"}, {0, NULL, 0, NULL, NULL}, }; @@ -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; @@ -5133,25 +5145,25 @@ static void rna_def_fileselect_params(BlenderRNA *brna) PropertyRNA *prop; static const EnumPropertyItem file_display_items[] = { - {FILE_SHORTDISPLAY, - "LIST_SHORT", - ICON_SHORTDISPLAY, - "Short List", - "Display files as short list"}, - {FILE_LONGDISPLAY, - "LIST_LONG", + {FILE_VERTICALDISPLAY, + "LIST_VERTICAL", ICON_LONGDISPLAY, - "Long List", - "Display files as a detailed list"}, + "Vertical List", + "Display files as a vertical list"}, + {FILE_HORIZONTALDISPLAY, + "LIST_HORIZONTAL", + ICON_SHORTDISPLAY, + "Horizontal List", + "Display files as a horizontal list"}, {FILE_IMGDISPLAY, "THUMBNAIL", ICON_IMGDISPLAY, "Thumbnails", "Display files as thumbnails"}, {0, NULL, 0, NULL, NULL}, }; static const EnumPropertyItem display_size_items[] = { - {32, "TINY", 0, "Tiny", ""}, - {64, "SMALL", 0, "Small", ""}, + {64, "TINY", 0, "Tiny", ""}, + {96, "SMALL", 0, "Small", ""}, {128, "NORMAL", 0, "Regular", ""}, - {256, "LARGE", 0, "Large", ""}, + {192, "LARGE", 0, "Large", ""}, {0, NULL, 0, NULL, NULL}, }; @@ -5267,7 +5279,10 @@ static void rna_def_fileselect_params(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Title", "Title for the file browser"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); - prop = RNA_def_property(srna, "directory", PROP_STRING, PROP_DIRPATH); + /* Use BYTESTRING rather than DIRPATH as subtype so UI code doesn't add OT_directory_browse + * button when displaying this prop in the file browser (it would just open a file browser). That + * should be the only effective difference between the two. */ + prop = RNA_def_property(srna, "directory", PROP_STRING, PROP_BYTESTRING); RNA_def_property_string_sdna(prop, NULL, "dir"); RNA_def_property_ui_text(prop, "Directory", "Directory displayed in the file browser"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL); @@ -5275,6 +5290,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); @@ -5295,6 +5311,19 @@ static void rna_def_fileselect_params(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Recursion", "Numbers of dirtree levels to show simultaneously"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL); + prop = RNA_def_property(srna, "show_details_size", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "details_flags", FILE_DETAILS_SIZE); + RNA_def_property_ui_text(prop, "File Size", "Draw a column listing the size of each file"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL); + + prop = RNA_def_property(srna, "show_details_datetime", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "details_flags", FILE_DETAILS_DATETIME); + RNA_def_property_ui_text( + prop, + "File Modification Date", + "Draw a column listing the date and time of modification for each file"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL); + prop = RNA_def_property(srna, "use_filter", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", FILE_FILTER); RNA_def_property_ui_text(prop, "Filter Files", "Enable filtering of files"); @@ -5311,6 +5340,12 @@ static void rna_def_fileselect_params(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Sort", ""); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL); + prop = RNA_def_property(srna, "use_sort_invert", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", FILE_SORT_INVERT); + RNA_def_property_ui_text( + prop, "Reverse Sorting", "Sort items descending, from highest value to lowest"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL); + prop = RNA_def_property(srna, "use_filter_image", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "filter", FILE_TYPE_IMAGE); RNA_def_property_ui_text(prop, "Filter Images", "Show image files"); |