[Bf-blender-cvs] [51836539515] master: UI: Make menu item use theme roundness

Pablo Vazquez noreply at git.blender.org
Wed Oct 13 14:31:04 CEST 2021


Commit: 518365395152e516af235366f4be908a40343b87
Author: Pablo Vazquez
Date:   Wed Oct 13 14:28:55 2021 +0200
Branches: master
https://developer.blender.org/rB518365395152e516af235366f4be908a40343b87

UI: Make menu item use theme roundness

Menu items ignore the roundness setting since they spread left to right.
This patch makes it so menu items use the theme preference instead of
hardcoded square corners. Providing more flexibility to themes.

All built-in and included themes already have this set so no need to update them. For the default themes (Dark/Light) roundness is 0.4.

{F10950727, size=full}

The motivations behind this change are:
* To be more consistent with other widgets.
* Improve themes flexibility.
* Match padding with other elements that have like the Search field:

{F10950746, size=full}

Reviewed By: #user_interface, Severin

Differential Revision: https://developer.blender.org/D12813

===================================================================

M	source/blender/editors/interface/interface_widgets.c

===================================================================

diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index a1534ab4b7f..6727d812e1e 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -4052,9 +4052,15 @@ static void widget_menu_itembut(uiWidgetColors *wcol,
   uiWidgetBase wtb;
   widget_init(&wtb);
 
-  /* not rounded, no outline */
+  /* Padding on the sides. */
+  const float padding = 0.125f * BLI_rcti_size_y(rect);
+  rect->xmin += padding;
+  rect->xmax -= padding;
+
+  /* No outline. */
   wtb.draw_outline = false;
-  round_box_edges(&wtb, 0, rect, 0.0f);
+  const float rad = wcol->roundness * BLI_rcti_size_y(rect);
+  round_box_edges(&wtb, UI_CNR_ALL, rect, rad);
 
   widgetbase_draw(&wtb, wcol);
 }



More information about the Bf-blender-cvs mailing list