13#include <fmt/format.h>
42#include "RNA_prototypes.hh"
62#define UI_PROP_DECORATE
65#define UI_PROP_SEP_ICON_WIDTH_EXCEPTION
75#define UI_OPERATOR_ERROR_RET(_ot, _opname, _caller_fn_name) \
76 if (ot == nullptr) { \
77 item_disabled(this, _opname); \
78 RNA_warning_bare("%s: '%s' unknown operator", _caller_fn_name, _opname); \
329 memcpy(namestr, name.
data(),
len);
331 namestr[
len + 1] =
'\0';
343 memcpy(namestr, name.
data(),
len);
345 namestr[
len + 1] =
'\0';
365 if (
all > available) {
368 return available - pos;
371 const float width = *extra_pixel + (item * available) /
float(
all);
372 *extra_pixel = width - int(width);
379 return available - pos;
382 const float width = *extra_pixel + (item * available) /
float(
all);
383 *extra_pixel = width - int(width);
390#define UI_ITEM_VARY_X 1
391#define UI_ITEM_VARY_Y 2
449 return unit_x * (1.0f + pad_factor.
icon_only);
454 return unit_x * (1.0f + pad_factor.
icon_only);
461 float margin = pad_factor.
text;
463 margin += pad_factor.
icon;
468 int(
ceilf(unit_x * margin));
488 return static_cast<const Layout *
>(
this)->
size();
547 const auto *bitem =
static_cast<const ButtonItem *
>(item);
549 bitem->but->rect.ymax += delta;
552 auto *layout =
static_cast<Layout *
>(item);
554 for (
Item *sub : layout->items()) {
560static void item_move(
Item *item,
const int delta_xmin,
const int delta_xmax)
577 if (delta_xmin > 0) {
578 layout->
x_ += delta_xmin;
581 layout->
w_ += delta_xmax;
603 switch (this->
type()) {
625 sub = &layout->
row(align);
628 sub = &layout->
column(align);
648 value_array.
fill(
false);
649 value_array[
index] =
true;
676 const bool icon_only,
678 const bool show_text)
690 if (!name.
is_empty() && show_text) {
691 uiDefBut(block,
ButtonType::Label, name, 0, 0,
w,
UI_UNIT_Y,
nullptr, 0.0, 0.0,
"");
697 const int cols = (
len >= 20) ? 2 : 1;
698 const int colbuts =
len / (2 * cols);
700 uint layer_active = 0;
707 for (
int b = 0;
b < cols;
b++) {
710 for (
int a = 0; a < colbuts; a++) {
711 const int layer_num = a +
b * colbuts;
712 const uint layer_flag = (1u << layer_num);
714 if (layer_used & layer_flag) {
715 if (layer_active & layer_flag) {
716 icon = ICON_LAYER_ACTIVE;
719 icon = ICON_LAYER_USED;
727 block, ptr, prop, layer_num,
"", icon,
x + butw * a,
y + buth, butw, buth);
732 for (
int a = 0; a < colbuts; a++) {
733 const int layer_num = a +
len / 2 +
b * colbuts;
734 const uint layer_flag = (1u << layer_num);
736 if (layer_used & layer_flag) {
737 if (layer_active & layer_flag) {
738 icon = ICON_LAYER_ACTIVE;
741 icon = ICON_LAYER_USED;
749 block, ptr, prop, layer_num,
"", icon,
x + butw * a,
y, butw, buth);
760 int totdim, dim_size[ 3];
774 for (
int a = 0; a <
len; a++) {
778 col = a % dim_size[1];
779 row = a / dim_size[1];
822 char str[3] = {
'\0'};
824 if (!icon_only && show_text) {
831 bool *boolarr =
nullptr;
839 const char *str_buf = show_text ?
str :
"";
840 for (
int a = 0; a <
len; a++) {
841 if (!icon_only && show_text) {
845 icon = boolarr[a] ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT;
848 const int width_item = ((compact && type ==
PROP_BOOLEAN) ?
854 block, ptr, prop, a, str_buf, icon, 0, 0, width_item,
UI_UNIT_Y, button_type);
881 if (!(current_value & enum_value)) {
882 current_value = enum_value;
885 current_value &= enum_value;
898 const std::optional<StringRef> uiname,
901 const bool icon_only,
905 const char *name = (!uiname || !uiname->is_empty()) ? item->
name :
"";
906 const int icon = item->
icon;
907 const int value = item->
value;
911 if (icon && name[0] && !icon_only) {
913 block, but_type, icon, name, 0, 0, itemw, h, ptr, prop, -1, 0, value, std::nullopt);
916 const int w = (is_first) ? itemw :
ceilf(itemw -
U.pixelsize);
918 block, but_type, icon, 0, 0,
w, h, ptr, prop, -1, 0, value, std::nullopt);
922 block, but_type, name, 0, 0, itemw, h, ptr, prop, -1, 0, value, std::nullopt);
947 const std::optional<StringRef> uiname,
950 const bool icon_only)
980 Layout *layout_radial =
nullptr;
983 layout_radial = &layout->
menu_pie();
988 layout_radial = layout;
1009 if (!item->identifier[0]) {
1022 else if (radial && layout_radial) {
1033 layout, block, ptr, prop, uiname, h, but_type, icon_only, item, is_first);
1046 const std::optional<StringRef> uiname,
1048 const bool icon_only)
1059 const std::optional<StringRef> uiname,
1061 const bool icon_only,
1082 for (
Button &tab : block->
buttons() | std::views::drop(start_size)) {
1090 const bool use_custom_highlight = (prop_highlight !=
nullptr);
1092 if (use_custom_highlight) {
1096 const int end = std::min<int>(start_size + highlight_array_len, block->
buttons_ptrs.size());
1097 for (
int i = start_size; i < end; i++) {
1144 std::optional<ButtonType> button_type_override,
1145 const char *caller_fn_name)
1148 int prop_but_width = w_hint;
1149#ifdef UI_PROP_DECORATE
1150 Layout *layout_prop_decorate =
nullptr;
1158 RNA_warning_bare(
"%s: Data is not a keymap item struct: %s. Ignoring 'full_event' option.",
1168 || use_prop_decorate
1175 sub = &layout->
row(layout->
align());
1180#ifdef UI_PROP_DECORATE
1195 w_label = w_hint / 3;
1197 uiDefBut(block,
ButtonType::Label, name,
x,
y, w_label, h,
nullptr, 0.0, 0.0,
"");
1217 button_type_override);
1219 if (but !=
nullptr) {
1233 subtype ==
PROP_DIRPATH ?
"BUTTONS_OT_directory_browse" :
1234 "BUTTONS_OT_file_browse",
1260 std::string kmi_str =
1281 std::make_optional<StringRefNull>(
"");
1283 block, ptr, prop,
index,
str, icon,
x,
y, prop_but_width, h, button_type_override);
1299 const std::optional<bke::path_templates::VariableMap> variables =
1316#ifdef UI_PROP_DECORATE
1318 if (use_prop_decorate) {
1319 (layout_prop_decorate ? layout_prop_decorate : sub)->label(
nullptr, ICON_BLANK1);
1334 Button *prevbut =
nullptr;
1339 *r_is_userdef =
false;
1375 if (but->
tip ==
nullptr || but->
tip[0] ==
'\0') {
1398 block,
ButtonType::Label, name, 0, 0,
w,
UI_UNIT_Y,
nullptr, 0.0, 0.0,
"");
1409 std::optional<StringRef> name,
1418 std::string operator_name;
1422 name = operator_name.c_str();
1446 if (!name->is_empty()) {
1448 block,
ButtonType::But, ot, context, icon, *name, 0, 0,
w,
UI_UNIT_Y, std::nullopt);
1520 const char *menu_id =
static_cast<const char *
>(but->
hold_argN);
1527 layout->
label(
RPT_(
"Menu Missing:"), ICON_NONE);
1528 layout->
label(menu_id, ICON_NONE);
1534 std::optional<StringRef> name,
1545 std::optional<StringRef> name,
1549 const char *menu_id)
1558 const std::optional<StringRef> name,
1565 return this->
op(ot, name, icon,
context, flag);
1587 RNA_warning_bare(
"UILayout.operator_enum_items(): %s.%s, not an enum type",
1618 split = &this->split(0.0f,
false);
1622 bool last_iter =
false;
1624 for (
int i = 1; item->
identifier && !last_iter; i++, item++) {
1632 for (tmp = item + 1; tmp->
identifier; tmp++) {
1674 if (item->
icon || radial) {
1721 if (!ot || !ot->
srna) {
1724 ot ?
"operator missing srna" :
"unknown operator",
1821 bool is_checkbox_only =
false;
1822 if (name.
is_empty() && !icon_only) {
1824 name =
"non-empty text";
1827 if (icon == ICON_NONE) {
1829 is_checkbox_only =
true;
1845 if (item->identifier[0]) {
1871 if (name.
is_empty() && icon == ICON_NONE) {
1895 else if (is_checkbox_only) {
1898 else if (type ==
PROP_ENUM && !icon_only) {
1928 for (
Layout *parent = cur_layout; parent; parent = parent->
parent()) {
1929 if (!parent->heading().is_empty()) {
1940 bool respect_prop_split)
1948 if (respect_prop_split) {
1979 return layout_split;
1987 const std::optional<StringRef> name_opt,
1989 const std::optional<StringRef> placeholder)
2005 bool use_prop_sep_split_label = use_prop_sep;
2008#ifdef UI_PROP_DECORATE
2009 struct DecorateInfo {
2010 bool use_prop_decorate;
2015 DecorateInfo ui_decorate{};
2034 const bool no_icon = (toggle == 0);
2047 if (use_prop_sep ==
false) {
2052 if (use_prop_sep ==
false) {
2061 if (use_prop_sep ==
false) {
2067 if (no_icon ==
false) {
2068 if (icon == ICON_NONE) {
2081 icon = ICON_CHECKBOX_DEHLT;
2083 else if (is_array) {
2085 ICON_CHECKBOX_DEHLT;
2096 icon = ICON_CHECKBOX_DEHLT;
2099 icon = (enum_value & value) ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT;
2103 icon = (enum_value == value) ? ICON_RADIOBUT_ON : ICON_RADIOBUT_OFF;
2110#ifdef UI_PROP_SEP_ICON_WIDTH_EXCEPTION
2113 use_prop_sep_split_label =
false;
2116 use_split_empty_name =
true;
2142 Layout *layout_parent =
this;
2145 Layout *layout_row =
nullptr;
2146#ifdef UI_PROP_DECORATE
2147 if (ui_decorate.use_prop_decorate) {
2148 layout_row = &layout->
row(
true);
2154 if (name.
is_empty() && !use_split_empty_name) {
2156 layout = &(layout_row ? layout_row : layout)->
column(
true);
2158 if (heading_layout) {
2165 bool label_added =
false;
2173 if (!use_prop_sep_split_label) {
2177 fmt::memory_buffer name_with_suffix;
2178 char str[2] = {
'\0'};
2179 for (
int a = 0; a <
len; a++) {
2181 const bool use_prefix = (a == 0 && !name.
is_empty());
2183 fmt::format_to(fmt::appender(name_with_suffix),
"{} {}", name,
str[0]);
2187 use_prefix ?
StringRef(name_with_suffix.data(), name_with_suffix.size()) :
2204 but =
uiDefBut(
block,
ButtonType::Label, name, 0, 0,
w,
UI_UNIT_Y,
nullptr, 0.0, 0.0,
"");
2211 if (!label_added && heading_layout) {
2224 layout = &layout_split->
row(
true);
2227 layout = &layout_split->
column(
true);
2231 if (use_prop_sep_split_label) {
2234 layout = &layout_split->
column(
true);
2239#ifdef UI_PROP_DECORATE
2240 if (ui_decorate.use_prop_decorate) {
2241 ui_decorate.layout = &layout_row->
column(
true);
2242 ui_decorate.layout->space_ = 0;
2252 else if (heading_layout) {
2260 if (inside_prop_sep) {
2263 layout = &layout->
column(
true);
2282 !use_prop_sep_split_label);
2286 if (icon && !name.
is_empty() && !icon_only) {
2288 block,
ButtonType::Row, icon, name, 0, 0,
w, h, ptr,
prop, -1, 0, value, std::nullopt);
2292 block,
ButtonType::Row, icon, 0, 0,
w, h, ptr,
prop, -1, 0, value, std::nullopt);
2296 block,
ButtonType::Row, name, 0, 0,
w, h, ptr,
prop, -1, 0, value, std::nullopt);
2320 if (is_id_name_prop) {
2341 but =
uiDefAutoButR(
block, ptr,
prop,
index, name, icon, 0, 0,
w, h, button_type);
2373 if (but && no_icon) {
2374 if ((icon == ICON_NONE) && (but->
icon != ICON_NONE)) {
2394 static_cast<ButtonText *
>(but)->use_label_style =
true;
2398#ifdef UI_PROP_DECORATE
2399 if (ui_decorate.use_prop_decorate) {
2409 Layout *layout_col = &ui_decorate.layout->column(
false);
2414 for (i = 0; i < ui_decorate.len && but_decorate; i++) {
2427 but_decorate =
nullptr;
2444 if (but && icon_only) {
2452 const std::optional<StringRef> name,
2473 const std::optional<StringRefNull> name,
2475 const char *panel_type)
2479 this->prop(ptr,
prop,
index, value, flag, name, icon);
2490 RNA_warning_bare(
"UILayout.prop_with_popover(): property could not use a popover: %s.%s (%s)",
2500 const std::optional<StringRefNull> name,
2502 const char *menu_type)
2519 const std::optional<StringRefNull> name,
2521 const char *menu_type)
2525 this->prop(ptr,
prop,
index, value, flag, name, icon);
2526 while (i < block->buttons_ptrs.size()) {
2537 RNA_warning_bare(
"UILayout.prop_with_menu(): property could not use a menu: %s.%s (%s)",
2547 const std::optional<StringRefNull> name,
2565 const std::optional<StringRefNull> name,
2589 RNA_warning_bare(
"UILayout.prop_enum(): enum property value not found: %s", value);
2594 if (item[a].identifier[0] ==
'\0') {
2598 if (item[a].value == ivalue) {
2603 this->prop(ptr,
prop,
RNA_ENUM_VALUE, ivalue, flag, item_name, icon ? icon : item[a].icon);
2616 const std::optional<StringRefNull> name,
2620 if (
prop ==
nullptr) [[unlikely]] {
2660 for (
int i = 0; i < totitem; i++) {
2661 if (item[i].identifier[0]) {
2703 if (ptype == srna) {
2716 MEM_delete(coll_search);
2725 const bool results_are_suggestions)
2728 bool has_search_fn =
false;
2743 if (has_search_fn || searchprop) {
2811 std::optional<StringRefNull> name_opt,
2812 std::optional<StringRefNull> placeholder,
2813 const int initial_visible_lines)
2818 initial_visible_lines);
2825 std::optional<StringRefNull> name_opt,
2826 std::optional<StringRefNull> placeholder)
2863 const std::optional<StringRefNull> name_opt,
2865 bool results_are_suggestions)
2873 RNA_warning_bare(
"UILayout.prop_search(): Property %s.%s must be a pointer, string or enum",
2880 "UILayout.prop_search(): search collection property is not a collection type: %s.%s",
2887 "UILayout.prop_search(): Search collection items' property is not a string type: %s.%s",
2894 if (icon == ICON_NONE) {
2908 if (use_prop_sep ==
false) {
2930 "UILayout.prop_search()");
2933 but, ptr,
prop, searchptr, searchprop, item_searchprop, results_are_suggestions);
2940 const std::optional<StringRefNull> name,
2953 RNA_warning_bare(
"UILayout.prop_search(): search collection property not found: %s.%s",
2955 searchpropname.
c_str());
2959 this->
prop_search(ptr,
prop, searchptr, searchprop,
nullptr, name, icon,
false);
2980 const std::optional<StringRef> tip,
2997 if (icon == ICON_NONE && force_menu) {
3000 else if (force_menu) {
3001 pad_factor.
text = 1.85;
3005 pad_factor.
text = 0.75f;
3012 if (heading_layout) {
3022 if (force_menu && !name.
is_empty()) {
3027 but =
uiDefMenuBut(block, func, arg, name, 0, 0,
w, h, tip);
3033 but->
poin =
reinterpret_cast<char *
>(but);
3077 if (mt ==
nullptr) {
3078 RNA_warning_bare(
"UILayout.menu(): not found %s", std::string(menuname).c_str());
3081 this->
menu(mt, name, icon);
3087 if (mt ==
nullptr) {
3088 RNA_warning_bare(
"UILayout.menu_contents(): not found %s", std::string(menuname).c_str());
3141 TIP_(
"Animate property")));
3158 if (ptr && propname) {
3176 const std::optional<StringRef> name_opt,
3190 const bool ok = (pt->
poll ==
nullptr) || pt->
poll(
C, pt);
3192 layout = &this->
row(
true);
3220 std::optional<StringRef> name_opt,
3225 if (pt ==
nullptr) {
3227 std::string(panel_type).c_str());
3230 this->
popover(
C, pt, name_opt, icon);
3236 bContext *
C,
int space_id,
int region_id,
const char *
context,
const char *category)
3239 if (st ==
nullptr) {
3244 if (art ==
nullptr) {
3245 RNA_warning_bare(
"UILayout.popover(): region type not found %d", region_id);
3254 if (pt.
poll ==
nullptr || pt.
poll(
C, &pt)) {
3255 this->
popover(
C, &pt, std::nullopt, ICON_NONE);
3270 std::optional<StringRef> tooltip = std::nullopt,
3296 but =
uiDefIconBut(block, but_type, icon, 0, 0,
w,
UI_UNIT_Y,
nullptr, 0.0, 0.0, tooltip);
3299 but =
uiDefBut(block, but_type, name, 0, 0,
w,
UI_UNIT_Y,
nullptr, 0.0, 0.0, tooltip);
3323 Layout *layout,
const StringRef name,
int icon,
const bool highlight,
const bool redalert)
3388 if (
G.debug_value == 4002) {
3394 const int dummy_width = 1;
3396 this->
block(),
ButtonType::Label, text, 0, 0, dummy_width, 0,
nullptr, 0, 0, std::nullopt));
3417 if (old_image_but->
key != key) {
3420 return old_image_but;
3430 ImBuf *ibuf =
nullptr;
3432 ibuf =
reinterpret_cast<ImBuf *
>(std::exchange(old_but->poin,
nullptr));
3433 old_but->key.clear();
3445 return ibuf !=
nullptr;
3452 if (!ot || !ot->
srna) {
3455 ot ?
"operator missing srna" :
"unknown operator",
3468 layout = &layout->
row(
false);
3486 block,
ButtonType::But, ot,
context, icon, name, 0, 0,
w,
UI_UNIT_Y, std::nullopt);
3530 Layout *layout_row = &parent_layout->
row(
true);
3538 &layout_row->
column(
true) :
3541 return split_wrapper;
3577 std::function<
void(
bContext &)> func,
3578 std::optional<StringRef> tooltip)
3595 const int space = (is_menu) ?
int(7.0f *
UI_SCALE_FAC * factor) :
3636 const bool has_text = text && text[0];
3643 else if (has_text) {
3679 printf(
"Error: separator_spacer() not supported in popups.\n");
3684 printf(
"Error: separator_spacer() only supported in horizontal blocks.\n");
3690 block,
ButtonType::SeprSpacer,
"", 0, 0, 0.3f *
UI_UNIT_X,
UI_UNIT_Y,
nullptr, 0.0, 0.0,
"");
3699 item_menu(
this, name, icon, func, arg,
nullptr,
"",
false);
3709 item_menu(
this, name, icon, func, argN, argN,
"",
false);
3771 std::optional<StringRefNull> name,
3777 std::string operator_name;
3780 name = operator_name.c_str();
3787 MenuItemLevel *lvl = MEM_new<MenuItemLevel>(
"MenuItemLevel");
3849 const std::optional<StringRefNull> name,
3856 MenuItemLevel *lvl = MEM_new<MenuItemLevel>(
"MenuItemLevel");
3922 bool min_size_flag =
true;
3927 if (this->
items().is_empty()) {
3931 const Item *item_last = this->
items().last();
3933 const bool is_item_last = (item == item_last);
3936 min_size_flag = min_size_flag && item->fixed_size();
3941 if (!is_item_last) {
3946 if (min_size_flag) {
3958 if (this->
items().is_empty()) {
3962 int last_free_item_idx = -1;
3963 int x, neww, newtotw, minw,
offset;
3964 int freew, fixedx, freex, flag = 0, lastw = 0;
3973 totw += item->size().x;
3986 const Item *item_last = this->
items().last();
4000 const bool is_item_last = (item == item_last);
4005 if (
w - lastw > 0) {
4006 neww =
item_fit(
size.x,
x, totw,
w - lastw, is_item_last, this->alignment(), &extra_pixel);
4014 bool min_flag = item->fixed_size();
4025 if ((neww < minw || min_flag) &&
w != 0) {
4054 const bool is_item_last = (item == item_last);
4064 minw, fixedx, fixedw,
min_ii(
w, fixedw), is_item_last, this->
alignment(), &extra_pixel);
4070 size.x, freex, freew,
w - fixedw, is_item_last, this->alignment(), &extra_pixel);
4072 last_free_item_idx = item_idx;
4078 if (freew + fixedw > 0 && freew + fixedw <
w) {
4079 offset =
w - (fixedw + freew);
4083 if (freew + fixedw > 0 && freew + fixedw <
w) {
4084 offset = (
w - (fixedw + freew)) / 2;
4092 if (!is_item_last) {
4098 int extra_pixel_move =
w_ - (
x -
x_);
4102 item_move(this->
items()[last_free_item_idx], 0, extra_pixel_move);
4103 Span<Item *> items_after_last_free = this->
items().drop_front(last_free_item_idx + 1);
4104 for (
Item *item : items_after_last_free) {
4105 item_move(item, extra_pixel_move, extra_pixel_move);
4117 const Item *next_item,
4120 if (next_item ==
nullptr) {
4144 if (item != litem->
items().first()) {
4157 bool min_size_flag =
true;
4162 for (
const auto *iter = this->
items().
begin(); iter != this->
items().end(); iter++) {
4166 min_size_flag = min_size_flag && item->
fixed_size();
4171 const Item *next_item = (item == this->
items().last()) ?
nullptr : *(iter + 1);
4176 if (min_size_flag) {
4189 for (
const auto *iter = this->
items().
begin(); iter != this->
items().end(); iter++) {
4196 const Item *next_item = (item == this->
items().last()) ?
nullptr : *(iter + 1);
4216 printf(
"Warning: Pie menus with more than %i items are currently unsupported\n",
4261 int minx =
x, miny =
y, maxx =
x, maxy =
y;
4273 const float factor[2] = {
4274 (vec[0] > 0.01f) ? 0.0f : ((vec[0] < -0.01f) ? -1.0f : -0.5f),
4275 (vec[1] > 0.99f) ? 0.0f : ((vec[1] < -0.99f) ? -1.0f : -0.5f),
4280 bool use_dir =
true;
4308 x + (vec[0] * pie_radius) + (factor[0] *
size.x),
4309 y + (vec[1] * pie_radius) + (factor[1] *
size.y),
4313 minx =
min_ii(minx,
x + (vec[0] * pie_radius) - (
size.x / 2));
4314 maxx =
max_ii(maxx,
x + (vec[0] * pie_radius) + (
size.x / 2));
4315 miny =
min_ii(miny,
y + (vec[1] * pie_radius) - (
size.y / 2));
4316 maxy =
max_ii(maxy,
y + (vec[1] * pie_radius) + (
size.y / 2));
4488 maxw = std::max(maxw,
size.x);
4514 const int emh = toth / flow->
totcol;
4527 if (col < flow->
totcol - 1 && emy <= -emh) {
4558 emh = toth / this->
totcol;
4575 if (col < this->
totcol - 1 && emy <= -emh) {
4581 const int remaining_width =
w_ - (
x -
x_);
4582 const int remaining_width_between_columns = (this->
totcol - col - 1) * style->
columnspace;
4583 const int remaining_columns = this->
totcol - col;
4584 w = (remaining_width - remaining_width_between_columns) / remaining_columns;
4629 float tot_w = 0.0f, tot_h = 0.0f;
4630 float global_avg_w = 0.0f, global_totweight_w = 0.0f;
4631 int global_max_h = 0;
4635 results->
tot_w ==
nullptr));
4638 results->
tot_h ==
nullptr));
4659 for (
const Item *item : items) {
4660 const int2 size = item->size();
4662 global_avg_w +=
float(size.x * size.x);
4663 global_totweight_w +=
float(size.x);
4664 global_max_h =
max_ii(global_max_h, size.y);
4672 avg_w[index_col] +=
float(size.x * size.x);
4673 totweight_w[index_col] +=
float(size.x);
4675 max_h[index_row] =
max_ii(max_h[index_row], size.y);
4685 global_avg_w /= global_totweight_w;
4688 avg_w[i] /= totweight_w[i];
4697 for (i = 0; i < parameters->
tot_rows; i++) {
4712 for (
int col = 0; col < parameters->
tot_columns; col++) {
4734 for (
int row = 0; row < parameters->
tot_rows; row++) {
4753 if (results->
tot_w) {
4756 if (results->
tot_h) {
4785 output.global_avg_w = &avg_w;
4786 output.global_max_h = &max_h;
4803 if (avg_w == 0.0f) {
4818 const int step = modulo ? modulo : 1;
4836 if (modulo && gflow->
tot_rows % modulo != 0) {
4930 const int w = widths[col];
4931 const int h = heights[
row];
4973 float scalex = 1.0f, scaley = 1.0f;
4974 int x,
y, newx, newy;
4995 if (
w_ && totw > 0) {
4998 if (
h_ && toth > 0) {
5003 y =
y_ - scaley * toth;
5009 if (scalex != 1.0f) {
5010 newx = (
offset.x - minx) * scalex;
5015 if (scaley != 1.0f) {
5016 newy = (
offset.y - miny) * scaley;
5039 float extra_pixel = 0.0f;
5040 const int tot = int(this->
items().
size());
5049 const float percentage = (this->percentage == 0.0f) ? 1.0f /
float(tot) : this->percentage;
5051 const int w = (
w_ - (tot - 1) *
space_);
5053 colw = std::max(colw, 0);
5055 const Item *item_last = this->
items().last();
5057 const bool is_item_last = (item == item_last);
5063 if (!is_item_last) {
5067 colw = std::max(colw, 0);
5120 litem->
w_ = layout->
w_;
5130 layout->
items_.append(litem);
5137 Layout *litem = MEM_new<LayoutRow>(__func__,
nullptr);
5157 open_prop_name.
c_str());
5162 RNA_warning_bare(
"UILayout.panel_prop(): %s.%s is not an boolean property",
5164 open_prop_name.
c_str());
5172 const bool is_open = is_real_open || search_filter_active;
5187 bool inside_layout_panel =
false;
5194 if (inside_layout_panel) {
5199 if (!is_popup || inside_layout_panel) {
5212 const int icon = is_open ? ICON_DOWNARROW_HLT : ICON_RIGHTARROW;
5220 return panel_layout;
5227 panel_layout.
body = body_litem;
5229 return panel_layout;
5237 const std::optional<StringRef>
label)
5240 if (!panel_layout.
header) {
5241 return panel_layout;
5249 return panel_layout;
5258 if (!panel_layout.
header) {
5263 return panel_layout.
body;
5275 return this->
panel_prop(
C, &state_ptr,
"is_open");
5280 const bool default_closed,
5286 return panel_layout.
body;
5291 if (layout.
items().is_empty()) {
5294 const Item *item = layout.
items().last();
5307 Layout *litem = MEM_new<LayoutColumn>(__func__,
nullptr);
5338 bool row_major,
int columns_len,
bool even_columns,
bool even_rows,
bool align)
5363 box->
roundbox =
uiDefBut(layout->
block(), type,
"", 0, 0, 0, 0,
nullptr, 0.0, 0.0,
"");
5384 Layout *litem = MEM_new<LayoutRadial>(__func__);
5432 Layout *litem = MEM_new<LayoutAbsolute>(__func__);
5442 Layout *litem = MEM_new<LayoutOverlap>(__func__);
5456 split->percentage = percentage;
5513 block,
ButtonType::Sepr,
"", 0, 0,
uiLayoutListItemPaddingWidth(), 0,
nullptr, 0.0, 0.0,
"");
5530 if ((block->
panel !=
nullptr) && (block->
panel->
type !=
nullptr)) {
5548 if (but->
optype !=
nullptr) {
5554 if (but->
rnaprop !=
nullptr) {
5558#ifdef PROPERTY_SEARCH_USE_TOOLTIPS
5574 if (items_array ==
nullptr) {
5579 for (
int i = 0; i < items_len; i++) {
5581 if (items_array[i].name ==
nullptr) {
5626 bool has_result =
false;
5642 if (search_filter ==
nullptr || search_filter[0] ==
'\0') {
5648 if (panel !=
nullptr) {
5658 const bool has_result = (panel_label_matches) ?
5662 if (panel !=
nullptr) {
5685 int2 size = item->size();
5686 int2 offset = item->offset();
5688 if (
scale[0] != 0.0f) {
5689 offset.x *=
scale[0];
5693 if (
scale[1] != 0.0f) {
5694 offset.y *=
scale[1];
5704 if (this->
items().is_empty()) {
5754 if (litem->
align()) {
5777 if (this->
items().is_empty()) {
5781 if (this->
align()) {
5817 int lines = button->
wrap_cache->wrapped_lines.size();
5819 lines = std::min(button->
max_lines, lines);
5821 const float height =
padding + line_height * lines;
5828 const ImBuf *ibuf =
reinterpret_cast<const ImBuf *
>(button->
poin);
5829 if (ibuf ==
nullptr || ibuf->
x <= 0 || ibuf->
y <= 0) {
5838 if (this->
items().is_empty()) {
5859 row_major = flow->row_major;
5860 rows = flow->tot_rows;
5861 cols = flow->tot_columns;
5868 cols = flow->totcol;
5869 rows = std::ceil(
float(flow->items().size() /
float(std::max(cols, 1))));
5874 int max_row_subitem_height = 0;
5876 int max_row_subitem_height_new = 0;
5879 const int i = (row_major ? (
row * cols + col) : (col * rows +
row));
5880 if (i >= this->
items_.size()) {
5885 max_row_subitem_height = std::max(max_row_subitem_height,
size.y);
5892 const auto *sub_bitem =
static_cast<const ButtonItem *
>(subitem);
5906 const int2 new_size = subitem->
size();
5907 max_row_subitem_height_new = std::max(max_row_subitem_height_new, new_size.y);
5910 y_offs += std::max(max_row_subitem_height_new - max_row_subitem_height, 0);
5952 block,
ButtonType::Sepr,
"", 0, 0, root->
padding, root->
padding,
nullptr, 0.0, 0.0,
"");
5969 root->
style = style;
5970 root->
block = block;
5974 const char *func = __func__;
5978 return MEM_new<LayoutColumn>(func, root);
5981 return MEM_new<LayoutRootPieMenu>(func, root);
6032 ButtonItem *bitem = MEM_new<ButtonItem>(__func__);
6046 layout->
items_.append(bitem);
6074 for (
Item *item : child_list) {
6078 if (bitem->
but == but) {
6084 static_cast<Layout *
>(item), but);
6101 return (bitem->
but == but);
6118 layout,
static_cast<const Button *
>(old_but_ptr));
6123 bitem->
but = new_but;
6158 int2 block_size = {0, 0};
6171 block->
layouts.clear_no_delete();
6180 return !block->
layouts.is_empty();
6199 return std::nullopt;
6213 return std::nullopt;
6233 bool arg_used =
false;
6238 if (copy_arg !=
nullptr && arg_used) {
6239 arg = copy_arg(arg);
6256 if (free_arg !=
nullptr && !arg_used) {
6268 bool arg_used =
false;
6273 if (copy_arg !=
nullptr && arg_used) {
6274 arg = copy_arg(arg);
6290 if (free_arg !=
nullptr && !arg_used) {
6312 if (r_prop !=
nullptr) {
6319 if ((ot !=
nullptr) && (r_prop !=
nullptr)) {
6355 printf(
"%s: opening menu \"%s\"\n", __func__, mt->
idname);
6369 context_store = *layout->
context();
6372 if (previous_context_store) {
6417 if (support_layout_panel) {
6425 Layout *header =
nullptr;
6429 header = panel_layout.
header;
6430 body = panel_layout.
body;
6433 header = &layout->
row(
false);
6434 body = &layout->
column(
false);
6467 if (child_pt->
poll ==
nullptr || child_pt->
poll(
C, child_pt)) {
6502 fmt::format_to(ds,
"'type':{}, ",
int(but->
type));
6503 fmt::format_to(ds,
"'draw_string':'''{}''', ", but->
drawstr);
6505 fmt::format_to(ds,
"'tip':'''{}''', ", but->
tip);
6514 fmt::format_to(ds,
"'operator':'''{}''', ", opstr);
6523 fmt::format_to(ds,
"'operator':'''{}''', ", opstr);
6530 "'rna':'{}.{}[{}]', ",
6539 fmt::format_to(ds,
"[");
6541 for (
const Item *item : items) {
6543 fmt::format_to(ds,
"{{");
6545#define CASE_ITEM(type, name) \
6547 fmt::format_to(ds, "'type': '{}', ", name); \
6552 switch (item->type()) {
6571 switch (item->type()) {
6576 fmt::format_to(ds,
"'items':");
6581 fmt::format_to(ds,
"}}");
6583 if (item != items.
last()) {
6584 fmt::format_to(ds,
", ");
6589 fmt::format_to(ds,
"]");
6594 fmt::memory_buffer buffer;
6597 return fmt::to_string(buffer);
6608 const int dialog_width,
6610 const int icon_size)
6617 const float split_factor = (
float(icon_size) + icon_padding) /
6643 Layout *layout = &split_block->
row(
false);
6649 layout = &split_block->
column(
false);
Functions and classes for evaluating template expressions in filepaths.
A dynamically sized string ADT.
#define STRNCPY_UTF8(dst, src)
#define CTX_IFACE_(context, msgid)
#define RGN_ALIGN_ENUM_FROM_MASK(align)
Read Blender memory allocation and freeing.
#define RNA_STRUCT_BEGIN(sptr, prop)
#define RNA_warning_bare(format,...)
#define RNA_warning(format,...)
#define POINTER_FROM_INT(i)
#define UNUSED_VARS_NDEBUG(...)
#define SET_FLAG_FROM_TEST(value, test, flag)
#define POINTER_AS_INT(i)
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
void fill(const T &value) const
constexpr IndexRange()=default
constexpr const T & last(const int64_t n=0) const
constexpr bool is_empty() const
constexpr const char * c_str() const
constexpr bool is_empty() const
constexpr int64_t size() const
constexpr const char * data() const
void append(const T &value)
int64_t remove_if(Predicate &&predicate)
void reserve(const int64_t min_capacity)
bool all(VecOp< bool, D >) RET
VecBase< float, D > step(VecOp< float, D >, VecOp< float, D >) RET
float3x3 scale(float3x3 mat, float2 scale)
#define CASE_ITEM(type, name)
#define UI_OPERATOR_ERROR_RET(_ot, _opname, _caller_fn_name)
ccl_device_inline dual1 len(const ccl_private dual< T > &a)
ENUM_OPERATORS(Layer::Flags)
std::unique_ptr< IDProperty, IDPropertyDeleter > create_group(StringRef prop_name, eIDPropertyFlag flags={})
Allocate a new IDProperty of type IDP_GROUP.
void free(Subdiv *subdiv)
void butstore_free(Block *block, ButStore *bs_handle)
static bool layout_variable_size(Layout *layout)
Button * uiDefIconTextBut(Block *block, ButtonTypeWithPointerType but_and_ptr_type, int icon, StringRef str, int x, int y, short width, short height, void *poin, std::optional< StringRef > tip)
static Layout * item_local_sublayout(Layout *test, Layout *layout, bool align)
void item_menutype_func(bContext *C, Layout *layout, void *arg_mt)
void block_direction_set(Block *block, char direction)
static void layout_heading_label_add(Layout *layout, Layout *heading_layout, bool right_align, bool respect_prop_split)
static bool layout_has_panel_label(const Layout *layout, const PanelType *pt)
void(*)(bContext *C, Layout *layout, void *arg1) MenuCreateFunc
void button_func_search_set_results_are_suggestions(Button *but, bool value)
void button_configure_search(Button *but, PointerRNA *ptr, PropertyRNA *prop, PointerRNA *searchptr, PropertyRNA *searchprop, PropertyRNA *item_searchprop, bool results_are_suggestions)
Button * uiDefAutoButR(Block *block, PointerRNA *ptr, PropertyRNA *prop, int index, std::optional< StringRef > name, int icon, int x, int y, int width, int height, std::optional< ButtonType > button_type_override=std::nullopt)
void label_markdown_create_link_buttons(Block *block)
static void item_flag(Layout *litem, int64_t flag)
void def_but_icon_clear(Button *but)
void butstore_register(ButStore *bs_handle, Button **but_p)
void button_func_set(Button *but, std::function< void(bContext &)> func)
static void item_disabled(Layout *layout, const char *name)
@ UI_SEARCH_FILTER_NO_MATCH
static ButtonImage * image_find_in_old_block(Block *block, const StringRef key)
bool button_label_is_markdown(const Button *button)
void label_markdown_dev_config(Layout &layout)
constexpr TextIconPadFactor text_pad_none
void button_unit_type_set(Button *but, int unit_type)
Button * uiDefIconTextButO_ptr(Block *block, ButtonType type, wmOperatorType *ot, wm::OpCallContext opcontext, int icon, StringRef str, int x, int y, short width, short height, std::optional< StringRef > tip)
static void layout_free(Layout *layout)
void uiLayoutSetTooltipCustomFunc(Layout *layout, ButtonToolTipCustomFunc func, void *arg, CopyArgFunc copy_arg, FreeArgFunc free_arg)
void context_active_but_prop_get_filebrowser(const bContext *C, PointerRNA *r_ptr, PropertyRNA **r_prop, bool *r_is_undo, bool *r_is_userdef)
void button_anim_decorate_cb(bContext *C, void *arg_but, void *)
void popup_menu_but_set(PopupMenu *pup, ARegion *butregion, Button *but)
void button_pie_dir(RadialDirection dir, float vec[2])
static Button * uiItemFullO_ptr_ex(Layout *layout, wmOperatorType *ot, std::optional< StringRef > name, int icon, const wm::OpCallContext context, const eUI_Item_Flag flag, PointerRNA *r_opptr)
bool block_layout_needs_resolving(const Block *block)
bool button_is_userdef(const Button *but)
void label_markdown_resolve(ButtonLabel *button)
void layout_remove_but(Layout *layout, const Button *but)
void text_button_func_rename_full_set(Button *but, std::function< void(StringRefNull new_name)> rename_full_func)
void layout_add_but(Layout *layout, Button *but)
static bool item_is_radial_displayable(Item *item)
bool block_apply_search_filter(Block *block, const char *search_filter)
std::optional< StringRefNull > button_asset_shelf_type_idname_get(const Button *but)
constexpr TextIconPadFactor text_pad_default
static Layout * layout_heading_find(Layout *cur_layout)
PointerRNA * button_operator_ptr_ensure(Button *but)
void block_align_begin(Block *block)
void(*)(void *arg) FreeArgFunc
@ ITEM_R_TEXT_BUT_LABEL_STYLE
@ ITEM_R_SPLIT_EMPTY_NAME
@ ITEM_R_PATH_NO_OPEN_BUTTON
@ ITEM_R_FORCE_BLANK_DECORATE
@ ITEM_R_TEXT_BUT_FORCE_SEMI_MODAL_ACTIVE
static int text_icon_width(Layout *layout, const StringRef name, const int icon, const bool compact)
void uiItemLDrag(Layout *layout, PointerRNA *ptr, StringRef name, int icon)
BLI_INLINE bool layout_is_radial(const Layout *layout)
int uiLayoutListItemPaddingWidth()
PopupMenu * popup_menu_begin(bContext *C, const char *title, int icon) ATTR_NONNULL()
wmOperatorType * button_operatortype_get_from_enum_menu(Button *but, PropertyRNA **r_prop)
static void but_tip_from_enum_item(Button *but, const EnumPropertyItem *item)
bool block_can_add_separator(const Block *block)
static bool item_rna_is_expand(PropertyRNA *prop, int index, const eUI_Item_Flag item_flag)
static RadialDirection get_radialbut_vec(float vec[2], short itemnum)
static void item_array(Layout *layout, Block *block, const StringRef name, int icon, PointerRNA *ptr, PropertyRNA *prop, const int len, int x, const int y, int w, const int, const bool expand, const bool slider, const int toggle, const bool icon_only, const bool compact, const bool show_text)
void block_flag_enable(Block *block, int flag)
static void item_enum_expand_tabs(Layout *layout, bContext *C, Block *block, PointerRNA *ptr, PropertyRNA *prop, PointerRNA *ptr_highlight, PropertyRNA *prop_highlight, const std::optional< StringRef > uiname, const int h, const bool icon_only, EnumTabExpand expand_as)
static bool block_search_panel_label_matches(const Block *block, const char *search_string)
Layout * uiItemsAlertBox(Block *block, const uiStyle *style, const int dialog_width, const AlertIcon icon, const int icon_size)
bool block_is_menu(const Block *block) ATTR_WARN_UNUSED_RESULT
Button * uiDefIconButO(Block *block, ButtonType type, StringRefNull opname, wm::OpCallContext opcontext, int icon, int x, int y, short width, short height, std::optional< StringRef > tip)
const uiStyle * style_get_dpi()
PanelType * button_paneltype_get(const Button *but)
std::string layout_introspect(Layout *layout)
Button * uiDefIconButR_prop(Block *block, ButtonType type, int icon, int x, int y, short width, short height, PointerRNA *ptr, PropertyRNA *prop, int index, float min, float max, std::optional< StringRef > tip)
static void resolve_label_multiline(ButtonLabel *button)
static void item_enum_expand_exec(Layout *layout, Block *block, PointerRNA *ptr, PropertyRNA *prop, const std::optional< StringRef > uiname, const int h, const ButtonType but_type, const bool icon_only)
static void item_enum_expand(Layout *layout, Block *block, PointerRNA *ptr, PropertyRNA *prop, const std::optional< StringRef > uiname, const int h, const bool icon_only)
@ BLOCK_NO_ACCELERATOR_KEYS
static void item_rna_size(Layout *layout, StringRef name, int icon, PointerRNA *ptr, PropertyRNA *prop, int index, bool icon_only, bool compact, int *r_w, int *r_h)
static int2 layout_end(Layout *layout)
void button_func_tooltip_custom_set(Button *but, ButtonToolTipCustomFunc func, void *arg, FreeArgFunc free_arg)
static void layer_but_cb(bContext *C, void *arg_but, void *arg_index)
void button_drawflag_enable(Button *but, int flag)
static Button * uiItem_simple(Layout *layout, const StringRef name, int icon, std::optional< StringRef > tooltip=std::nullopt, const ButtonType but_type=ButtonType::Label)
static void resolve_image_height(Button *button)
static void item_move(Item *item, const int delta_xmin, const int delta_xmax)
Button * uiDefIconTextMenuBut(Block *block, MenuCreateFunc func, void *arg, int icon, StringRef str, int x, int y, short width, short height, std::optional< StringRef > tip)
void button_disable(Button *but, const char *disabled_hint)
void button_func_tooltip_set(Button *but, ButtonToolTipFunc func, void *arg, FreeArgFunc free_arg)
static void keymap_but_cb(bContext *, void *but_v, void *)
static int text_icon_width_ex(Layout *layout, const StringRef name, int icon, const TextIconPadFactor &pad_factor, const uiFontStyle *fstyle)
void button_flag_enable(Button *but, int64_t flag)
static void litem_grid_flow_compute(Span< Item * > items, const UILayoutGridFlowInput *parameters, UILayoutGridFlowOutput *results)
static void item_enum_expand_elem_exec(Layout *layout, Block *block, PointerRNA *ptr, PropertyRNA *prop, const std::optional< StringRef > uiname, const int h, const ButtonType but_type, const bool icon_only, const EnumPropertyItem *item, const bool is_first)
Layout * popup_menu_layout(PopupMenu *pup)
void button_rna_menu_convert_to_menu_type(Button *but, const char *menu_type)
Button * uiDefBut(Block *block, ButtonTypeWithPointerType but_and_ptr_type, StringRef str, int x, int y, short width, short height, void *poin, float min, float max, std::optional< StringRef > tip)
void *(*)(const void *argN) ButtonArgNCopy
static void menu_item_enum_rna_menu(bContext *, Layout *layout, void *arg)
static void layout_add_padding_button(LayoutRoot *root)
void button_placeholder_set(Button *but, StringRef placeholder_text)
Button * uiDefButR_prop(Block *block, ButtonType type, std::optional< StringRef > str, int x, int y, short width, short height, PointerRNA *ptr, PropertyRNA *prop, int index, float min, float max, std::optional< StringRef > tip)
void * but_func_argN_copy(const void *argN)
static Button * item_menu(Layout *layout, const StringRef name, int icon, MenuCreateFunc func, void *arg, void *argN, const std::optional< StringRef > tip, bool force_menu, ButtonArgNFree func_argN_free_fn=MEM_delete_void, ButtonArgNCopy func_argN_copy_fn=MEM_dupalloc_void)
static void item_menu_hold(bContext *C, ARegion *butregion, Button *but)
static void item_enum_expand_handle(bContext *C, void *arg1, void *arg2)
void UI_paneltype_draw(bContext *C, PanelType *pt, Layout *layout)
void block_align_end(Block *block)
static void rna_collection_search_arg_free_fn(void *ptr)
Button * uiDefButAlert(Block *block, AlertIcon icon, int x, int y, short width, short height)
void block_new_button_group(Block *block, ButtonGroupFlag flag)
static int layout_vary_direction(Layout *layout)
Button * uiDefMenuBut(Block *block, MenuCreateFunc func, void *arg, StringRef str, int x, int y, short width, short height, std::optional< StringRef > tip)
void label_multiline_wrap_lines(ButtonLabel *button, int icon_pad)
void tooltip_text_field_add(TooltipData &data, std::string text, std::string suffix, const TooltipStyle style, const TooltipColorID color_id, const bool is_pad=false)
static void search_id_collection(StructRNA *ptype, PointerRNA *r_ptr, PropertyRNA **r_prop)
bool uiLayoutEndsWithPanelHeader(const Layout &layout)
static int litem_min_width(int itemw)
static void item_position(Item *item, const int x, const int y, const int w, const int h)
Button * uiDefIconTextButR_prop(Block *block, ButtonType type, int icon, std::optional< StringRef > str, int x, int y, short width, short height, PointerRNA *ptr, PropertyRNA *prop, int index, float min, float max, std::optional< StringRef > tip)
bool block_is_pie_menu(const Block *block) ATTR_WARN_UNUSED_RESULT
static bool button_matches_search_filter(Button *but, const char *search_filter)
void item_paneltype_func(bContext *C, Layout *layout, void *arg_pt)
Button * uiDefIconMenuBut(Block *block, MenuCreateFunc func, void *arg, int icon, int x, int y, short width, short height, std::optional< StringRef > tip)
void rna_collection_search_update_fn(const bContext *C, void *arg, const char *str, SearchItems *items, bool is_first)
void layout_list_set_labels_active(Layout *layout)
Button * uiItemL_ex(Layout *layout, StringRef name, int icon, bool highlight, bool redalert)
bool button_label_is_multiline(const Button *button)
void block_layout_free(Block *block)
int2 block_layout_resolve(Block *block)
void menutype_draw(bContext *C, MenuType *mt, Layout *layout)
Button * uiDefButO_ptr(Block *block, ButtonType type, wmOperatorType *ot, wm::OpCallContext opcontext, StringRef str, int x, int y, short width, short height, std::optional< StringRef > tip)
static Button * item_with_label(Layout *layout, Block *block, const StringRef name, const int icon, PointerRNA *ptr, PropertyRNA *prop, const int index, const int x, const int y, const int w_hint, const int h, const int flag, std::optional< ButtonType > button_type_override, const char *caller_fn_name)
static bool block_search_filter_tag_buttons(Block *block, const char *search_filter)
std::optional< StringRefNull > asset_shelf_idname_from_button_context(const Button *but)
static void layout_introspect_items(fmt::appender ds, Span< const Item * > items)
Button * uiDefButTextBoxR(Block *block, PointerRNA *ptr, StringRefNull propname, TextboxState *state, int x, int y, short width)
void but_func_argN_free(void *argN)
const char radial_dir_order[8]
int fontstyle_height_max(const uiFontStyle *fs)
Layout * uiItemL_respect_property_split(Layout *layout, StringRef text, int icon)
void button_drawflag_disable(Button *but, int flag)
bool layout_replace_but_ptr(Layout *layout, const void *old_but_ptr, Button *new_but)
static void paneltype_draw_impl(bContext *C, PanelType *pt, Layout *layout, bool show_header)
ARegion * searchbox_create_generic(bContext *C, ARegion *butregion, ButtonSearch *search_but)
static void item_align(Layout *litem, short nr)
Button * uiDefIconBut(Block *block, ButtonTypeWithPointerType but_and_ptr_type, int icon, int x, int y, short width, short height, void *poin, float min, float max, std::optional< StringRef > tip)
static bool button_group_has_search_match(const ButtonGroup &group, const char *search_filter)
static void item_translate_y(Item *item, const int delta)
static void item_scale(Layout *litem, const float scale[2])
void(*)(bContext &C, TooltipData &data, Button *but, void *argN) ButtonToolTipCustomFunc
MenuType * button_menutype_get(const Button *but)
static void menu_item_enum_opname_menu(bContext *C, Layout *layout, void *arg)
void button_group_add_but(Block *block, Button *but)
static LayoutItemBx * layout_box(Layout *layout, ButtonType type)
void *(*)(const void *arg) CopyArgFunc
void popup_dummy_panel_set(ARegion *region, Block *block, StringRef idname)
static int spaces_after_column_item(const Layout *litem, const Item *item, const Item *next_item, const bool is_box)
Layout & block_layout(Block *block, LayoutDirection direction, LayoutType type, int x, int y, int size, int em, int padding, const uiStyle *style)
void uiLayoutListItemAddPadding(Layout *layout)
std::string(*)(bContext *C, void *argN, StringRef tip) ButtonToolTipFunc
void block_add_dynamic_listener(Block *block, void(*listener_func)(const wmRegionListenerParams *params))
void uiLayoutSetTooltipFunc(Layout *layout, ButtonToolTipFunc func, void *arg, CopyArgFunc copy_arg, FreeArgFunc free_arg)
static bool item_is_radial_drawable(ButtonItem *bitem)
TextboxState * textbox_ensure_state(ARegion *region, StringRefNull idname, const int initial_visible_lines)
void block_layout_set_current(Block *block, Layout *layout)
void button_func_hold_set(Button *but, ButtonHandleHoldFunc func, void *argN)
int int fontstyle_string_width_with_block_aspect(const uiFontStyle *fs, StringRef str, float aspect) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
static int menu_item_enum_opname_menu_active(bContext *C, Button *but, MenuItemLevel *lvl)
void panel_tag_search_filter_match(Panel *panel)
void(*)(void *argN) ButtonArgNFree
void popup_menu_end(bContext *C, PopupMenu *pup)
void button_rna_menu_convert_to_panel_type(Button *but, const char *panel_type)
static void layout_introspect_button(fmt::appender ds, const ButtonItem *bitem)
Button * uiDefIconButO_ptr(Block *block, ButtonType type, wmOperatorType *ot, wm::OpCallContext opcontext, int icon, int x, int y, short width, short height, std::optional< StringRef > tip)
static int item_fit(const int item, const int pos, const int all, const int available, const bool is_last, const LayoutAlign alignment, float *extra_pixel)
bool block_is_popup_any(const Block *block) ATTR_WARN_UNUSED_RESULT
void button_update(Button *but)
static StringRef item_name_add_colon(StringRef name, char namestr[UI_MAX_NAME_STR])
PropertySplitWrapper uiItemPropertySplitWrapperCreate(Layout *parent_layout)
void button_func_search_set(Button *but, ButtonSearchCreateFn search_create_fn, ButtonSearchUpdateFn search_update_fn, void *arg, bool free_arg, FreeArgFunc search_arg_free_fn, ButtonHandleFunc search_exec_fn, void *active)
void button_add_shortcut(Button *but, const char *shortcut_str, const bool do_strip)
@ BUT_FORCE_SEMI_MODAL_ACTIVE
ButStore * butstore_create(Block *block)
int button_align_opposite_to_area_align_get(const ARegion *region)
void pie_menu_level_create(Block *block, wmOperatorType *ot, StringRefNull propname, IDProperty *properties, const EnumPropertyItem *items, int totitem, wm::OpCallContext context, eUI_Item_Flag flag)
void button_drag_set_id(Button *but, ID *id)
Button * uiDefButImage(Block *block, void *imbuf, int x, int y, short width, short height, const uchar color[4])
constexpr TextIconPadFactor text_pad_compact
void button_type_set_menu_from_pulldown(Button *but)
int RNA_property_array_length(PointerRNA *ptr, PropertyRNA *prop)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
uint padding(uint offset, uint alignment)
const PointerRNA * CTX_store_ptr_lookup(const bContextStore *store, StringRef name, const StructRNA *type=nullptr)
PointerRNA RNA_main_pointer_create(Main *main)
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
Panel * BKE_panel_new(PanelType *panel_type)
void RNA_property_update(bContext *C, PointerRNA *ptr, PropertyRNA *prop)
void WM_operator_properties_alloc(PointerRNA **ptr, IDProperty **properties, const char *opstring)
bool RNA_struct_is_a(const StructRNA *type, const StructRNA *srna)
std::string WM_operatortype_name(wmOperatorType *ot, PointerRNA *properties)
void WM_operator_properties_sanitize(PointerRNA *ptr, const bool no_context)
const char * RNA_property_identifier(const PropertyRNA *prop)
void RNA_property_boolean_get_array(PointerRNA *ptr, PropertyRNA *prop, bool *values)
bool BKE_path_contains_template_syntax(StringRef path)
void RNA_string_set(PointerRNA *ptr, const char *name, const char *value)
int RNA_property_enum_get(PointerRNA *ptr, PropertyRNA *prop)
void RNA_property_enum_items(bContext *C, PointerRNA *ptr, PropertyRNA *prop, const EnumPropertyItem **r_item, int *r_totitem, bool *r_free)
void RNA_int_set(PointerRNA *ptr, const char *name, int value)
MenuType * WM_menutype_find(const StringRef idname, bool quiet)
bContextStore * CTX_store_add(Vector< std::unique_ptr< bContextStore > > &contexts, StringRef name, const PointerRNA *ptr)
PointerRNA WM_operator_properties_create_ptr(wmOperatorType *ot)
PropertyRNA * RNA_struct_find_property_check(PointerRNA &props, const char *name, const PropertyType property_type_check)
std::string RNA_property_string_get(PointerRNA *ptr, PropertyRNA *prop)
const char * RNA_property_description(PropertyRNA *prop)
wmWindow * CTX_wm_window(const bContext *C)
const char * RNA_property_translation_context(const PropertyRNA *prop)
MINLINE int max_ii(int a, int b)
std::optional< std::string > WM_key_event_operator_string(const bContext *C, const char *opname, wm::OpCallContext opcontext, IDProperty *properties, const bool is_strict)
void RNA_property_boolean_set_array(PointerRNA *ptr, PropertyRNA *prop, const bool *values)
bool RNA_property_animateable(const PointerRNA *ptr, PropertyRNA *prop_orig)
int char * BLI_strcasestr(const char *s, const char *find) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
void MEM_delete_void(void *vmemh)
bool RNA_property_boolean_get(PointerRNA *ptr, PropertyRNA *prop)
bool RNA_property_array_check(PropertyRNA *prop)
bool RNA_enum_value_from_id(const EnumPropertyItem *item, const char *identifier, int *r_value)
const bContextStore * CTX_store_get(const bContext *C)
void IDP_CopyPropertyContent(IDProperty *dst, const IDProperty *src) ATTR_NONNULL()
PropertyType RNA_property_type(PropertyRNA *prop)
std::string WM_operator_pystring_ex(bContext *C, wmOperator *op, const bool all_args, const bool macro_args, wmOperatorType *ot, PointerRNA *opptr)
bContextStore * CTX_store_add_all(Vector< std::unique_ptr< bContextStore > > &contexts, const bContextStore *context)
void * MEM_dupalloc_void(const void *vmemh) ATTR_WARN_UNUSED_RESULT
VecBase< int32_t, 2 > int2
VecBase< float, 2 > float2
StructRNA * RNA_property_pointer_type(PointerRNA *ptr, PropertyRNA *prop)
void * MEM_new_zeroed(size_t len, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1) ATTR_NONNULL(2)
std::optional< int64_t > CTX_store_int_lookup(const bContextStore *store, StringRef name)
BMesh const char void * data
BLI_INLINE float BLI_rctf_size_y(const struct rctf *rct)
bool RNA_property_boolean_get_index(PointerRNA *ptr, PropertyRNA *prop, int index)
std::optional< bke::path_templates::VariableMap > BKE_build_template_variables_for_prop(const bContext *C, PointerRNA *ptr, PropertyRNA *prop)
char RNA_property_array_item_char(PropertyRNA *prop, int index)
int RNA_property_flag(PropertyRNA *prop)
PanelType * WM_paneltype_find(const StringRef idname, bool quiet)
PointerRNA RNA_pointer_create_discrete(ID *id, StructRNA *type, void *data)
bool WM_menutype_poll(bContext *C, MenuType *mt)
PropertyRNA * RNA_struct_type_find_property(StructRNA *srna, const char *identifier)
ARegionType * BKE_regiontype_from_id(const SpaceType *st, int regionid)
SpaceType * BKE_spacetype_from_id(int spaceid)
void RNA_property_enum_items_gettexted(bContext *C, PointerRNA *ptr, PropertyRNA *prop, const EnumPropertyItem **r_item, int *r_totitem, bool *r_free)
LayoutPanelState * BKE_panel_layout_panel_state_ensure(Panel *panel, StringRef idname, bool default_closed)
PropertyRNA * RNA_struct_name_property(const StructRNA *type)
int RNA_property_array_dimension(const PointerRNA *ptr, PropertyRNA *prop, int length[])
void BKE_panel_free(Panel *panel)
int RNA_struct_ui_icon(const StructRNA *type)
bool RNA_struct_is_ID(const StructRNA *type)
const char * RNA_struct_identifier(const StructRNA *type)
std::optional< std::string > WM_keymap_item_to_string(const wmKeyMapItem *kmi, const bool compact)
PropertySubType RNA_property_subtype(PropertyRNA *prop)
wmOperatorType * WM_operatortype_find(const char *idname, bool quiet)
bool ED_id_rename(Main &bmain, ID &id, StringRefNull name)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Main * CTX_data_main(const bContext *C)
@ PANEL_TYPE_DEFAULT_CLOSED
char * BLI_strdup(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC
BLI_INLINE float BLI_rctf_size_x(const struct rctf *rct)
bool BLI_path_is_rel(const char *path) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
Vector< bke::path_templates::Error > BKE_path_validate_template(StringRef path, const bke::path_templates::VariableMap &template_variables)
@ PROP_PATH_SUPPORTS_TEMPLATES
@ PROP_PATH_SUPPORTS_BLEND_RELATIVE
ARegion * CTX_wm_region_popup(const bContext *C)
void RNA_property_enum_set(PointerRNA *ptr, PropertyRNA *prop, int value)
bool RNA_property_editable(const PointerRNA *ptr, PropertyRNA *prop)
std::optional< StringRefNull > CTX_store_string_lookup(const bContextStore *store, StringRef name)
int RNA_property_ui_icon(const PropertyRNA *prop)
int RNA_enum_from_name(const EnumPropertyItem *item, const char *name)
@ RGN_FLAG_SEARCH_FILTER_ACTIVE
std::string RNA_string_get(PointerRNA *ptr, const char *name)
void CTX_store_set(bContext *C, const bContextStore *store)
eStringPropertySearchFlag RNA_property_string_search_flag(PropertyRNA *prop)
MINLINE int min_ii(int a, int b)
ARegion * CTX_wm_region(const bContext *C)
const char * RNA_property_ui_name(const PropertyRNA *prop, const PointerRNA *ptr)
void RNA_property_enum_items_gettexted_all(bContext *C, PointerRNA *ptr, PropertyRNA *prop, const EnumPropertyItem **r_item, int *r_totitem, bool *r_free)
void * MEM_new_array_zeroed(size_t len, size_t size, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1
bool RNA_property_is_unlink(PropertyRNA *prop)
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
ListBaseT< PanelType > paneltypes
bke::ARegionRuntime * runtime
eRegion_Alignment alignment
Vector< LayoutPanelBody > bodies
Vector< LayoutPanelHeader > headers
char translation_context[BKE_ST_MAXNAME]
ListBaseT< LinkData > children
char parent_id[BKE_ST_MAXNAME]
void(*) listener(const wmRegionListenerParams *params)
char context[BKE_ST_MAXNAME]
void(*) draw(const bContext *C, Panel *panel)
char category[BKE_ST_MAXNAME]
bool(*) poll(const bContext *C, PanelType *pt)
void(*) draw_header(const bContext *C, Panel *panel)
char idname[BKE_ST_MAXNAME]
char label[BKE_ST_MAXNAME]
LayoutPanels layout_panels
PointerRNA * custom_data_ptr
struct Panel_Runtime * runtime
Vector< bContextStoreEntry > entries
ListBaseT< ui::Block > uiblocks
BlockAlertLevel alert_level
Button * last_but() const
Vector< ButtonGroup > button_groups
ListBaseT< LayoutRoot > layouts
Vector< std::unique_ptr< bContextStore > > contexts
Vector< std::unique_ptr< Button > > buttons_ptrs
Button * first_but() const
std::ranges::transform_view< std::ranges::ref_view< const Vector< std::unique_ptr< Button > > >, Button &(*)(const std::unique_ptr< Button > &)> buttons() const
Button * next_but(const Button *but) const
std::unique_ptr< PieMenuData > pie_data
PopupBlockHandle * handle
static void box_item_set(Item *item, bool box_item)
static void auto_fixed_size_set(Item *item, bool auto_fixed_size)
static void inside_property_split_set(Item *item, bool inside_prop_sep)
static bool use_property_decorate_no_pad(const Item *item)
static bool box_item(const Item *item)
static bool auto_fixed_size(const Item *item)
void fixed_size_set(bool fixed_size)
void estimate_impl() override
void resolve_impl() override
LayoutColumn(ItemType type, LayoutRoot *root)
void resolve_impl() override
LayoutColumn(LayoutRoot *root)
void estimate_impl() override
static void layout_translate_y(Layout *layout, int delta)
static int layout_space_get(Layout *layout)
static void init_from_parent(Layout *item, Layout *layout, int align)
static void layout_estimate(Layout *layout)
static Layout * item_prop_split_layout_hack(Layout *layout_parent, Layout *layout_split)
static void layout_move(Layout *layout, int delta_xmin, int delta_xmax)
static void layout_space_set(Layout *layout, int space)
static void layout_resolve(Layout *layout)
static ButtonItem * layout_find_button_item(const Layout *layout, const Button *but)
static void layout_add_but(Layout *layout, Button *but)
static void layout_remove_but(Layout *layout, const Button *but)
static void layout_offset_size_set(Layout *layout, int x, int y, int w, int h)
void resolve_dynamic_height() override
void estimate_impl() override
void resolve_impl() override
void estimate_impl() override
void resolve_impl() override
void estimate_impl() override
void resolve_impl() override
void resolve_impl() override
void resolve_dynamic_height() override
void resolve_impl() override
void estimate_impl() override
void estimate_impl() override
void resolve_impl() override
void estimate_impl() override
void resolve_impl() override
LayoutDirection direction
wm::OpCallContext opcontext
LayoutRow(LayoutRoot *root)
LayoutRow(ItemType type, LayoutRoot *root)
void resolve_impl() override
void estimate_impl() override
void prop_menu_enum(PointerRNA *ptr, PropertyRNA *prop, std::optional< StringRefNull > name, int icon)
void progress_indicator(const char *text, float factor, ButProgressType progress_type)
void enabled_set(bool enabled)
virtual void estimate_impl()
void textbox(const bContext *C, PointerRNA *ptr, StringRefNull propname, std::optional< StringRefNull > name_opt=std::nullopt, std::optional< StringRefNull > placeholder=std::nullopt, const int initial_visible_lines=3)
void alignment_set(LayoutAlign alignment)
void context_int_set(StringRef name, int64_t value)
void prop_search(PointerRNA *ptr, PropertyRNA *prop, PointerRNA *searchptr, PropertyRNA *searchprop, PropertyRNA *item_searchpropname, std::optional< StringRefNull > name, int icon, bool results_are_suggestions)
Panel * root_panel() const
void use_property_decorate_set(bool is_decorate)
void textbox_with_state(PointerRNA *ptr, StringRefNull propname, TextboxState *textbox_state, std::optional< StringRefNull > name_opt=std::nullopt, std::optional< StringRefNull > placeholder=std::nullopt)
bool use_property_split() const
void label_multiline(StringRefNull label, int icon, FontStyleAlign align=UI_STYLE_TEXT_LEFT, int max_lines=0)
PointerRNA op_menu_hold(wmOperatorType *ot, std::optional< StringRef > name, int icon, wm::OpCallContext context, eUI_Item_Flag flag, const char *menu_id)
void operator_context_set(wm::OpCallContext opcontext)
std::optional< StringRefNull > context_string_get(const StringRef name) const
bool activate_init() const
wm::OpCallContext operator_context() const
Layout * child_items_layout_
void use_property_split_set(bool is_sep)
LayoutRoot * root() const
PointerRNA op_menu_enum(const bContext *C, wmOperatorType *ot, StringRefNull propname, std::optional< StringRefNull > name, int icon)
Span< Item * > items() const
void link(StringRef url, StringRef name, int icon)
void label(StringRef name, int icon)
void decorator(PointerRNA *ptr, PropertyRNA *prop, int index)
const bContextStore * context() const
void menu_contents(StringRef menuname)
PointerRNA op(wmOperatorType *ot, std::optional< StringRef > name, int icon, wm::OpCallContext context, eUI_Item_Flag flag)
void op_enum_items(wmOperatorType *ot, const PointerRNA &ptr, PropertyRNA *prop, IDProperty *properties, wm::OpCallContext context, eUI_Item_Flag flag, const EnumPropertyItem *item_array, int totitem, int active=-1)
PanelLayout panel(const bContext *C, StringRef idname, bool default_closed)
void context_set_from_but(const Button *but)
std::optional< int64_t > context_int_get(const StringRef name) const
Layout & column_flow(int number, bool align)
void prop_with_menu(PointerRNA *ptr, blender::StringRefNull propname, eUI_Item_Flag flag, std::optional< blender::StringRefNull > name, int icon, const char *menu_type)
void prop(PointerRNA *ptr, PropertyRNA *prop, int index, int value, eUI_Item_Flag flag, std::optional< StringRef > name_opt, int icon, std::optional< StringRef > placeholder=std::nullopt)
bool active_default() const
void menu(MenuType *mt, std::optional< StringRef > name, int icon)
const PointerRNA * context_ptr_get(const StringRef name, const StructRNA *type) const
EmbossType emboss_or_undefined() const
void active_set(bool active)
virtual void resolve_impl()
virtual void resolve_dynamic_height()
StringRef heading() const
void prop_with_popover(PointerRNA *ptr, PropertyRNA *prop, int index, int value, eUI_Item_Flag flag, std::optional< StringRefNull > name, int icon, const char *panel_type)
Layout & split(float percentage, bool align)
LayoutAlign alignment() const
Layout & column(bool align)
bool use_property_decorate() const
void context_string_set(StringRef name, StringRef value)
PanelLayout panel_prop_with_bool_header(const bContext *C, PointerRNA *open_prop_owner, StringRefNull open_prop_name, PointerRNA *bool_prop_owner, StringRefNull bool_prop_name, std::optional< StringRef > label)
void op_enum(StringRefNull opname, StringRefNull propname, IDProperty *properties, wm::OpCallContext context, eUI_Item_Flag flag, const int active=-1)
void separator(float factor=1.0f, LayoutSeparatorType type=LayoutSeparatorType::Auto)
Layout & grid_flow(bool row_major, int columns_len, bool even_columns, bool even_rows, bool align)
void label_markdown(StringRef text)
Layout & absolute(bool align=false)
Layout & list_box(uiList *ui_list, PointerRNA *actptr, PropertyRNA *actprop)
PanelLayout panel_prop(const bContext *C, PointerRNA *open_prop_owner, StringRefNull open_prop_name)
void prop_tabs_enum(bContext *C, PointerRNA *ptr, PropertyRNA *prop, PointerRNA *ptr_highlight, PropertyRNA *prop_highlight, bool icon_only, EnumTabExpand expand_as=EnumTabExpand::Default)
void popover(const bContext *C, PanelType *pt, std::optional< StringRef > name_opt, int icon)
bool variable_size() const
bool image(StringRef key, FunctionRef< ImBuf *()> create_fn)
Button * button(StringRef name, int icon, std::function< void(bContext &)> func, std::optional< StringRef > tooltip=std::nullopt)
static constexpr float PROPERTY_SPLIT_FACTOR
LayoutDirection local_direction() const
void context_ptr_set(StringRef name, const PointerRNA *ptr)
void props_enum(PointerRNA *ptr, StringRefNull propname)
void popover_group(bContext *C, int space_id, int region_id, const char *context, const char *category)
EmbossType emboss() const
void menu_fn_argN_free(StringRefNull name, int icon, MenuCreateFunc func, void *argN)
void context_copy(const bContextStore *context)
void menu_fn(StringRefNull name, int icon, MenuCreateFunc func, void *arg)
Layout(ItemType type, LayoutRoot *root)
void prop_enum(PointerRNA *ptr, PropertyRNA *prop, int value, std::optional< StringRefNull > name, int icon)
void emboss_set(EmbossType emboss)
PropertyRNA * item_search_prop
PropertyRNA * search_prop
PropertyRNA * target_prop
wmEventModifierFlag modifier
wmOperatorStatus(*) invoke(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
std::string(*) get_description(bContext *C, wmOperatorType *ot, PointerRNA *ptr)
bke::WindowRuntime * runtime