Commit: 9ece0ee5fe27ab83faacec7ec56824884088bbc2
Author: Campbell Barton
Date:   Fri Nov 3 00:45:30 2017 +1100
Branches: master
https://developer.blender.org/rB9ece0ee5fe27ab83faacec7ec56824884088bbc2

UI: add UI_SELECT_DRAW flag

Allow to draw as pressed w/o interfering with behavior.

Resolves issue where buttons raised on mouse-over.

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

M       source/blender/editors/interface/interface_intern.h
M       source/blender/editors/interface/interface_layout.c
M       source/blender/editors/interface/interface_widgets.c

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

diff --git a/source/blender/editors/interface/interface_intern.h 
b/source/blender/editors/interface/interface_intern.h
index 7ee18549342..537ecf8c65b 100644
--- a/source/blender/editors/interface/interface_intern.h
+++ b/source/blender/editors/interface/interface_intern.h
@@ -119,6 +119,7 @@ enum {
        UI_ACTIVE       = (1 << 2),
        UI_HAS_ICON     = (1 << 3),
        UI_HIDDEN       = (1 << 4),
+       UI_SELECT_DRAW  = (1 << 5),  /* Display selected, doesn't impact 
interaction. */
        /* warn: rest of uiBut->flag in UI_interface.h */
 };
 
diff --git a/source/blender/editors/interface/interface_layout.c 
b/source/blender/editors/interface/interface_layout.c
index f0179cb852f..a6bbe725403 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -846,7 +846,7 @@ static uiBut *uiItemFullO_ptr_ex(
                UI_block_emboss_set(block, UI_EMBOSS);
 
        if (flag & UI_ITEM_O_DEPRESS) {
-               but->flag |= UI_SELECT;
+               but->flag |= UI_SELECT_DRAW;
        }
 
        if (layout->redalert)
diff --git a/source/blender/editors/interface/interface_widgets.c 
b/source/blender/editors/interface/interface_widgets.c
index 9c80b30100d..78090c67770 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -67,7 +67,7 @@
 #define ICON_SIZE_FROM_BUTRECT(rect) (0.8f * BLI_rcti_size_y(rect))
 
 #define UI_BUT_FLAGS_PUBLIC \
-       (UI_SELECT | UI_SCROLLED | UI_ACTIVE | UI_HAS_ICON | UI_HIDDEN)
+       (UI_SELECT | UI_SCROLLED | UI_ACTIVE | UI_HAS_ICON | UI_HIDDEN | 
UI_SELECT_DRAW)
 
 /* Don't overlap w/ UI_BUT_FLAGS_PUBLIC buts. */
 enum {
@@ -3909,6 +3909,10 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle 
*style, uiBut *but, rct
 
                state = but->flag & UI_BUT_FLAGS_PUBLIC;
 
+               if (state & UI_SELECT_DRAW) {
+                       state |= UI_SELECT;
+               }
+
                if ((but->editstr) ||
                    (UNLIKELY(but->flag & UI_BUT_DRAG_MULTI) && 
ui_but_drag_multi_edit_get(but)))
                {

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to