From a1addc5c633d4c35eeb491c698052ec9300271dc Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 20 Mar 2019 22:40:38 +1100 Subject: UI: support for popups starting with buttons activated While this could already be done from C, this is now exposed to Python --- source/blender/editors/interface/interface_layout.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'source/blender/editors/interface/interface_layout.c') diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index a828c19be54..95791dc8811 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -160,6 +160,7 @@ struct uiLayout { short space; bool align; bool active; + bool activate_init; bool enabled; bool redalert; bool keepaspect; @@ -1818,6 +1819,9 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index if (layout->redalert) UI_but_flag_enable(but, UI_BUT_REDALERT); + + if (layout->activate_init) + UI_but_flag_enable(but, UI_BUT_ACTIVATE_ON_INIT); } /* single button */ else { @@ -1831,6 +1835,9 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index if (layout->redalert) UI_but_flag_enable(but, UI_BUT_REDALERT); + + if (layout->activate_init) + UI_but_flag_enable(but, UI_BUT_ACTIVATE_ON_INIT); } /* Mark non-embossed textfields inside a listbox. */ @@ -3949,6 +3956,11 @@ void uiLayoutSetActive(uiLayout *layout, bool active) layout->active = active; } +void uiLayoutSetActivateInit(uiLayout *layout, bool activate_init) +{ + layout->activate_init = activate_init; +} + void uiLayoutSetEnabled(uiLayout *layout, bool enabled) { layout->enabled = enabled; @@ -4019,6 +4031,11 @@ bool uiLayoutGetActive(uiLayout *layout) return layout->active; } +bool uiLayoutGetActivateInit(uiLayout *layout) +{ + return layout->activate_init; +} + bool uiLayoutGetEnabled(uiLayout *layout) { return layout->enabled; -- cgit v1.2.3