diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-07-03 20:50:00 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-07-03 20:55:01 +0300 |
commit | 9e5002adedf4e701a4761c4d7f2754dcdcbb4067 (patch) | |
tree | f4bb9afd1a3943629c8f0d5d3202a6b7c234f99b /source/blender/makesrna/intern | |
parent | 16878072a499d1b328e8f2eb968e5fd4829d996b (diff) |
UI: optional ui-unit-width for popovers
Some popovers don't fit well with the default width,
allow panels to adjust as needed.
Diffstat (limited to 'source/blender/makesrna/intern')
-rw-r--r-- | source/blender/makesrna/intern/rna_ui.c | 5 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_wm_api.c | 5 |
2 files changed, 8 insertions, 2 deletions
diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c index bb7af5f327d..9d13cb8f7f0 100644 --- a/source/blender/makesrna/intern/rna_ui.c +++ b/source/blender/makesrna/intern/rna_ui.c @@ -1165,6 +1165,11 @@ static void rna_def_panel(BlenderRNA *brna) RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); RNA_def_property_ui_text(prop, "Parent ID Name", "If this is set, the panel becomes a subpanel"); + prop = RNA_def_property(srna, "bl_ui_units_x", PROP_INT, PROP_UNSIGNED); + RNA_def_property_int_sdna(prop, NULL, "type->ui_units_x"); + RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); + RNA_def_property_ui_text(prop, "Units X", "When set, defines popup panel width"); + prop = RNA_def_property(srna, "use_pin", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", PNL_PIN); RNA_def_property_ui_text(prop, "Pin", ""); diff --git a/source/blender/makesrna/intern/rna_wm_api.c b/source/blender/makesrna/intern/rna_wm_api.c index afb12f48e28..f398c4143ae 100644 --- a/source/blender/makesrna/intern/rna_wm_api.c +++ b/source/blender/makesrna/intern/rna_wm_api.c @@ -376,12 +376,12 @@ static void rna_PopMenuEnd(bContext *C, PointerRNA *handle) } /* popover wrapper */ -static PointerRNA rna_PopoverBegin(bContext *C) +static PointerRNA rna_PopoverBegin(bContext *C, int ui_units_x) { PointerRNA r_ptr; void *data; - data = (void *)UI_popover_begin(C); + data = (void *)UI_popover_begin(C, U.widget_unit * ui_units_x); RNA_pointer_create(NULL, &RNA_UIPopover, data, &r_ptr); @@ -602,6 +602,7 @@ void RNA_api_wm(StructRNA *srna) /* wrap UI_popover_begin */ func = RNA_def_function(srna, "popover_begin__internal", "rna_PopoverBegin"); RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT); + RNA_def_property(func, "ui_units_x", PROP_INT, PROP_UNSIGNED); /* return */ parm = RNA_def_pointer(func, "menu", "UIPopover", "", ""); RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_RNAPTR); |