From bbc1a5393a13ea73e218f62d443b95f5a40b8a76 Mon Sep 17 00:00:00 2001 From: Thomas Barlow Date: Fri, 1 Sep 2023 05:39:38 +0100 Subject: [PATCH] UI: Change menu icons of single-choice enums to radio buttons Checkboxes are usually used when multiple choices can be made from multiple options. Radio buttons are usually used when only a single choice can be made from multiple options. Enum properties that do not have PROP_ENUM_FLAG can only have a single chosen value, so this patch changes their menu icons from checkboxes to radio buttons. Affected UI primarily includes use of UILayout.prop_menu_enum in Python- defined UI, such as View>Display Size in the Asset Browser and File Browser, and the menu for changing a Brush's tool in the Brush Specials menu. --- source/blender/editors/interface/interface_layout.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/blender/editors/interface/interface_layout.cc b/source/blender/editors/interface/interface_layout.cc index ba7d4225ec8..5159acfaeaf 100644 --- a/source/blender/editors/interface/interface_layout.cc +++ b/source/blender/editors/interface/interface_layout.cc @@ -2172,7 +2172,8 @@ void uiItemFullR(uiLayout *layout, icon = (enum_value & value) ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT; } else { - icon = (enum_value == value) ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT; + /* Only a single value can be chosen, so display as radio buttons. */ + icon = (enum_value == value) ? ICON_RADIOBUT_ON : ICON_RADIOBUT_OFF; } } } -- 2.30.2