UI: support property split for 'prop_search'
This commit is contained in:
parent
17e9870221
commit
80d86f303a
|
@ -701,6 +701,7 @@ static uiBut *ui_item_with_label(
|
|||
PropertyType type;
|
||||
PropertySubType subtype;
|
||||
int prop_but_width = w_hint;
|
||||
const bool use_prop_sep = ((layout->item.flag & UI_ITEM_PROP_SEP) != 0);
|
||||
|
||||
sub = uiLayoutRow(layout, layout->align);
|
||||
UI_block_layout_set_current(block, sub);
|
||||
|
@ -708,15 +709,25 @@ static uiBut *ui_item_with_label(
|
|||
if (name[0]) {
|
||||
int w_label;
|
||||
|
||||
if (ui_layout_vary_direction(layout) == UI_ITEM_VARY_X) {
|
||||
/* w_hint is width for label in this case. Use a default width for property button(s) */
|
||||
prop_but_width = UI_UNIT_X * 5;
|
||||
w_label = w_hint;
|
||||
if (use_prop_sep) {
|
||||
w_label = (int)((w_hint * 2) * UI_ITEM_PROP_SEP_DIVIDE);
|
||||
}
|
||||
else {
|
||||
w_label = w_hint / 3;
|
||||
if (ui_layout_vary_direction(layout) == UI_ITEM_VARY_X) {
|
||||
/* w_hint is width for label in this case. Use a default width for property button(s) */
|
||||
prop_but_width = UI_UNIT_X * 5;
|
||||
w_label = w_hint;
|
||||
}
|
||||
else {
|
||||
w_label = w_hint / 3;
|
||||
}
|
||||
}
|
||||
|
||||
uiBut *but_label = uiDefBut(block, UI_BTYPE_LABEL, 0, name, x, y, w_label, h, NULL, 0.0, 0.0, 0, 0, "");
|
||||
if (use_prop_sep) {
|
||||
but_label->drawflag |= UI_BUT_TEXT_RIGHT;
|
||||
but_label->drawflag &= ~UI_BUT_TEXT_LEFT;
|
||||
}
|
||||
uiDefBut(block, UI_BTYPE_LABEL, 0, name, x, y, w_label, h, NULL, 0.0, 0.0, 0, 0, "");
|
||||
}
|
||||
|
||||
type = RNA_property_type(prop);
|
||||
|
@ -1851,6 +1862,7 @@ void uiItemPointerR(uiLayout *layout, struct PointerRNA *ptr, const char *propna
|
|||
StructRNA *icontype;
|
||||
int w, h;
|
||||
char namestr[UI_MAX_NAME_STR];
|
||||
const bool use_prop_sep = ((layout->item.flag & UI_ITEM_PROP_SEP) != 0);
|
||||
|
||||
/* validate arguments */
|
||||
prop = RNA_struct_find_property(ptr, propname);
|
||||
|
@ -1893,7 +1905,9 @@ void uiItemPointerR(uiLayout *layout, struct PointerRNA *ptr, const char *propna
|
|||
if (!name)
|
||||
name = RNA_property_ui_name(prop);
|
||||
|
||||
name = ui_item_name_add_colon(name, namestr);
|
||||
if (use_prop_sep == false) {
|
||||
name = ui_item_name_add_colon(name, namestr);
|
||||
}
|
||||
|
||||
/* create button */
|
||||
block = uiLayoutGetBlock(layout);
|
||||
|
|
Loading…
Reference in New Issue