Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2019-03-20 14:40:38 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-03-20 15:10:34 +0300
commita1addc5c633d4c35eeb491c698052ec9300271dc (patch)
tree2f8cf2086db19233c3e641662f8a3cd540a5fd1e /source/blender/editors/interface/interface.c
parent69fb859909c8e99a8e5e9e06607992d5b9a41473 (diff)
UI: support for popups starting with buttons activated
While this could already be done from C, this is now exposed to Python
Diffstat (limited to 'source/blender/editors/interface/interface.c')
-rw-r--r--source/blender/editors/interface/interface.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index 1e079835ec5..16c87b7a7d7 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -823,6 +823,24 @@ bool UI_but_active_only(const bContext *C, ARegion *ar, uiBlock *block, uiBut *b
return true;
}
+bool UI_block_active_only_flagged_buttons(const bContext *C, ARegion *ar, uiBlock *block)
+{
+ bool done = false;
+ for (uiBut *but = block->buttons.first; but; but = but->next) {
+ if (!done && ui_but_is_editable(but)) {
+ if (but->flag & UI_BUT_ACTIVATE_ON_INIT) {
+ if (UI_but_active_only(C, ar, block, but)) {
+ done = true;
+ }
+ }
+ }
+ but->flag &= ~UI_BUT_ACTIVATE_ON_INIT;
+ }
+ return done;
+}
+
+
+
/* simulate button click */
void UI_but_execute(const bContext *C, uiBut *but)
{