diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-03-20 14:40:38 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-03-20 15:10:34 +0300 |
commit | a1addc5c633d4c35eeb491c698052ec9300271dc (patch) | |
tree | 2f8cf2086db19233c3e641662f8a3cd540a5fd1e /source/blender/makesrna/intern | |
parent | 69fb859909c8e99a8e5e9e06607992d5b9a41473 (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/makesrna/intern')
-rw-r--r-- | source/blender/makesrna/intern/rna_ui.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c index 5bc647493cc..7c10b3eff77 100644 --- a/source/blender/makesrna/intern/rna_ui.c +++ b/source/blender/makesrna/intern/rna_ui.c @@ -881,6 +881,16 @@ static void rna_UILayout_active_set(PointerRNA *ptr, bool value) uiLayoutSetActive(ptr->data, value); } +static bool rna_UILayout_activate_init_get(PointerRNA *ptr) +{ + return uiLayoutGetActivateInit(ptr->data); +} + +static void rna_UILayout_activate_init_set(PointerRNA *ptr, bool value) +{ + uiLayoutSetActivateInit(ptr->data, value); +} + static bool rna_UILayout_alert_get(PointerRNA *ptr) { return uiLayoutGetRedAlert(ptr->data); @@ -1056,6 +1066,13 @@ static void rna_def_ui_layout(BlenderRNA *brna) prop = RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_funcs(prop, "rna_UILayout_active_get", "rna_UILayout_active_set"); + prop = RNA_def_property(srna, "activate_init", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_funcs(prop, "rna_UILayout_activate_init_get", "rna_UILayout_activate_init_set"); + RNA_def_property_ui_text( + prop, "Activate on Init", + "When true, buttons defined in popups will be activated on first display " + "(use so you can type into a field without having to click on it first)"); + prop = RNA_def_property(srna, "operator_context", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, rna_enum_operator_context_items); RNA_def_property_enum_funcs(prop, "rna_UILayout_op_context_get", "rna_UILayout_op_context_set", NULL); |