UI: Discrete Thumbnail Sizes for Menus #112455

Merged
Harley Acheson merged 3 commits from Harley/blender:ThumbnailSizeDiscrete into main 2023-09-22 18:49:10 +02:00
2 changed files with 21 additions and 8 deletions

View File

@ -505,7 +505,7 @@ class FILEBROWSER_MT_view(FileBrowserMenu, Menu):
layout.separator()
layout.prop_menu_enum(params, "display_size")
layout.prop_menu_enum(params, "display_size_discrete")
layout.prop_menu_enum(params, "recursion_level")
layout.separator()
@ -567,7 +567,7 @@ class FILEBROWSER_MT_context_menu(FileBrowserMenu, Menu):
layout.prop_menu_enum(params, "display_type")
if params.display_type == 'THUMBNAIL':
layout.prop_menu_enum(params, "display_size")
layout.prop_menu_enum(params, "display_size_discrete")
layout.prop_menu_enum(params, "recursion_level", text="Recursions")
layout.prop_menu_enum(params, "sort_method")
@ -667,7 +667,7 @@ class ASSETBROWSER_MT_view(AssetBrowserMenu, Menu):
layout.separator()
layout.prop_menu_enum(params, "display_size")
layout.prop_menu_enum(params, "display_size_discrete")
layout.separator()
@ -841,7 +841,7 @@ class ASSETBROWSER_MT_context_menu(AssetBrowserMenu, Menu):
layout.separator()
if params.display_type == 'THUMBNAIL':
layout.prop_menu_enum(params, "display_size")
layout.prop_menu_enum(params, "display_size_discrete")
classes = (

View File

@ -6736,6 +6736,15 @@ static void rna_def_fileselect_params(BlenderRNA *brna)
{0, nullptr, 0, nullptr, nullptr},
};
static const EnumPropertyItem display_size_items[] = {
{32, "TINY", 0, "Tiny", ""},
{64, "SMALL", 0, "Small", ""},
{96, "NORMAL", 0, "Medium", ""},
{128, "BIG", 0, "Big", ""},
{192, "LARGE", 0, "Large", ""},
{0, nullptr, 0, nullptr, nullptr},
};
srna = RNA_def_struct(brna, "FileSelectParams", nullptr);
Harley marked this conversation as resolved Outdated

Don't think "Huge" is a useful size. Plus "Huge" is a weird term to see in a UI :) I rather have a "Normal" size, and then two smaller, and two bigger.

Don't think "Huge" is a useful size. Plus "Huge" is a weird term to see in a UI :) I rather have a "Normal" size, and then two smaller, and two bigger.
RNA_def_struct_path_func(srna, "rna_FileSelectParams_path");
RNA_def_struct_ui_text(srna, "File Select Parameters", "File Select Parameters");
@ -6913,13 +6922,17 @@ static void rna_def_fileselect_params(BlenderRNA *brna)
prop = RNA_def_property(srna, "display_size", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, nullptr, "thumbnail_size");
RNA_def_property_ui_text(prop,
"Display Size",
"Change the size of the display (width of columns or thumbnails size)");
RNA_def_property_ui_text(prop, "Display Size", "Change the size of thumbnails");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_LIST, nullptr);
RNA_def_property_int_default(prop, 96);
RNA_def_property_range(prop, 16, 256);
RNA_def_property_ui_range(prop, 24, 256, 16, 0);
RNA_def_property_ui_range(prop, 24, 256, 1, 0);
prop = RNA_def_property(srna, "display_size_discrete", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, nullptr, "thumbnail_size");
RNA_def_property_enum_items(prop, display_size_items);
RNA_def_property_ui_text(prop, "Display Size", "Change the size of thumbnails in discrete steps");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_LIST, nullptr);
}
static void rna_def_fileselect_asset_params(BlenderRNA *brna)