UI: Preference to Always Show Number Arrows
Numerical inputs have little arrows on the left and right to allow quick increment/decrement of the value. But these are only shown on hover, which does not help if using a device that does not have a hover state (some pens, most touch). This PR adds a user preference to show them always. Pull Request: https://projects.blender.org/blender/blender/pulls/145374
This commit is contained in:
committed by
Harley Acheson
parent
a9588e46e1
commit
f7cdd3e867
@@ -293,8 +293,13 @@ class USERPREF_PT_interface_editors(InterfacePanel, CenterAlignMixIn, Panel):
|
||||
|
||||
col = layout.column()
|
||||
col.prop(system, "use_region_overlap")
|
||||
|
||||
col = layout.column(heading="Show", align=True)
|
||||
col.prop(view, "show_area_handle")
|
||||
col.prop(view, "show_number_arrows", text="Numeric Input Arrows")
|
||||
col.prop(view, "show_navigate_ui")
|
||||
|
||||
col = layout.column()
|
||||
col.prop(view, "border_width")
|
||||
col.prop(view, "color_picker_type")
|
||||
col.row().prop(view, "header_align")
|
||||
|
||||
@@ -1147,7 +1147,7 @@ void blo_do_versions_userdef(UserDef *userdef)
|
||||
|
||||
if (!USER_VERSION_ATLEAST(280, 44)) {
|
||||
userdef->uiflag &= ~USER_NO_MULTITOUCH_GESTURES;
|
||||
userdef->uiflag2 &= ~USER_UIFLAG2_UNUSED_0;
|
||||
userdef->uiflag2 &= ~USER_ALWAYS_SHOW_NUMBER_ARROWS;
|
||||
userdef->gp_settings &= ~GP_PAINT_UNUSED_0;
|
||||
}
|
||||
|
||||
|
||||
@@ -3604,7 +3604,9 @@ static void widget_numbut_draw(const uiBut *but,
|
||||
}
|
||||
|
||||
/* decoration */
|
||||
if ((state->but_flag & UI_HOVER) && !state->is_text_input) {
|
||||
if (((state->but_flag & UI_HOVER) || (U.uiflag2 & USER_ALWAYS_SHOW_NUMBER_ARROWS)) &&
|
||||
!state->is_text_input)
|
||||
{
|
||||
uiWidgetColors wcol_zone;
|
||||
uiWidgetBase wtb_zone;
|
||||
rcti rect_zone;
|
||||
@@ -3617,6 +3619,9 @@ static void widget_numbut_draw(const uiBut *but,
|
||||
|
||||
wcol_zone = *wcol;
|
||||
copy_v3_v3_uchar(wcol_zone.item, wcol->text);
|
||||
if (!(state->but_flag & UI_HOVER)) {
|
||||
wcol_zone.item[3] = 180;
|
||||
}
|
||||
if (state->but_drawflag & UI_BUT_HOVER_LEFT) {
|
||||
widget_active_color(&wcol_zone);
|
||||
}
|
||||
@@ -3637,6 +3642,9 @@ static void widget_numbut_draw(const uiBut *but,
|
||||
|
||||
wcol_zone = *wcol;
|
||||
copy_v3_v3_uchar(wcol_zone.item, wcol->text);
|
||||
if (!(state->but_flag & UI_HOVER)) {
|
||||
wcol_zone.item[3] = 180;
|
||||
}
|
||||
if (state->but_drawflag & UI_BUT_HOVER_RIGHT) {
|
||||
widget_active_color(&wcol_zone);
|
||||
}
|
||||
@@ -3656,7 +3664,9 @@ static void widget_numbut_draw(const uiBut *but,
|
||||
|
||||
wcol_zone = *wcol;
|
||||
copy_v3_v3_uchar(wcol_zone.item, wcol->text);
|
||||
if (!(state->but_drawflag & (UI_BUT_HOVER_LEFT | UI_BUT_HOVER_RIGHT))) {
|
||||
if ((state->but_flag & UI_HOVER) &&
|
||||
!(state->but_drawflag & (UI_BUT_HOVER_LEFT | UI_BUT_HOVER_RIGHT)))
|
||||
{
|
||||
widget_active_color(&wcol_zone);
|
||||
}
|
||||
|
||||
|
||||
@@ -808,7 +808,7 @@ typedef enum eUserpref_UI_Flag {
|
||||
* \note don't add new flags here, use 'uiflag' which has flags free.
|
||||
*/
|
||||
typedef enum eUserpref_UI_Flag2 {
|
||||
USER_UIFLAG2_UNUSED_0 = (1 << 0), /* cleared */
|
||||
USER_ALWAYS_SHOW_NUMBER_ARROWS = (1 << 0), /* cleared */
|
||||
USER_REGION_OVERLAP = (1 << 1),
|
||||
USER_UIFLAG2_UNUSED_2 = (1 << 2),
|
||||
USER_UIFLAG2_UNUSED_3 = (1 << 3), /* dirty */
|
||||
|
||||
@@ -4944,6 +4944,14 @@ static void rna_def_userdef_view(BlenderRNA *brna)
|
||||
RNA_def_property_ui_text(prop, "Corner Handles", "Show visible area maintenance corner handles");
|
||||
RNA_def_property_update(prop, 0, "rna_userdef_gpu_update");
|
||||
|
||||
prop = RNA_def_property(srna, "show_number_arrows", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "uiflag2", USER_ALWAYS_SHOW_NUMBER_ARROWS);
|
||||
RNA_def_property_ui_text(
|
||||
prop,
|
||||
"Show Numeric Input Arrows",
|
||||
"Display arrows in numeric input fields for increasing or decreasing values");
|
||||
RNA_def_property_update(prop, 0, "rna_userdef_update");
|
||||
|
||||
prop = RNA_def_property(srna, "show_object_info", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "uiflag", USER_DRAWVIEWINFO);
|
||||
RNA_def_property_ui_text(prop,
|
||||
|
||||
Reference in New Issue
Block a user