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/makesrna/intern/rna_ui.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'source/blender/makesrna/intern/rna_ui.c') 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); -- cgit v1.2.3