diff --git a/source/blender/editors/interface/interface_widgets.cc b/source/blender/editors/interface/interface_widgets.cc index 74cac98d589..7593e309739 100644 --- a/source/blender/editors/interface/interface_widgets.cc +++ b/source/blender/editors/interface/interface_widgets.cc @@ -2637,6 +2637,21 @@ static float widget_radius_from_rcti(const rcti *rect, const uiWidgetColors *wco /** \} */ +/* -------------------------------------------------------------------- */ +/** \name Widget Emboss Helper + * + * The emboss is supposed to indicate a shadow under the bottom edge of buttons to help them stand + * out. For multiple vertically aligned buttons it's only meant to display under the buttons at the + * bottom. + * \{ */ + +static bool draw_emboss(const uiBut *but) +{ + return (but->drawflag & UI_BUT_ALIGN_DOWN) == 0; +} + +/** \} */ + /* -------------------------------------------------------------------- */ /** \name Widget Types * \{ */ @@ -3494,16 +3509,12 @@ static void widget_numbut_draw(const uiBut *but, /* outline */ wtb.draw_inner = false; - const bool horizontal = BLI_rctf_size_x(&but->block->rect) > - BLI_rctf_size_y(&but->block->rect); - wtb.draw_emboss = horizontal || (roundboxalign & (UI_CNR_BOTTOM_LEFT | UI_CNR_BOTTOM_RIGHT)); + wtb.draw_emboss = draw_emboss(but); widgetbase_draw(&wtb, wcol); } else { /* inner and outline */ - const bool horizontal = BLI_rctf_size_x(&but->block->rect) > - BLI_rctf_size_y(&but->block->rect); - wtb.draw_emboss = horizontal || (roundboxalign & (UI_CNR_BOTTOM_LEFT | UI_CNR_BOTTOM_RIGHT)); + wtb.draw_emboss = draw_emboss(but); widgetbase_draw(&wtb, wcol); } @@ -4420,9 +4431,7 @@ static void widget_box(uiBut *but, const float rad = widget_radius_from_zoom(zoom, wcol); round_box_edges(&wtb, roundboxalign, rect, rad); - - const bool horizontal = BLI_rctf_size_x(&but->block->rect) > BLI_rctf_size_y(&but->block->rect); - wtb.draw_emboss = horizontal || (roundboxalign & (UI_CNR_BOTTOM_LEFT | UI_CNR_BOTTOM_RIGHT)); + wtb.draw_emboss = draw_emboss(but); widgetbase_draw(&wtb, wcol); copy_v3_v3_uchar(wcol->inner, old_col); @@ -4478,8 +4487,7 @@ static void widget_roundbut_exec(uiBut *but, /* half rounded */ round_box_edges(&wtb, roundboxalign, rect, rad); - const bool horizontal = BLI_rctf_size_x(&but->block->rect) > BLI_rctf_size_y(&but->block->rect); - wtb.draw_emboss = horizontal || (roundboxalign & (UI_CNR_BOTTOM_LEFT | UI_CNR_BOTTOM_RIGHT)); + wtb.draw_emboss = draw_emboss(but); widgetbase_draw(&wtb, wcol); }