diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-07-30 03:57:47 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-07-30 03:57:47 +0300 |
commit | 369b574fd5ae9522133344ecddab4fff5ee50225 (patch) | |
tree | 1b165000c280bc0a4d11a0148e0424b63ef11fd3 /source/blender/makesrna/intern/rna_wm_api.c | |
parent | a345f56ce3331a0f1e2436142ac11654626752fe (diff) |
UI: add use_button option to popovers
This is useful when popovers are launched from operators
instead of as button popover types.
Where the connection between the button and the popover is useful to keep.
Diffstat (limited to 'source/blender/makesrna/intern/rna_wm_api.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_wm_api.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/source/blender/makesrna/intern/rna_wm_api.c b/source/blender/makesrna/intern/rna_wm_api.c index 1fea87df10c..d9306ba7a65 100644 --- a/source/blender/makesrna/intern/rna_wm_api.c +++ b/source/blender/makesrna/intern/rna_wm_api.c @@ -471,12 +471,12 @@ static void rna_PopMenuEnd(bContext *C, PointerRNA *handle) } /* popover wrapper */ -static PointerRNA rna_PopoverBegin(bContext *C, int ui_units_x) +static PointerRNA rna_PopoverBegin(bContext *C, int ui_units_x, bool from_active_button) { PointerRNA r_ptr; void *data; - data = (void *)UI_popover_begin(C, U.widget_unit * ui_units_x); + data = (void *)UI_popover_begin(C, U.widget_unit * ui_units_x, from_active_button); RNA_pointer_create(NULL, &RNA_UIPopover, data, &r_ptr); @@ -821,6 +821,8 @@ void RNA_api_wm(StructRNA *srna) parm = RNA_def_pointer(func, "menu", "UIPopover", "", ""); RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_RNAPTR); RNA_def_function_return(func, parm); + RNA_def_boolean( + func, "from_active_button", 0, "Use Button", "Use the active button for positioning"); /* wrap UI_popover_end */ func = RNA_def_function(srna, "popover_end__internal", "rna_PopoverEnd"); |