70#define ICON_SIZE_FROM_BUTRECT(rect) (0.8f * BLI_rcti_size_y(rect))
72#define UI_INPUT_HINT_ALPHA 0.33f
159 cp[0] = int((1.0f - fac) * cp[0] + fac * cpstate[0]);
160 cp[1] = int((1.0f - fac) * cp[1] + fac * cpstate[1]);
161 cp[2] = int((1.0f - fac) * cp[2] + fac * cpstate[2]);
171 const int facm = 255 - faci;
173 r_col[0] = (faci * col1[0] + facm * col2[0]) / 256;
174 r_col[1] = (faci * col1[1] + facm * col2[1]) / 256;
175 r_col[2] = (faci * col1[2] + facm * col2[2]) / 256;
176 r_col[3] = (faci * col1[3] + facm * col2[3]) / 256;
184 const int delta = item_value - inner_value;
186 if (contrast > delta) {
191 if (contrast > -delta) {
199 float rgb[3], hsl[3];
242#define WIDGET_CURVE_RESOLU 9
243#define WIDGET_SIZE_MAX (WIDGET_CURVE_RESOLU * 4)
310 {0.468813, -0.481430},
311 {-0.155755, -0.352820},
312 {0.219306, -0.238501},
313 {-0.393286, -0.110949},
314 {-0.024699, 0.013908},
315 {0.343805, 0.147431},
316 {-0.272855, 0.269918},
317 {0.095909, 0.388710},
319#define WIDGET_AA_JITTER UI_PIXEL_AA_JITTER
320#define jit ui_pixel_jitter
323 {-0.352077, 0.532607},
324 {-0.352077, -0.549313},
325 {0.330000, -0.008353},
332 {0.382684, 0.923879},
333 {0.000001, 1.000000},
334 {-0.382683, 0.923880},
335 {-0.707107, 0.707107},
336 {-0.923879, 0.382684},
337 {-1.000000, 0.000000},
338 {-0.923880, -0.382684},
339 {-0.707107, -0.707107},
340 {-0.382683, -0.923880},
341 {0.000000, -1.000000},
342 {0.382684, -0.923880},
343 {0.707107, -0.707107},
344 {0.923880, -0.382684},
345 {1.000000, -0.000000},
346 {0.923880, 0.382683},
347 {0.707107, 0.707107},
377 {-0.578579, 0.253369},
378 {-0.392773, 0.412794},
379 {-0.004241, -0.328551},
380 {-0.003001, 0.034320},
381 {1.055313, 0.864744},
382 {0.866408, 1.026895},
395 {-0.5 +
SC, 1.0 +
OY},
397 {0.5, 0.0 +
OY +
SC},
428 format,
"vflag", gpu::VertAttrType::UINT_32);
454 *
data |= corner_v << 2;
457 *
data |= (inner) ? (1 << 10) : 0;
458 *
data |= (emboss) ? (1 << 11) : 0;
498 for (
int c = 0; c < 4; c++) {
511 for (
int c1 = 0, c2 = 3; c1 < 2; c1++, c2--) {
536 float x1,
float y1,
float x2,
float y2,
float x3,
float y3,
const float color[4])
538 const float tri_arr[3][2] = {{x1, y1}, {x2, y2}, {x3, y3}};
570 const float f3 = 0.05 *
U.widget_unit / aspect;
571 const float f5 = 0.15 *
U.widget_unit / aspect;
572 const float f7 = 0.25 *
U.widget_unit / aspect;
577 else if (dir ==
't') {
625 WidgetBase *wt,
int roundboxalign,
const rcti *rect,
float rad,
float radi)
628 const float minx = rect->
xmin, miny = rect->
ymin, maxx = rect->
xmax, maxy = rect->
ymax;
629 const float minxi = minx +
U.pixelsize;
630 const float maxxi = maxx -
U.pixelsize;
631 const float minyi = miny +
U.pixelsize;
632 const float maxyi = maxy -
U.pixelsize;
634 const float facxi = (maxxi != minxi) ? 1.0f / (maxxi - minxi) : 0.0f;
635 const float facyi = (maxyi != minyi) ? 1.0f / (maxyi - minyi) : 0.0f;
652 if (2.0f * rad > minsize) {
653 rad = 0.5f * minsize;
656 if (2.0f * (radi + 1.0f) > minsize) {
657 radi = 0.5f * minsize -
U.pixelsize;
682 wt->
inner_v[tot][0] = minxi + veci[a][1];
683 wt->
inner_v[tot][1] = minyi + radi - veci[a][0];
685 wt->
outer_v[tot][0] = minx + vec[a][1];
686 wt->
outer_v[tot][1] = miny + rad - vec[a][0];
708 wt->
inner_v[tot][0] = maxxi - radi + veci[a][0];
709 wt->
inner_v[tot][1] = minyi + veci[a][1];
711 wt->
outer_v[tot][0] = maxx - rad + vec[a][0];
712 wt->
outer_v[tot][1] = miny + vec[a][1];
736 wt->
inner_v[tot][0] = maxxi - veci[a][1];
737 wt->
inner_v[tot][1] = maxyi - radi + veci[a][0];
739 wt->
outer_v[tot][0] = maxx - vec[a][1];
740 wt->
outer_v[tot][1] = maxy - rad + vec[a][0];
762 wt->
inner_v[tot][0] = minxi + radi - veci[a][0];
763 wt->
inner_v[tot][1] = maxyi - veci[a][1];
765 wt->
outer_v[tot][0] = minx + rad - vec[a][0];
766 wt->
outer_v[tot][1] = maxy - vec[a][1];
807 const float verts[][2],
809 const uint tris[][3],
818 float centx =
float(rect->
xmin) + 0.4f * minsize;
819 float centy =
float(rect->
ymin) + 0.5f * minsize;
820 tria->
size = sizex = sizey = -0.5f * triasize * minsize;
823 centx =
float(rect->
xmax) - 0.4f * minsize;
826 else if (where ==
't') {
827 centx =
float(rect->
xmin) + 0.5f * minsize;
828 centy =
float(rect->
ymax) - 0.5f * minsize;
833 else if (where ==
'b') {
834 centx =
float(rect->
xmin) + 0.5f * minsize;
840 for (
int a = 0; a < verts_tot; a++) {
841 tria->
vec[a][0] = sizex * verts[a][i1] + centx;
842 tria->
vec[a][1] = sizey * verts[a][i2] + centy;
848 tria->
tot = tris_tot;
913 for (
int i = 0; i < totvert; i++) {
926 if ((width / height) < 0.5f) {
930 float centx, centy, size;
937 tria->
size = size = 0.4f * height;
939 if (width > height * 1.1f) {
941 tria->
center[0] = centx = rect->
xmax - 0.32f * height;
944 for (
int a = 0; a < 6; a++) {
955 float centx, centy, size;
964 for (
int a = 0; a < 6; a++) {
993 r_coltop[0] = std::clamp(
color[0] + shadetop, 0, 255);
994 r_coltop[1] = std::clamp(
color[1] + shadetop, 0, 255);
995 r_coltop[2] = std::clamp(
color[2] + shadetop, 0, 255);
996 r_coltop[3] =
color[3];
998 r_coldown[0] = std::clamp(
color[0] + shadedown, 0, 255);
999 r_coldown[1] = std::clamp(
color[1] + shadedown, 0, 255);
1000 r_coldown[2] = std::clamp(
color[2] + shadedown, 0, 255);
1001 r_coldown[3] =
color[3];
1009 for (a = 0; a < totvert; a++) {
1027 const bool alpha_check,
1028 const float discard_factor)
1053 const uchar *outline,
1054 const uchar *emboss,
1073#define MAX_WIDGET_BASE_BATCH 6
1074#define MAX_WIDGET_PARAMETERS 12
1084 const float checker_params[3] = {
1149 const float checker_params[3] = {
1163 uchar inner_col1[4] = {0};
1164 uchar inner_col2[4] = {0};
1165 uchar emboss_col[4] = {0};
1166 uchar outline_col[4] = {0};
1167 uchar tria_col[4] = {0};
1173 inner_col1[0] = inner_col2[0] = wcol->
inner[0];
1174 inner_col1[1] = inner_col2[1] = wcol->
inner[1];
1175 inner_col1[2] = inner_col2[2] = wcol->
inner[2];
1176 inner_col1[3] = inner_col2[3] = wcol->
inner[3];
1185 outline_col[0] = wcol->
outline[0];
1186 outline_col[1] = wcol->
outline[1];
1187 outline_col[2] = wcol->
outline[2];
1188 outline_col[3] = wcol->
outline[3];
1197 tria_col[0] = wcol->
item[0];
1198 tria_col[1] = wcol->
item[1];
1199 tria_col[2] = wcol->
item[2];
1200 tria_col[3] = wcol->
item[3];
1204 if (inner_col1[3] || inner_col2[3] || outline_col[3] || emboss_col[3] || tria_col[3]) {
1206 wtb, inner_col1, inner_col2, outline_col, emboss_col, tria_col);
1218 bool show_alpha_checkers)
1220 const uchar unused_col[4] = {0};
1221 uchar emboss_col[4] = {0};
1222 uchar outline_col[4] = {0};
1225 outline_col[0] = wcol->
outline[0];
1226 outline_col[1] = wcol->
outline[1];
1227 outline_col[2] = wcol->
outline[2];
1228 outline_col[3] = wcol->
outline[3];
1239 wtb, unused_col, unused_col, outline_col, emboss_col, unused_col);
1254#define UI_TEXT_CLIP_MARGIN (0.25f * U.widget_unit / but->block->aspect)
1256#define PREVIEW_PAD (0.15f * UI_UNIT_X)
1278 const uchar mono_color[4])
1280 if (icon == ICON_NONE) {
1292 uchar color[4] = {mono_color[0], mono_color[1], mono_color[2], mono_color[3]};
1309 const bool add_padding,
1311 const uchar mono_color[4])
1313 if (icon == ICON_NONE) {
1324 const int size = std::min(
w, h) - (add_padding ? (
PREVIEW_PAD * 2) : 0);
1327 const int x = rect->
xmin +
w / 2 - size / 2;
1328 const int y = rect->
ymin + h / 2 - size / 2;
1363 bool force_outline =
false;
1384 const auto *but_label =
reinterpret_cast<const ButtonLabel *
>(but);
1386 if (but_label->draw_icon_border) {
1387 force_outline =
true;
1398 if (height > (rect->
xmax - rect->
xmin)) {
1399 alpha *= std::max(
float(rect->
xmax - rect->
xmin) / height, 0.0f);
1404 if (icon && icon != ICON_BLANK1) {
1405 const float ofs = 1.0f / aspect;
1413 xs = rect->
xmin + 2.0f * ofs;
1416 xs = rect->
xmin + 2.0f * ofs;
1419 xs = rect->
xmin + 4.0f * ofs;
1423 xs = (rect->
xmin + rect->
xmax - height) / 2.0f;
1428 ys = rect->
ymax - height - 2.0f * ofs;
1431 ys = (rect->
ymin + rect->
ymax - height) / 2.0f;
1435 if (aspect > 0.95f && aspect < 1.05f) {
1441 uchar color[4] = {mono_color[0], mono_color[1], mono_color[2], mono_color[3]};
1486 const int xs = rect->
xmax - tria_width;
1487 const int ys = (rect->
ymin + rect->
ymax - tria_height) / 2.0f;
1494 BLI_rctf_init(&tria_rect, xs, xs + tria_width, ys, ys + tria_height);
1506 const int bytes =
str + but->
ofs - prev_utf8;
1514 const int bytes = next_utf8 - (
str + but->
ofs);
1535 const std::optional<bke::path_templates::ExpressionInfo> info =
1537 if (!info.has_value()) {
1550 if (short_expression.
size() > info->byte_range.size()) {
1551 return info->byte_range.one_after_last();
1554 std::memcpy(
str + info->byte_range.first(), short_expression.
data(), short_expression.
size());
1555 std::memmove(
str + info->byte_range.first() + short_expression.
size(),
1556 str + info->byte_range.one_after_last(),
1557 strlen(
str) + 1 - info->byte_range.one_after_last());
1559 return info->byte_range.first() + short_expression.
size();
1576 const size_t split_offset,
1577 const bool shift_left)
1585 for (
const StringRef unit : no_split_strings) {
1595 const int range_min = std::max(0,
int(split_offset - unit.size() + 1));
1596 const int range_max = std::max(0,
int(split_offset - 1));
1598 for (
int i = range_max; i >= range_min; i--) {
1599 if (
str.drop_prefix(i).startswith(unit)) {
1608 size_t new_offset = match;
1610 new_offset += unit.size();
1616 return split_offset;
1626 const size_t str_maxncpy,
1627 const float okwidth,
1630 const float sep_strwidth,
1631 size_t *r_final_len)
1637 fstyle->
uifont_id,
str, str_maxncpy, okwidth - sep_strwidth,
nullptr);
1643 memcpy(
str + trimmed_str.
size(), sep, sep_len + 1);
1645 *r_final_len = trimmed_str.
size() + sep_len;
1653 *r_final_len = size_t(l_end);
1661 const float minwidth,
1662 const size_t str_maxncpy,
1663 const char rpart_sep,
1664 const bool clip_right_if_tight,
1665 const bool shorten_template_variables)
1675 if (shorten_template_variables) {
1676 size_t byte_position = 0;
1677 while ((okwidth > 0.0f) && (strwidth > okwidth)) {
1680 if (byte_position == -1) {
1686 if ((okwidth > 0.0f) && (strwidth > okwidth)) {
1688 const int sep_len =
sizeof(sep) - 1;
1692 float rpart_width = 0.0f;
1693 size_t rpart_len = 0;
1694 size_t final_lpart_len;
1697 rpart = strrchr(
str, rpart_sep);
1701 rpart_len = strlen(rpart);
1703 okwidth -= rpart_width;
1704 strwidth -= rpart_width;
1706 if (okwidth < 0.0f) {
1709 memmove(
str, rpart, rpart_len + 1);
1711 okwidth += rpart_width;
1712 strwidth = rpart_width;
1717 const float parts_strwidth = (okwidth - sep_strwidth) / 2.0f;
1726 fstyle->
uifont_id,
str, str_maxncpy, parts_strwidth,
nullptr);
1728 if (clip_right_if_tight &&
1729 (l_end < 10 ||
min_ff(parts_strwidth, strwidth - okwidth) < minwidth))
1735 fstyle,
str, str_maxncpy, okwidth, sep, sep_len, sep_strwidth, &final_lpart_len);
1739 size_t r_offset, r_len;
1741 fstyle->
uifont_id,
str, str_maxncpy, parts_strwidth,
nullptr);
1744 r_len = r_trimmed.
size();
1746 if (l_end + sep_len + r_len + 1 + rpart_len > str_maxncpy) {
1754 fstyle,
str, str_maxncpy, okwidth, sep, sep_len, sep_strwidth, &final_lpart_len);
1757 memmove(
str + l_end + sep_len, r_trimmed.
begin(), r_len);
1758 memcpy(
str + l_end, sep, sep_len);
1759 final_lpart_len = size_t(l_end + sep_len + r_len);
1761 str[final_lpart_len] =
'\0';
1772 char *c =
str + l_end + sep_len;
1773 memmove(c, c + 1, r_len);
1781 memcpy(
str + final_lpart_len, rpart, rpart_len + 1);
1782 okwidth += rpart_width;
1794 BLI_assert((strwidth <= (okwidth + 2)) || (okwidth <= 0.0f) ||
1820 const bool clip_right_if_tight =
true;
1827 const size_t new_drawstr_maxncpy =
sizeof(new_drawstr);
1832 new_drawstr_maxncpy,
1834 clip_right_if_tight,
1835 shorten_template_variables);
1861 const size_t new_drawstr_maxncpy =
sizeof(new_drawstr);
1863 fstyle, new_drawstr, okwidth, minwidth, new_drawstr_maxncpy, rsep);
1869 char *clipped_str_buf,
1870 const size_t clipped_str_buf_maxncpy,
1871 const float max_line_width,
1872 const int max_lines)
1879 if (lines.size() <= max_lines) {
1884 clipped_lines.
reserve(max_lines);
1886 if (max_lines == 1) {
1890 fstyle, clipped_str_buf, max_line_width,
UI_ICON_SIZE, clipped_str_buf_maxncpy,
'\0');
1891 clipped_lines.
append(clipped_str_buf);
1892 return clipped_lines;
1894 if (max_lines == 2) {
1895 clipped_lines.
append(lines[0]);
1896 BLI_strncpy(clipped_str_buf,
str + lines[0].size(), clipped_str_buf_maxncpy);
1901 clipped_str_buf_maxncpy,
1904 clipped_lines.
append(clipped_str_buf);
1905 return clipped_lines;
1910 const int middle_index = max_lines / 2;
1913 for (
int i = 0; i < middle_index; i++) {
1914 clipped_lines.
append(lines[i]);
1919 BLI_strncpy(clipped_str_buf, lines[middle_index].
data(), clipped_str_buf_maxncpy);
1924 clipped_str_buf_maxncpy,
1927 clipped_lines.
append(clipped_str_buf);
1932 if ((middle_index + 1) < max_lines) {
1933 const char *remaining = lines[middle_index + 1].data();
1934 size_t remaining_len = strlen(remaining);
1935 std::list<StringRef> last_lines;
1936 for (
int i = 0; i < max_lines - (middle_index + 1) && remaining_len; i++) {
1938 fstyle->
uifont_id, remaining, remaining_len, max_line_width,
nullptr);
1939 size_t line_len = remaining_len - offset;
1940 last_lines.emplace_front(remaining + offset,
int64_t(line_len));
1941 remaining_len = offset;
1945 clipped_lines.
append(line);
1949 return clipped_lines;
1966 but->
ofs = std::min(but->
ofs, but->
pos);
1977 const int editstr_len = strlen(but->
editstr);
1978 int len = editstr_len;
1995 if (caret_x > okwidth - 20) {
2000 if (caret_x < 20 && but->ofs > 0) {
2027 int drawstr_len = but->
drawstr.size();
2031 const char *cpend = new_drawstr + drawstr_len;
2046 const int sep_len =
sizeof(sep) - 1;
2059 char *cpoin = strrchr(new_drawstr,
':');
2061 if (cpoin && (cpoin < cpend - 2)) {
2065 while (but->
strwidth > okwidth && cp2 > new_drawstr) {
2067 const int bytes = cp2 - prev_utf8;
2071 memmove(cp2 - bytes, cp2, drawstr_len + 1);
2074 drawstr_len -= bytes;
2077 new_drawstr + but->
ofs,
2078 sizeof(new_drawstr) - but->
ofs) +
2080 if (but->
strwidth < sep_strwidth) {
2086 while ((but->
strwidth > okwidth) && (but->
ofs < 2)) {
2089 fstyle->
uifont_id, new_drawstr + but->
ofs,
sizeof(new_drawstr) - but->
ofs);
2101 new_drawstr + but->
ofs,
2102 drawstr_len - but->
ofs,
2107 new_drawstr[drawstr_len] = 0;
2110 cpoin = strrchr(new_drawstr,
':');
2111 if (cpoin && (cpoin - new_drawstr > 0) && (drawstr_len < (
sizeof(new_drawstr) - sep_len))) {
2113 memmove(cpoin + sep_len, cpoin, cpend - cpoin);
2114 memcpy(cpoin, sep, sep_len);
2116 fstyle->
uifont_id, new_drawstr + but->
ofs,
sizeof(new_drawstr) - but->
ofs);
2122#ifdef WITH_INPUT_IME
2123static void widget_draw_text_ime_underline(
const uiFontStyle *fstyle,
2127 const wmIMEData *ime_data,
2128 const char *drawstr,
2129 const int align_x_ofs)
2133 int sel_start = ime_data->sel_start, sel_end = ime_data->sel_end;
2136 if (drawstr[0] != 0) {
2137 if (but->pos >= but->ofs) {
2145 fstyle->
uifont_id, drawstr + but->ofs, ime_data->composite.size() + but->pos - but->ofs);
2150 min_ii(width, rect_x - 2) - ofs_x,
2155 if (sel_start != -1 && sel_end != -1) {
2156 sel_end -= sel_start;
2157 sel_start += but->pos;
2159 if (sel_start >= but->ofs) {
2166 width =
BLF_width(fstyle->
uifont_id, drawstr + but->ofs, sel_end + sel_start - but->ofs);
2170 min_ii(width, rect_x - 2) - ofs_x,
2181 const rcti *button_rect)
2184#ifdef WITH_INPUT_IME
2185 const wmIMEData *ime_data = button_ime_data_get(but);
2187 rcti rect = *button_rect;
2192 rect.
xmax = std::max<int>(rect.
xmin, rect.
xmax - text_padding - scrollbar_pad);
2207 const char *
str = lines[0].begin();
2209 int line_cursor = 0;
2210 int line_select_start = 0;
2211 int line_select_end = 0;
2213 int but_pos = but->
pos;
2215#ifdef WITH_INPUT_IME
2217 if (ime_data && !ime_data->composite.empty() && ime_data->cursor_pos != -1) {
2218 but_pos += ime_data->cursor_pos;
2220 if (selsta != selend) {
2221 if (but->
pos == selsta) {
2222 selsta += ime_data->composite.size();
2223 selend += ime_data->composite.size();
2227 int ime_line_start = 0;
2228 int ime_line_end = 0;
2231 for (
int i : lines.index_range()) {
2232 const char *line_bounds[] = {
2233 lines[i].begin(), i != lines.size() - 1 ? lines[i + 1].begin() : lines.last().end()};
2234 if (line_bounds[0] <= (
str + but_pos) && (
str + but_pos) <= line_bounds[1]) {
2237 auto selection_line_bounds_get =
2238 [line_bounds,
str, i](
int start,
int end,
int &r_line_begin,
int &r_line_end) {
2239 if (line_bounds[0] <= (
str + start) && (
str + start) <= line_bounds[1]) {
2242 if (line_bounds[0] <= (
str + end) && (
str + end) <= line_bounds[1]) {
2246 selection_line_bounds_get(selsta, selend, line_select_start, line_select_end);
2247#ifdef WITH_INPUT_IME
2249 selection_line_bounds_get(
2250 but->
pos, but->
pos + ime_data->composite.size(), ime_line_start, ime_line_end);
2273 rcti scissor_rect = {scissor[0], scissor[0] + scissor[2], scissor[1], scissor[1] + scissor[3]};
2274 rcti scissor_textbox;
2275 scissor_textbox.
xmin = rect.
xmin - caret_width;
2279 BLI_rcti_isect(&scissor_rect, &scissor_textbox, &scissor_textbox);
2282 scissor_textbox.
ymin,
2290#ifdef WITH_INPUT_IME
2291 bool ime_reposition_window =
false;
2292 int ime_win_x, ime_win_y;
2294 struct LineSelection {
2299 auto lines_selection_get =
2306 const char *itr =
str + start;
2307 for (
int i = line_start; i <= line_end; i++) {
2309 const char *itr_end = std::min(
2310 str + end, i != lines.size() - 1 ? lines[i + 1].begin() : lines.last().end());
2311 selection.
append({i, itr, itr_end});
2317 selsta, selend, line_select_start, line_select_end);
2319 for (
const LineSelection &selection : lines_selection) {
2320 if (!(scroll <= selection.line && selection.line < visible_lines + scroll)) {
2330 const StringRef line = lines[selection.line];
2335 std::max<int>(0, selection.start - line.
begin()),
2336 selection.end - selection.start);
2338 const float y = rect.
ymax - (line_height *
float(selection.line - scroll));
2348#ifdef WITH_INPUT_IME
2350 if (!ime_reposition_window && lines_selection.
size() > 0) {
2351 ime_reposition_window =
true;
2352 ime_win_x = rect.
xmin;
2353 ime_win_y = rect.
ymax -
2354 (line_height * (std::clamp(line_select_end, scroll, scroll + visible_lines - 1) -
2360#ifdef WITH_INPUT_IME
2364 but->
pos + (ime_data ? ime_data->composite.size() : 0),
2372 for (
const LineSelection &underlying : ime_underlying_selection) {
2373 if (!(scroll <= underlying.line && underlying.line < visible_lines + scroll)) {
2376 const StringRef line = lines[underlying.line];
2381 std::max<int>(0, underlying.start - line.
begin()),
2382 underlying.end - underlying.start);
2384 const int y = rect.
ymax - (line_height *
float(underlying.line - scroll + 1)) +
2396 if (scroll <= line_cursor && line_cursor < scroll + visible_lines) {
2398 lines[line_cursor].begin(),
2399 lines[line_cursor].size(),
2400 but_pos - (lines[line_cursor].begin() -
str),
2413 const int y = rect.
ymax - (line_height * (line_cursor - scroll));
2418#ifdef WITH_INPUT_IME
2420 if (!ime_reposition_window) {
2421 ime_reposition_window =
true;
2422 ime_win_x = rect.
xmin + t + 5;
2423 ime_win_y = rect.
ymax -
2425 (std::clamp(line_cursor, scroll, scroll + visible_lines - 1) - scroll + 1)) +
2431#ifdef WITH_INPUT_IME
2433 if (ime_reposition_window) {
2434 button_ime_reposition(but, ime_win_x, ime_win_y);
2440 params.
align = align;
2442 float ymax = rect.
ymax;
2453 for (
const StringRef line : draw_lines.as_span().slice_safe(scroll, visible_lines)) {
2454 if (rect.
xmin > button_rect->
xmax - scrollbar_pad - text_padding) {
2458 ymax -= line_height;
2461 &style, &rect, line.begin(), line.size(), col, ¶ms,
nullptr,
nullptr,
nullptr);
2469 GPU_scissor(scissor[0], scissor[1], scissor[2], scissor[3]);
2470 rcti grip_rect = *button_rect;
2472 grip_rect.
xmin = grip_rect.
xmax - text_padding - scrollbar_pad;
2476 ICON_GRIP_CORNER_BOTTOM_RIGHT, textbox->
block->
aspect, 1.0f, &grip_rect, wcol->
text);
2483 rcti scroll_rect = *button_rect;
2484 BLI_rcti_pad(&scroll_rect, -scrollbar_pad, -scrollbar_pad);
2485 scroll_rect.
xmin = scroll_rect.
xmax - text_padding;
2488 rcti slider_rect = scroll_rect;
2490 const float factor =
float(scroll_rect.
ymax - scroll_rect.
ymin) /
float(lines.size());
2493 slider_rect.
ymin = slider_rect.
ymax - std::ceil(factor * visible_lines);
2499 const int pad = slider_rect.
ymax > scroll_rect.
ymax ? -(slider_rect.
ymax - scroll_rect.
ymax) :
2500 slider_rect.
ymin < scroll_rect.
ymin ? (scroll_rect.
ymin - slider_rect.
ymin) :
2503 slider_rect.
ymin = std::max(slider_rect.
ymin, scroll_rect.
ymin);
2504 slider_rect.
ymax = std::min(slider_rect.
ymax, scroll_rect.
ymax);
2524 const int yofs = (
BLI_rcti_size_y(rect) - width) / 2 * (down ? 1 : -1);
2526 (down ? rect->
xmin : rect->
xmax) + xofs,
2527 (down ? rect->
ymax : rect->
ymin) - yofs,
2540 const char *drawstr = but->
drawstr.c_str();
2541 const char *drawstr_right =
nullptr;
2542 bool use_right_only =
false;
2546#ifdef WITH_INPUT_IME
2547 const wmIMEData *ime_data;
2548 std::string ime_drawstr;
2580#ifdef WITH_INPUT_IME
2581 ime_data = button_ime_data_get(but);
2583 if (ime_data && !ime_data->composite.empty()) {
2586 STRNCPY(tmp_drawstr, drawstr);
2588 sizeof(tmp_drawstr),
2592 ime_data->composite.c_str(),
2594 ime_drawstr = tmp_drawstr;
2595 drawstr = ime_drawstr.c_str();
2614 drawstr = indeterminate_str;
2615 drawstr_left_len = strlen(drawstr);
2621 int align_x_ofs = 0;
2625 align_x_ofs =
max_ii(0, rect_width - width);
2629#ifdef WITH_INPUT_IME
2630 bool ime_reposition_window =
false;
2631 int ime_win_x, ime_win_y;
2635 if ((but->
selend - but->
selsta) != 0 && drawstr[0] != 0) {
2646 strlen(drawstr + but->
ofs),
2649 for (
auto bounds : boxes) {
2652 rect->
ymin +
U.pixelsize,
2654 rect->
ymax -
U.pixelsize);
2659#ifdef WITH_INPUT_IME
2661 if (!ime_reposition_window && boxes.size() > 0) {
2662 ime_reposition_window =
true;
2663 ime_win_x = rect->
xmin + boxes[0].min;
2664 ime_win_y = rect->
ymin +
U.pixelsize;
2670 but_pos_ofs = but->
pos;
2672#ifdef WITH_INPUT_IME
2674 if (ime_data && !ime_data->composite.empty() && ime_data->cursor_pos != -1) {
2675 but_pos_ofs += ime_data->cursor_pos;
2680 if (but->
pos >= but->
ofs) {
2685 but_pos_ofs - but->
ofs,
2686 max_ii(1,
int(
U.pixelsize * 2)));
2701 rect->
xmin + t + align_x_ofs,
2702 rect->
ymin +
U.pixelsize,
2703 rect->
xmin + t + align_x_ofs +
int(2.0f *
U.pixelsize),
2704 rect->
ymax -
U.pixelsize);
2708#ifdef WITH_INPUT_IME
2710 if (!ime_reposition_window) {
2711 ime_reposition_window =
true;
2712 ime_win_x = rect->
xmin + t + 5;
2713 ime_win_y = rect->
ymin + 3;
2718#ifdef WITH_INPUT_IME
2720 if (ime_reposition_window) {
2721 button_ime_reposition(but, ime_win_x, ime_win_y);
2723 if (ime_data && !ime_data->composite.empty()) {
2725 widget_draw_text_ime_underline(fstyle, wcol, but, rect, ime_data, drawstr, align_x_ofs);
2731 rasterpos_safe(
x,
y, but->aspect);
2732 transopts = translate_buttons();
2735 bool use_drawstr_right_as_hint =
false;
2740 if (drawstr_right) {
2741 use_drawstr_right_as_hint =
true;
2742 drawstr_left_len = (drawstr_right - drawstr);
2747#ifdef USE_NUMBUTS_LR_ALIGN
2753 drawstr_right = strrchr(drawstr + but->
ofs,
':');
2754 if (drawstr_right) {
2756 drawstr_left_len = (drawstr_right - drawstr - 1);
2758 while (*drawstr_right ==
' ') {
2764 drawstr_right = drawstr + but->
ofs;
2765 use_right_only =
true;
2774 int xmin = rect->
xmin;
2776 xmin = rect->
xmax - width;
2780 xmin = rect->
xmin + std::round(
float(rect_width - width + 1) / 2.0f);
2784 if (!use_right_only) {
2786 int font_xofs, font_yofs;
2788 int drawlen = (drawstr_left_len ==
INT_MAX) ? strlen(drawstr + but->
ofs) :
2789 (drawstr_left_len - but->
ofs);
2793 params.
align = align;
2805 const char *drawstr_ofs = drawstr + but->
ofs;
2810 const char *drawstr_end = drawstr_ofs + drawlen;
2813 const char *drawstr_menu = strchr(drawstr_ofs, keys[i]);
2814 if (drawstr_menu !=
nullptr && drawstr_menu < drawstr_end) {
2815 ul_index = int(drawstr_menu - drawstr_ofs);
2821 if (ul_index != -1) {
2827 int pos_x = rect->
xmin + font_xofs +
bounds.xmin +
2829 int pos_y = rect->
ymin + font_yofs +
bounds.ymin -
U.pixelsize;
2838 if (unit_hint && drawstr[0] !=
'\0') {
2849 rcti unit_hint_rect;
2870 if (placeholder && placeholder[0]) {
2872 params.
align = align;
2879 &style, rect, placeholder, strlen(placeholder), col, ¶ms,
nullptr,
nullptr,
nullptr);
2884 if (drawstr_right) {
2887 if (use_drawstr_right_as_hint) {
2905 const int total_lines = multiline_label->
wrap_cache->wrapped_lines.size();
2906 const int lines = multiline_label->
max_lines > 0 ?
2907 std::min(multiline_label->
max_lines, total_lines) :
2918 rcti line_rect = *rect;
2921 int scissors_ymin = scissors[1];
2922 int scissors_ymax = scissors_ymin + scissors[3];
2924 for (
const int i : multiline_label->
wrap_cache->wrapped_lines.index_range().take_front(lines)) {
2926 line_rect.
ymax = ymax;
2927 ymax -= line_height;
2928 line_rect.
ymin = ymax;
2930 if (line_rect.
ymax < scissors_ymin) {
2934 if (line_rect.
ymin > scissors_ymax) {
2937 if (i < (lines - 1) || total_lines == lines) {
2954 std::string
str = line;
2955 if (strwidth > okwidth) {
2958 str =
str.substr(0, drawstr_len);
2989 rect->
xmax -= 0.2 * icon_size;
2995 float alpha_this = alpha;
2999 if (op_icon.disabled) {
3002 else if (!op_icon.highlighted) {
3003 alpha_this *= 0.75f;
3007 const int old_drawflags = but->
drawflag;
3012 rect->
xmax -= icon_size;
3048 const float alpha =
float(wcol->
text[3]) / 255.0f;
3049 std::string password_str;
3051 bool no_right_padding = no_left_padding;
3064 no_left_padding =
true;
3069 no_right_padding =
true;
3090 icon_size -= text_size;
3094 rect->
ymin += text_size;
3105 rect->
ymin -= text_size;
3106 rect->
ymax -= icon_size;
3117#ifdef USE_UI_TOOLBAR_HACK
3129#ifdef USE_UI_TOOLBAR_HACK
3144 rect->
xmin += 0.3f *
U.widget_unit;
3149 rect->
xmin += 0.2f *
U.widget_unit;
3155 if (show_menu_icon) {
3160#ifdef USE_UI_TOOLBAR_HACK
3180 if (!no_right_padding) {
3184 rect->
xmax -=
U.pixelsize;
3186 rect->
xmin +=
U.pixelsize;
3189 if (!no_left_padding) {
3192 rect->
xmin += text_padding;
3197 rect->
xmin += text_padding;
3206 rect->
xmin +=
U.pixelsize;
3224 else if (but->
drawstr[0] ==
'\0') {
3263#undef UI_TEXT_CLIP_MARGIN
3279 wcol.
inner[3] *= factor;
3281 wcol.
item[3] *= factor;
3282 wcol.
text[3] *= factor;
3350 if (
state->draw_as_link) {
3362 if (color_blend !=
nullptr) {
3376 if (color_blend !=
nullptr) {
3393 const float red_alpha =
float(red[3]) / 255.0f;
3415 const uchar blue[4] = {86, 128, 194};
3433 return wcol->
roundness *
U.widget_unit * zoom;
3482 if (color_blend !=
nullptr) {
3631 const float outline =
U.pixelsize;
3642 draw_dropshadow(&shadow_rect, radin, shadow_width, 1.0f, shadow_alpha);
3647 const int block_flag,
3648 const int direction,
3693 const bool is_active)
3696 const float radius = zoom * (((is_active ? 20.0f : 12.0f) *
UI_SCALE_FAC) +
U.pixelsize);
3707 const float fg = std::min(1.0f - hsv[2] + 0.2f, 0.8f);
3708 const float bg = hsv[2] / 2.0f;
3728 const rcti *rect,
const float mx,
const float my,
float *r_val_rad,
float *r_val_dist)
3734 const float m_delta[2] = {mx - centx, my - centy};
3737 *r_val_dist = (dist_sq < (radius * radius)) ?
sqrtf(dist_sq) / radius : 1.0f;
3742 const ColorPicker *cpicker,
const rcti *rect,
const float *hsv,
float *r_xpos,
float *r_ypos)
3753 radius_t = (1.0f -
pow3f(1.0f - hsv[1]));
3759 const float rad =
clamp_f(radius_t, 0.0f, 1.0f) * radius;
3760 *r_xpos = centx +
cosf(-ang) * rad;
3761 *r_ypos = centy +
sinf(-ang) * rad;
3775 float rgb[3], hsv[3], rgb_center[3], rgb_perceptual[3];
3787 if (!is_color_gamma) {
3791 CLAMP(hsv[2], 0.0f, 1.0f);
3805 const float hsv_center[3] = {0.0f, 0.0f, hsv[2]};
3809 if (!is_color_gamma) {
3824 for (
int a = 0; a <= tot; a++, ang += radstep) {
3825 const float si =
sinf(ang);
3826 const float co =
cosf(ang);
3831 hsv_ang[2] = hsv[2];
3836 if (!is_color_gamma) {
3841 immVertex2f(pos, centx + co * radius, centy + si * radius);
3897 const int steps = 48;
3898 const float color_step = 1.0f / steps;
3900 const float h = hsv[0], s = hsv[1],
v = hsv[2];
3901 float dx, dy, sx1, sx2, sy;
3962 for (dx = 0.0f; dx < 0.999f; dx += color_step) {
3963 const float dx_next = dx + color_step;
4021 for (a = 0; a < 3; a++, sy += dy) {
4022 immAttr4f(col, col0[a][0], col0[a][1], col0[a][2], alpha);
4025 immAttr4f(col, col1[a][0], col1[a][1], col1[a][2], alpha);
4028 immAttr4f(col, col1[a + 1][0], col1[a + 1][1], col1[a + 1][2], alpha);
4031 immAttr4f(col, col0[a][0], col0[a][1], col0[a][2], alpha);
4034 immAttr4f(col, col1[a + 1][0], col1[a + 1][1], col1[a + 1][2], alpha);
4037 immAttr4f(col, col0[a + 1][0], col0[a + 1][1], col0[a + 1][2], alpha);
4047 const ButtonHSVCube *hsv_but,
const rcti *rect,
const float *hsv,
float *r_xp,
float *r_yp)
4049 float x = 0.0f,
y = 0.0f;
4098 float rgb[3], rgb_perceptual[3];
4099 float x = 0.0f,
y = 0.0f;
4149 const float cursor_width = std::max(
BLI_rctf_size_y(&rectf) * 0.35f, 1.0f);
4150 rectf.
xmin =
x - cursor_width;
4151 rectf.
xmax =
x + cursor_width;
4155 rectf.
xmin -=
U.pixelsize;
4156 rectf.
xmax +=
U.pixelsize;
4157 rectf.
ymin -=
U.pixelsize;
4158 rectf.
ymax +=
U.pixelsize;
4161 const float col[4] = {0.0f, 0.0f, 0.0f, 1.0f};
4166 const float inner[4] = {1.0f, 1.0f, 1.0f, 1.0f};
4167 const float col2[4] = {0.0f, 0.0f, 0.0f, 0.0f};
4176 float rgb[3], hsv[3],
v;
4198 const float inner1[4] = {1.0f, 1.0f, 1.0f, 1.0f};
4199 const float inner2[4] = {0.0f, 0.0f, 0.0f, 1.0f};
4200 const float outline[4] = {0.0f, 0.0f, 0.0f, 1.0f};
4202 const float outline_width = (
BLI_rctf_size_x(&rectf) < 4.0f) ? 0.0f : 1.0f;
4208 const float cursor_height = std::max(
BLI_rctf_size_x(&rectf) * 0.35f, 1.0f);
4209 rectf.
ymin =
y - cursor_height;
4210 rectf.
ymax =
y + cursor_height;
4211 float col[4] = {0.0f, 0.0f, 0.0f, 1.0f};
4215 rectf.
xmin -=
U.pixelsize;
4216 rectf.
xmax +=
U.pixelsize;
4217 rectf.
ymin -=
U.pixelsize;
4218 rectf.
ymax +=
U.pixelsize;
4225 const float col2[4] = {
v,
v,
v, 1.0f};
4235 const uchar col[4] = {
4274#define NUM_BUT_PADDING_FACTOR 0.425f
4304 !
state->is_text_input)
4309 int roundboxalign_zone;
4319 wcol_zone.
item[3] = 180;
4326 rect_zone.
xmax = rect->
xmin + handle_width +
U.pixelsize;
4342 wcol_zone.
item[3] = 180;
4349 rect_zone.
xmin = rect->
xmax - handle_width -
U.pixelsize;
4370 rect_zone.
xmin = rect->
xmin + handle_width -
U.pixelsize;
4371 rect_zone.
xmax = rect->
xmax - handle_width +
U.pixelsize;
4386 if (!
state->is_text_input) {
4389 rect->
xmin += text_padding;
4390 rect->
xmax -= text_padding;
4519 if (lightness > 70) {
4523 wcol->
item[3] = 128;
4526 wcol->
item[0] = 255;
4527 wcol->
item[1] = 255;
4528 wcol->
item[2] = 255;
4529 wcol->
item[3] = 128;
4533 rcti slider_inset = *slider;
4534 slider_inset.
xmin += 0.05 *
U.widget_unit;
4535 slider_inset.
xmax -= 0.05 *
U.widget_unit;
4613 rcti rect_prog = *rect, rect_bar = *rect;
4625 w = std::max(
w, ofs);
4627 rect_bar.xmax = rect_bar.xmin +
w;
4647 const float ring_width = 0.6;
4648 const float outer_rad = (rect->
ymax - rect->
ymin) / 2.0f;
4649 const float inner_rad = outer_rad * ring_width;
4650 const float x = rect->
xmin + outer_rad;
4651 const float y = rect->
ymin + outer_rad;
4652 const float start = 0.0f;
4672 if (but_progress->
drawstr[0]) {
4709 outline_color.
a = 1.0f;
4716 socket_rect.
xmin = cent_x - socket_radius;
4717 socket_rect.
xmax = cent_x + socket_radius;
4718 socket_rect.
ymin = cent_y - socket_radius;
4719 socket_rect.
ymax = cent_y + socket_radius;
4753 int roundboxalign_slider = roundboxalign;
4765 float factor, factor_ui;
4766 float factor_discard = 1.0f;
4768 const float softmin = but->
softmin;
4769 const float softmax = but->
softmax;
4770 const float softrange = softmax - softmin;
4773 switch (scale_type) {
4775 factor = (value - softmin) / softrange;
4779 const float logmin =
fmaxf(softmin, 0.5e-8f);
4780 const float base = softmax / logmin;
4781 factor =
logf(value / logmin) /
logf(base);
4785 const float cubicmin =
cube_f(softmin);
4786 const float cubicmax =
cube_f(softmax);
4787 const float cubicrange = cubicmax - cubicmin;
4788 const float f = (value - softmin) * cubicrange / softrange + cubicmin;
4789 factor = (cbrtf(f) - softmin) / softrange;
4795 factor_ui = factor * width;
4798 const float min_width = 2.0f * rad;
4800 if (factor_ui > width - rad) {
4802 factor_discard = factor;
4804 else if (factor_ui > min_width) {
4807 rect1.
xmax = rect1.
xmin + factor_ui;
4812 rect1.
xmax = rect1.
xmin + min_width;
4813 factor_discard = factor_ui / min_width;
4837 if (!
state->is_text_input) {
4839 rect->
xmax -= text_padding;
4840 rect->
xmin += text_padding;
4845#define SWATCH_KEYED_BORDER 3
4877 col[0] = col[1] = col[2] = col[3] = 0.5f;
4880 if ((
state->but_flag &
4900 const bool show_alpha_checkers = col[3] < 1.0f;
4912 const float width = rect->
xmax - rect->
xmin;
4913 const float height = rect->
ymax - rect->
ymin;
4917 bw += (bw < 0.5f) ? 0.5f : -0.5f;
4957 if (
state->but_flag &
5038 wcol->
inner[3] *= 1.0f - back[3];
5061 const float padding = zoom * 0.125f *
U.widget_unit;
5110 wcol->
inner[3] *= fac;
5112 wcol->
item[3] *= fac;
5113 wcol->
text[3] *= fac;
5127 rcti draw_rect = *rect;
5155 wcol->
inner[3] = is_selected ? 255 : 20;
5191 rcti recttemp = *rect;
5197 if (text_before_widget) {
5230 const float offset = delta * 0.9;
5231 if (text_before_widget) {
5232 rect->
xmax = recttemp.
xmin - offset;
5235 rect->
xmin = recttemp.
xmax + offset;
5266 float red_alpha =
float(red[3]) / 255.0f;
5300 if (but !=
nullptr && but->
col[3]) {
5339 const float rad = wcol->
roundness *
U.widget_unit;
5360 if (
state->has_hold_action) {
5370 if (push_but->draw_as_overlay) {
5381 const uchar foreground_col[4] = {
5407 uchar theme_col_tab_highlight[3];
5409#ifdef USE_TAB_SHADED_HIGHLIGHT
5426#ifdef USE_TAB_SHADED_HIGHLIGHT
5437#ifdef USE_TAB_SHADED_HIGHLIGHT
5442#ifndef USE_TAB_SHADED_HIGHLIGHT
5451 const float rad = wcol->
roundness *
U.widget_unit;
5685 rect->
ymax +=
U.pixelsize;
5688 rect->
xmin -=
U.pixelsize;
5775 switch (but->
type) {
5800 switch (but->
type) {
5812 if (but->
icon == 0) {
5833 switch (but->
type) {
5858#ifdef USE_UI_TOOLBAR_HACK
6057 if (wt ==
nullptr) {
6078 state.is_text_input =
true;
6082 state.has_hold_action =
true;
6085 bool use_alpha_blend =
false;
6088 use_alpha_blend =
true;
6093#ifdef USE_UI_POPOVER_ONCE
6113 else if (wt->
draw) {
6118 if (use_alpha_blend) {
6128 wt->
text(fstyle, &wt->
wcol, but, rect);
6129 if (use_alpha_blend) {
6138 float draw_color[4];
6144 draw_color[3] = 1.0f;
6187 const float radius = (bg_radius > (line_width * 2.0f)) ? 0.0f : bg_radius;
6188 const float padding = (bg_radius > (line_width * 2.0f)) ? bg_radius : 0.0f;
6191 line_rect.
ymin = line_rect.
ymax - line_width;
6203 const float zoom = 1.0f / block->
aspect;
6228 const float unit_size,
6229 const float mval_origin[2])
6232 const float unit_half = unit_size / 2;
6233 const float cent_x = mval_origin ? std::clamp(mval_origin[0],
6234 rect->
xmin + unit_size,
6235 rect->
xmax - unit_size) :
6245 const int roundboxalign =
CNR_ALL;
6260 const int sign = is_down ? 1 : -1;
6261 float y = is_down ? rect->
ymax : rect->
ymin;
6312 const uchar col1[4],
6313 const uchar col2[4],
6316 const float radius_ext_scale = (0.5f / radius_ext);
6331 for (
int i = 0; i < subd; i++) {
6332 const float a = start + ((i) /
float(subd - 1)) *
angle;
6333 const float s =
sinf(a);
6334 const float c =
cosf(a);
6335 const float y1 = s * radius_int;
6336 const float y2 = s * radius_ext;
6340 const float fac = (y1 + radius_ext) * radius_ext_scale;
6350 const float fac = (y2 + radius_ext) * radius_ext_scale;
6366 const float cx = block->
pie_data->pie_center_spawned[0];
6367 const float cy = block->
pie_data->pie_center_spawned[1];
6369 const float *pie_dir = block->
pie_data->pie_dir;
6371 const float pie_radius_internal =
UI_SCALE_FAC *
U.pie_menu_threshold;
6372 const float pie_radius_external =
UI_SCALE_FAC * (
U.pie_menu_threshold + 7.0f);
6374 const int subd = 40;
6376 const float angle =
atan2f(pie_dir[1], pie_dir[0]);
6380 const float range = (has_aligned && has_diagonal) ?
M_PI_4 :
M_PI_2;
6387 uchar col1[4], col2[4];
6394 0.0f,
float(
M_PI * 2.0), pie_radius_internal, pie_radius_external, subd, col1, col2,
true);
6399 pie_radius_internal,
6400 pie_radius_external,
6409 uchar col1[4], col2[4];
6417 pie_radius_internal,
6418 pie_radius_external,
6427 pie_radius_internal,
6428 pie_radius_external,
6447 const float pie_confirm_radius =
UI_SCALE_FAC * (pie_radius_internal +
U.pie_menu_confirm);
6449 (pie_radius_internal +
U.pie_menu_confirm + 7.0f);
6455 pie_confirm_external,
6478 const float color[4])
6494 else if (wt->
draw) {
6495 rcti rect_copy = *rect;
6524 const bool use_unpadded,
6533 const rcti _rect = *rect;
6536 int padding = 0.25f * row_height;
6537 char *cpoin =
nullptr;
6540 state.but_flag = but_flag;
6553 rect->
xmin += row_height;
6558 cpoin =
const_cast<char *
>(strrchr(name,
UI_SEP_CHAR));
6577 if ((name_width + hint_width) > available_width) {
6579 max_hint_width = available_width * 0.40f;
6581 rect->
xmax = (hint_width < max_hint_width) ?
6582 (rect->
xmax - hint_width) :
6583 (rect->
xmin + (available_width - max_hint_width));
6595 const size_t drawstr_maxncpy =
sizeof(drawstr);
6603 int xofs = 0, yofs = 0;
6608 fstyle, rect, drawstr,
sizeof(drawstr), wt->
wcol.
text, ¶ms, &xofs, &yofs, &info);
6609 if (r_xmax !=
nullptr) {
6610 *r_xmax = xofs + info.
width;
6621 const float aspect =
U.inv_scale_factor / zoom;
6641 const size_t hint_drawstr_maxncpy =
sizeof(hint_drawstr);
6645 if (hint_drawstr[0] && (max_hint_width <
INT_MAX)) {
6647 fstyle, hint_drawstr, max_hint_width, minwidth, hint_drawstr_maxncpy,
'\0');
6664 const uchar text_col[4],
6666 const bool add_padding)
6670 const bool has_text = !name.
is_empty();
6676 rect->
ymin += text_size;
6687 trect.
ymax = trect.
ymin + text_size;
6697 const size_t drawstr_maxncpy =
sizeof(drawstr);
6700 memcpy(drawstr, name.
data(), name.
size());
6701 drawstr[name.
size()] =
'\0';
6705 params.
align = text_align;
6706 fontstyle_draw(fstyle, &trect, drawstr,
sizeof(drawstr), text_col, ¶ms);
6721 state.but_flag = but_flag;
Functions and classes for evaluating template expressions in filepaths.
#define BKE_TEMPLATE_EXPRESSION_ABBREVIATION
#define rgba_float_args_set_ch(col, r, g, b, a)
#define STRNCPY_UTF8(dst, src)
#define BLI_STR_UTF8_HORIZONTAL_ELLIPSIS
#define GPU_batch_uniform_4fv_array(batch, name, len, val)
#define GPU_batch_uniform_3fv(batch, name, val)
#define UI_ALPHA_CHECKER_LIGHT
#define UI_ALPHA_CHECKER_DARK
#define UI_VALUE_INDETERMINATE_CHAR
#define ICON_DEFAULT_HEIGHT
#define ICON_DEFAULT_HEIGHT_TOOLBAR
#define UI_NO_ICON_OVERLAY_TEXT
#define ICON_DEFAULT_WIDTH
int pad[32 - sizeof(int)]
#define BLI_assert_unreachable()
#define UNUSED_VARS_NDEBUG(...)
#define BLI_assert_msg(a, msg)
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
SIMD_FORCE_INLINE btScalar angle(const btVector3 &v) const
Return the angle between this and another vector.
constexpr const char * begin() const
constexpr bool is_empty() const
constexpr int64_t size() const
constexpr StringRef trim_right() const
constexpr StringRef trim_left() const
constexpr const char * data() const
void append(const T &value)
void reserve(const int64_t min_capacity)
float3x3 scale(float3x3 mat, float2 scale)
#define UI_MENU_SUBMENU_PADDING
#define UI_RADIAL_MASK_ALL_DIAGONAL
#define UI_RADIAL_MASK_ALL_AXIS_ALIGNED
#define UI_PIXEL_AA_JITTER
ccl_device_inline dual1 len(const ccl_private dual< T > &a)
ccl_device_inline dual3 fabs(const ccl_private dual3 &a)
std::optional< ExpressionInfo > next_template_variable_expression(StringRef text, size_t starting_offset)
void node_socket_draw(bNodeSocket *sock, const rcti *rect, const float color[4], float scale)
void node_draw_nodesocket(const rctf *rect, const float color_inner[4], const float color_outline[4], float outline_thickness, int shape, float aspect)
int get_menu_shadow_width()
void get_color_4ubv(int colorid, unsigned char col[4])
void get_color_4fv(int colorid, float col[4])
const bTheme * theme_get()
void get_color_3ubv(int colorid, unsigned char col[3])
void get_color_type_4fv(int colorid, int spacetype, float col[4])
static void widget_state_nothing(WidgetType *wt, const WidgetStateInfo *, EmbossType)
static void widget_numbut_draw(const Button *but, uiWidgetColors *wcol, rcti *rect, const float zoom, const WidgetStateInfo *state, int roundboxalign, bool emboss)
static void text_clip_cursor(const uiFontStyle *fstyle, Button *but, const rcti *rect)
static const uint g_shape_preset_scroll_circle_face[14][3]
static void widget_box(Button *but, uiWidgetColors *wcol, rcti *rect, const WidgetStateInfo *, int roundboxalign, const float zoom)
@ UI_MENU_ITEM_SEPARATOR_SHORTCUT
@ UI_MENU_ITEM_SEPARATOR_NONE
@ UI_MENU_ITEM_SEPARATOR_HINT
void draw_preview_item(const uiFontStyle *fstyle, rcti *rect, float zoom, const char *name, int iconid, int64_t but_flag, FontStyleAlign text_align)
static void widget_but(uiWidgetColors *wcol, rcti *rect, const WidgetStateInfo *, int roundboxalign, const float zoom)
static void text_clip_give_next_off(Button *but, const char *str, const char *str_end)
static void draw_popover_back_impl(const uiWidgetColors *wcol, const rcti *rect, int direction, const float unit_size, const float mval_origin[2])
static void widgetbase_outline(WidgetBase *wtb, uint pos)
void hsvcircle_vals_from_pos(const rcti *rect, float mx, float my, float *r_val_rad, float *r_val_dist)
void perceptual_to_scene_linear_space(Button *but, float rgb[3])
int button_icon(const Button *but)
static void widget_menu_back(uiWidgetColors *wcol, const rcti *rect, const int block_flag, const int direction, const float zoom)
static void widget_scroll(Button *but, uiWidgetColors *wcol, rcti *rect, const WidgetStateInfo *state, int, const float)
static void widgetbase_set_uniform_discard_factor(WidgetBase *wtb, const float discard_factor)
static void draw_dialog_alert(Block *block, const rcti *rect)
void draw_tooltip_background(const uiStyle *style, Block *block, const rcti *rect)
gpu::Batch * batch_roundbox_widget_get()
void draw_but_VECTORSCOPE(const bContext *C, ARegion *region, Button *but, const uiWidgetColors *, const rcti *recti)
static float widget_alpha_factor(const WidgetStateInfo *state)
@ BLOCK_THEME_STYLE_POPUP
static void widgetbase_set_uniform_colors_ubv(WidgetBase *wtb, const uchar *col1, const uchar *col2, const uchar *outline, const uchar *emboss, const uchar *tria)
static void widget_swatch(Button *but, uiWidgetColors *wcol, rcti *rect, const WidgetStateInfo *state, int roundboxalign, const float zoom)
bool button_menu_draw_as_popover(const Button *but)
static void set_roundbox_vertex_data(GPUVertBufRaw *vflag_step, uint32_t d)
static float widget_radius_from_zoom(const float zoom, const uiWidgetColors *wcol)
void widgetbase_draw_cache_begin()
static void widget_textbut(uiWidgetColors *wcol, rcti *rect, const WidgetStateInfo *state, int roundboxalign, const float zoom)
@ UI_SEARCH_FILTER_NO_MATCH
static void widget_icon_has_anim(Button *but, uiWidgetColors *wcol, rcti *rect, const WidgetStateInfo *state, int roundboxalign, const float zoom)
Vector< StringRef > textbox_wrap_lines(ButtonTextBox *textbox)
static void widget_state_pulldown(WidgetType *wt, const WidgetStateInfo *, EmbossType)
static size_t text_shorten_next_template_var(char *str, size_t byte_position)
const ColorManagedDisplay * block_cm_display_get(Block *block)
bool button_label_is_markdown(const Button *button)
void draw_widget_menu_back(const rcti *rect, bool use_shadow)
static void hsv_cursor(const float x, const float y, const float zoom, const float rgb[3], const float hsv[3], const bool is_active)
const char * button_placeholder_get(Button *but)
static void widget_menu_itembut_unpadded(uiWidgetColors *wcol, rcti *rect, const WidgetStateInfo *, int, const float zoom)
const uiStyle * style_get()
void button_text_password_hide(std::string &password_str, Button *but, const bool restore)
void draw_but_WAVEFORM(const bContext *C, ARegion *region, Button *but, const uiWidgetColors *, const rcti *recti)
static void widget_init(WidgetBase *wtb)
static void text_clip_middle_protect_right(const uiFontStyle *fstyle, Button *but, const rcti *rect, const char rsep)
static struct blender::ui::@103037352170362214212313350304074272316175255355 g_ui_batch_cache
static void round_box_edges(WidgetBase *wt, int roundboxalign, const rcti *rect, float rad)
static const uint g_shape_preset_checkmark_face[4][3]
static const GPUVertFormat & vflag_format()
static void widget_numbut(Button *but, uiWidgetColors *wcol, rcti *rect, const WidgetStateInfo *state, int roundboxalign, const float zoom)
static const WidgetStateInfo STATE_INFO_NULL
void fontstyle_draw_ex(const uiFontStyle *fs, const rcti *rect, const char *str, size_t str_len, const uchar col[4], const FontStyleDrawParams *fs_params, int *r_xofs, int *r_yofs, ResultBLF *r_info)
bool icon_get_theme_color(int icon_id, unsigned char color[4])
static int widget_roundbox_set(Button *but, rcti *rect)
static void widget_draw_preview_icon(BIFIconID icon, float alpha, float aspect, const bool add_padding, const rcti *rect, const uchar mono_color[4])
void block_cm_to_display_space_v3(Block *block, float pixel[3])
static void draw_but_HSVCIRCLE(Button *but, const uiWidgetColors *wcol, const rcti *rect)
static const float g_shape_preset_menu_arrow_vert[6][2]
static void draw_anti_tria_rect(const rctf *rect, char dir, const float color[4])
Vector< StringRef > textbox_wrap_placeholder(ButtonTextBox *textbox)
static void widget_tab(Button *but, uiWidgetColors *wcol, rcti *rect, const WidgetStateInfo *state, int roundboxalign, const float zoom)
static const uint g_shape_preset_menu_arrow_face[2][3]
static void round_box__edges(WidgetBase *wt, int roundboxalign, const rcti *rect, float rad, float radi)
static void widget_menubut_embossn(const Button *, uiWidgetColors *wcol, rcti *rect, const WidgetStateInfo *, int)
static void widget_radiobut(uiWidgetColors *wcol, rcti *rect, const WidgetStateInfo *, int roundboxalign, const float zoom)
static void text_clip_give_prev_off(Button *but, const char *str)
static void widget_preview_tile(Button *but, uiWidgetColors *wcol, rcti *rect, const WidgetStateInfo *state, int roundboxalign, const float zoom)
void icon_draw_ex(float x, float y, int icon_id, float aspect, float alpha, float desaturate, const uchar mono_color[4], bool mono_border, const IconTextOverlay *text_overlay, const bool inverted=false, float scale=1.0f)
void draw_widget_menu_back_color(const rcti *rect, bool use_shadow, const float color[4])
void draw_but_CURVEPROFILE(ARegion *region, Button *but, const uiWidgetColors *wcol, const rcti *rect)
void fontstyle_set(const uiFontStyle *fs)
static void widget_state_option_menu(WidgetType *wt, const WidgetStateInfo *state, EmbossType emboss)
static void widget_draw_node_link_socket(const uiWidgetColors *wcol, const rcti *rect, Button *but, float alpha)
static WidgetType * popover_widget_type(Button *but, rcti *rect)
@ BLOCK_CONTAINS_SUBMENU_BUT
void draw_popover_back(ARegion *region, uiStyle *style, Block *block, const rcti *rect)
void draw_dropshadow(const rctf *rct, float radius, float width, float aspect, float alpha)
static void widget_draw_text_icon(const uiFontStyle *fstyle, const uiWidgetColors *wcol, Button *but, rcti *rect)
PropertyScaleType button_scale_type(const Button *but)
static void draw_but_HSVCUBE(Button *but, const rcti *rect)
static void widget_draw_extra_mask(const bContext *C, Button *but, WidgetType *wt, rcti *rect)
void draw_but_TAB_outline(const rcti *rect, float rad, uchar highlight[3], uchar highlight_fade[3])
static void widget_draw_icon(const Button *but, BIFIconID icon, float alpha, const rcti *rect, const uchar mono_color[4])
static void widget_draw_vertical_text(const uiFontStyle *fstyle, const uiWidgetColors *wcol, const Button *but, const rcti *rect)
float text_clip_middle_ex(const uiFontStyle *fstyle, char *str, float okwidth, float minwidth, size_t str_maxncpy, char rpart_sep, bool clip_right_if_tight=true, bool shorten_template_variables=false)
static void widget_state_menu_item(WidgetType *wt, const WidgetStateInfo *state, EmbossType)
static void widget_progress_type_bar(ButtonProgress *but_progress, uiWidgetColors *wcol, rcti *rect, int roundboxalign, const float zoom)
static void draw_but_HSV_v(Button *but, const rcti *rect)
void hsvcube_pos_from_vals(const ButtonHSVCube *hsv_but, const rcti *rect, const float *hsv, float *r_xp, float *r_yp)
static void widget_numslider(Button *but, uiWidgetColors *wcol, rcti *rect, const WidgetStateInfo *state, int roundboxalign, const float zoom)
bool block_is_menu(const Block *block) ATTR_WARN_UNUSED_RESULT
static size_t avoid_non_split_patterns(StringRef str, const size_t split_offset, const bool shift_left)
@ ROUNDBOX_TRIA_HOLD_ACTION_ARROW
static void color_ensure_contrast_v3(uchar cp[3], const uchar cp_other[3], int contrast)
void widgetbase_draw_cache_end()
Button * button_drag_multi_edit_get(Button *but)
static void widget_state_label(WidgetType *wt, const WidgetStateInfo *state, EmbossType emboss)
static void color_mul_hsl_v3(uchar ch[3], float h_factor, float s_factor, float l_factor)
void draw_but_IMAGE(ARegion *, Button *but, const uiWidgetColors *, const rcti *rect)
static void draw_clip_tri(Block *block, const rcti *rect, WidgetType *wt)
@ BLOCK_NO_DRAW_OVERRIDDEN_STATE
void draw_menu_back(uiStyle *style, Block *block, const rcti *rect)
void fontstyle_draw(const uiFontStyle *fs, const rcti *rect, const char *str, size_t str_len, const uchar col[4], const FontStyleDrawParams *fs_params)
static void widget_draw_textbox(const uiFontStyle *fstyle, const uiWidgetColors *wcol, Button *but, const rcti *button_rect)
static void shape_preset_trias_from_rect_checkmark(WidgetTrias *tria, const rcti *rect)
void draw_icon_tri(float x, float y, char dir, const float[4], float aspect=1.0f)
static void widget_state_pie_menu_item(WidgetType *wt, const WidgetStateInfo *state, EmbossType)
static void color_blend_v4_v4v4(uchar r_col[4], const uchar col1[4], const uchar col2[4], const float fac)
static const float g_shape_preset_scroll_circle_vert[16][2]
void scene_linear_to_perceptual_space(Button *but, float rgb[3])
void draw_widget_scroll(uiWidgetColors *wcol, const rcti *rect, const rcti *slider, int state)
static void widget_progress_indicator(Button *but, uiWidgetColors *wcol, rcti *rect, const WidgetStateInfo *, int roundboxalign, const float zoom)
void draw_but_COLORBAND(Button *but, const uiWidgetColors *wcol, const rcti *rect)
static void widget_draw_text(const uiFontStyle *fstyle, const uiWidgetColors *wcol, Button *but, rcti *rect)
void widgetbase_draw_cache_flush()
static int but_draw_menu_icon(const Button *but)
std::optional< StringRef > button_edit_unit_hint_get(const Button &but)
static const float g_shape_preset_checkmark_vert[6][2]
static void widget_nodesocket(Button *but, uiWidgetColors *, rcti *rect, const WidgetStateInfo *, int, const float zoom)
static void widget_menu_itembut(uiWidgetColors *wcol, rcti *rect, const WidgetStateInfo *, int, const float zoom)
static void text_clip_right_ex(const uiFontStyle *fstyle, char *str, const size_t str_maxncpy, const float okwidth, const char *sep, const int sep_len, const float sep_strwidth, size_t *r_final_len)
void button_v3_get(Button *but, float vec[3])
static void widget_numbut_embossn(const Button *but, uiWidgetColors *wcol, rcti *rect, const WidgetStateInfo *state, int roundboxalign, const float zoom)
void draw_roundbox_corner_set(int type)
void draw_but_UNITVEC(Button *but, const uiWidgetColors *wcol, const rcti *rect, const float radius)
void icon_draw_preview(float x, float y, int icon_id, float aspect, float alpha, int size)
static void widget_draw_icon_centered(const BIFIconID icon, const float aspect, const float alpha, const rcti *rect, const uchar mono_color[4])
static void widget_verts_to_triangle_strip(WidgetBase *wtb, const int totvert, float triangle_strip[WIDGET_SIZE_MAX *2+2][2])
static void widget_softshadow(const rcti *rect, int roundboxalign, const float radin)
static void widgetbase_set_uniform_alpha_discard(WidgetBase *wtb, const bool alpha_check, const float discard_factor)
void draw_but_TRACKPREVIEW(ARegion *region, Button *but, const uiWidgetColors *, const rcti *recti)
static float widget_radius_from_rcti(const rcti *rect, const uiWidgetColors *wcol)
static void widget_menu_pie_itembut(Button *but, uiWidgetColors *wcol, rcti *rect, const WidgetStateInfo *, int, const float zoom)
static void shape_preset_init_trias_ex(WidgetTrias *tria, const rcti *rect, float triasize, char where, const float verts[][2], const int verts_tot, const uint tris[][3], const int tris_tot)
static void shape_preset_init_hold_action(WidgetTrias *tria, const rcti *rect, float triasize, char where)
static void color_blend_v3_v3(uchar cp[3], const uchar cpstate[3], const float fac)
static void widget_menuiconbut(uiWidgetColors *wcol, rcti *rect, const WidgetStateInfo *, int roundboxalign, const float zoom)
static void widget_menubut(uiWidgetColors *wcol, rcti *rect, const WidgetStateInfo *state, int roundboxalign, const float zoom)
const uiWidgetColors * tooltip_get_theme()
static void widgetbase_set_uniform_alpha_check(WidgetBase *wtb, const bool alpha_check)
double button_value_get(Button *but)
static const float cornervec[WIDGET_CURVE_RESOLU][2]
void label_markdown_draw(const ButtonLabel *button, const uchar color[4], const rcti *rect)
static void widget_type_color_disabled(WidgetType *wt, const WidgetStateInfo *state)
static const uint g_shape_preset_number_arrow_face[1][3]
void draw_pie_center(Block *block)
void draw_roundbox_4fv_ex(const rctf *rect, const float inner1[4], const float inner2[4], float shade_dir, const float outline[4], float outline_width, float rad)
int button_menu_direction(Button *but)
bool block_is_pie_menu(const Block *block) ATTR_WARN_UNUSED_RESULT
static void widget_active_color(uiWidgetColors *wcol)
static void widgetbase_draw_color(WidgetBase *wtb, const uiWidgetColors *wcol, float color[4], bool show_alpha_checkers)
static void widget_state(WidgetType *wt, const WidgetStateInfo *state, EmbossType emboss)
static uint32_t set_roundbox_vertex(GPUVertBufRaw *vflag_step, int corner_id, int corner_v, int jit_v, bool inner, bool emboss, int color)
bool button_label_is_multiline(const Button *button)
static void widget_progress_type_ring(ButtonProgress *but_progress, uiWidgetColors *wcol, rcti *rect)
static void widget_draw_multiline_text(const uiFontStyle *fstyle, const uiWidgetColors *wcol, Button *but, rcti *rect)
int fontstyle_height_max(const uiFontStyle *fs)
bool button_drag_is_draggable(const Button *but)
static void draw_anti_tria(float x1, float y1, float x2, float y2, float x3, float y3, const float color[4])
void hsvcircle_pos_from_vals(const ColorPicker *cpicker, const rcti *rect, const float *hsv, float *r_xpos, float *r_ypos)
void color_picker_hsv_to_rgb(const float r_cp[3], float rgb[3])
void button_drawflag_disable(Button *but, int flag)
static void shape_preset_trias_from_rect_menu(WidgetTrias *tria, const rcti *rect)
static void draw_separator(const uiWidgetColors *wcol, Button *but, const rcti *rect)
bool button_is_color_gamma(Button &but)
static const uint g_shape_preset_hold_action_face[2][3]
static void widget_draw_vertex_buffer(uint pos, uint col, GPUPrimType mode, const float quads_pos[WIDGET_SIZE_MAX][2], const uchar quads_col[WIDGET_SIZE_MAX][4], uint totvert)
static void text_clip_middle(const uiFontStyle *fstyle, Button *but, const rcti *rect)
static void widgetbase_draw(WidgetBase *wtb, const uiWidgetColors *wcol)
bool button_is_popover_once_compat(const Button *but) ATTR_WARN_UNUSED_RESULT
static void widget_pulldownbut(uiWidgetColors *wcol, rcti *rect, const WidgetStateInfo *state, int roundboxalign, const float zoom)
static void widget_optionbut(uiWidgetColors *wcol, rcti *rect, const WidgetStateInfo *state, int, const float)
int button_text_padding(const Button *button)
static void widget_draw_extra_icons(const uiWidgetColors *wcol, Button *but, rcti *rect, float alpha)
void window_to_block_fl(const ARegion *region, const Block *block, float *x, float *y)
static void shadecolors4(const uchar *color, short shadetop, short shadedown, uchar r_coltop[4], uchar r_coldown[4])
float textbox_grip_height()
void draw_text_underline(int pos_x, int pos_y, int len, int height, const float color[4])
static void widget_unitvec(Button *but, uiWidgetColors *wcol, rcti *rect, const WidgetStateInfo *, int, const float zoom)
static void shape_preset_trias_from_rect_dash(WidgetTrias *tria, const rcti *rect)
static const uchar * widget_color_blend_from_flags(const uiWidgetStateColors *wcol_state, const WidgetStateInfo *state, const EmbossType emboss)
static void widget_list_itembut(Button *but, uiWidgetColors *wcol, rcti *rect, const WidgetStateInfo *state, int, const float zoom)
static void draw_widget_back_color(WidgetStyle type, bool use_shadow, const rcti *rect, const float color[4])
static void draw_disk_shaded(float start, float angle, float radius_int, float radius_ext, int subd, const uchar col1[4], const uchar col2[4], bool shaded)
const float ui_pixel_jitter[UI_PIXEL_AA_JITTER][2]
gpu::Batch * batch_roundbox_shadow_get()
void draw_but_HISTOGRAM(ARegion *region, Button *but, const uiWidgetColors *, const rcti *recti)
static struct blender::ui::@267216362346346046265002004211257064216053106206 g_widget_base_batch
bool button_draw_as_link(const Button *button)
float textbox_vertical_padding()
static void shape_preset_init_number_arrows(WidgetTrias *tria, const rcti *rect, float triasize, char where)
void draw_preview_item_stateless(const uiFontStyle *fstyle, rcti *rect, StringRef name, int iconid, const uchar text_col[4], FontStyleAlign text_align, const bool add_padding)
static const float g_shape_preset_number_arrow_vert[3][2]
static void widget_draw_submenu_tria(const Button *but, const rcti *rect, const uiWidgetColors *wcol)
static WidgetType * widget_type(WidgetStyle type)
void color_picker_rgb_to_hsv_compat(const float rgb[3], float r_cp[3])
static void draw_gradient_hsv_to_rgb(const ColorManagedDisplay *display, float h, float s, float v, float rgb[3])
static void widget_state_numslider(WidgetType *wt, const WidgetStateInfo *state, EmbossType emboss)
void draw_roundbox_4fv(const rctf *rect, bool filled, float rad, const float col[4])
Vector< StringRef > text_clip_multiline_middle(const uiFontStyle *fstyle, const char *str, char *clipped_str_buf, const size_t clipped_str_buf_maxncpy, const float max_line_width, const int max_lines)
static void shape_preset_init_scroll_circle(WidgetTrias *tria, const rcti *rect, float triasize, char where)
static void draw_widgetbase_batch(WidgetBase *wtb)
static bool draw_emboss(const Button *but)
void draw_menu_item(const uiFontStyle *fstyle, rcti *rect, rcti *back_rect, float zoom, bool use_unpadded, const char *name, int iconid, int64_t but_flag, MenuItemSeparatorType separator_type, int *r_xmax)
bool but_is_tool(const Button *but)
void draw_gradient(const rcti *rect, const float hsv[3], eButGradientType type, float alpha, const ColorManagedDisplay *display)
static const float g_shape_preset_hold_action_vert[6][2]
static void text_clip_right_label(const uiFontStyle *fstyle, Button *but, const rcti *rect)
void draw_but_CURVE(ARegion *region, Button *but, const uiWidgetColors *wcol, const rcti *rect)
static void widget_roundbut_exec(Button *but, uiWidgetColors *wcol, rcti *rect, const WidgetStateInfo *state, int roundboxalign, const float zoom)
static void widget_color_disabled(uiWidgetColors &wcol, const WidgetStateInfo *state)
void draw_button(const bContext *C, ARegion *region, uiStyle *style, Button *but, rcti *rect)
MINLINE float min_ff(float a, float b)
int RNA_property_array_length(PointerRNA *ptr, PropertyRNA *prop)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
void BLF_boundbox(int fontid, const char *str, size_t str_len, rcti *r_box, ResultBLF *r_info=nullptr) ATTR_NONNULL(2)
size_t BLI_snprintf(char *__restrict dst, size_t dst_maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
MINLINE void rgba_uchar_to_float(float r_col[4], const unsigned char col_ub[4])
char * STRNCPY(char(&dst)[N], const char *src)
void immAttr4f(uint attr_id, float x, float y, float z, float w)
gpu::Batch * GPU_batch_create_ex(GPUPrimType primitive_type, gpu::VertBuf *vertex_buf, gpu::IndexBuf *index_buf, GPUBatchFlag owns_flag)
uint padding(uint offset, uint alignment)
MINLINE unsigned char unit_float_to_uchar_clamp(float val)
void GPU_indexbuf_init(GPUIndexBufBuilder *, GPUPrimType, uint prim_len, uint vertex_len)
void BLF_position(int fontid, float x, float y, float z)
void BLI_rcti_resize_y(struct rcti *rect, int y)
ptrdiff_t BLI_str_utf8_invalid_byte(const char *str, size_t str_len) ATTR_NONNULL(1)
float BLF_width(int fontid, const char *str, size_t str_len, ResultBLF *r_info=nullptr) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(2)
void immUniformColor3f(float r, float g, float b)
void BLF_batch_draw_flush()
MINLINE void copy_v3_v3(float r[3], const float a[3])
void hsv_to_rgb(float h, float s, float v, float *r_r, float *r_g, float *r_b)
void immAttr4ubv(uint attr_id, const unsigned char data[4])
MINLINE int round_fl_to_int(float a)
@ USER_ALWAYS_SHOW_NUMBER_ARROWS
MINLINE unsigned char srgb_to_grayscale_byte(const unsigned char rgb[3])
void immUniformColor4ub(unsigned char r, unsigned char g, unsigned char b, unsigned char a)
bool BLI_rcti_isect(const struct rcti *src1, const struct rcti *src2, struct rcti *dest)
@ SOCK_DISPLAY_SHAPE_CIRCLE
MINLINE void copy_v2_v2(float r[2], const float a[2])
size_t BLF_width_to_strlen(int fontid, const char *str, size_t str_len, float width, float *r_width) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(2)
GPUVertFormat * immVertexFormat()
void rgb_to_hsl_v(const float rgb[3], float r_hsl[3])
float RNA_property_float_get_index(PointerRNA *ptr, PropertyRNA *prop, int index)
void rgb_to_hsv_v(const float rgb[3], float r_hsv[3])
void immBegin(GPUPrimType, uint vertex_len)
void rgb_to_hsv_compat_v(const float rgb[3], float r_hsv[3])
void GPU_line_smooth(bool enable)
void BLI_rcti_resize_x(struct rcti *rect, int x)
MINLINE int max_ii(int a, int b)
ATTR_WARN_UNUSED_RESULT const BMVert * v
void immUniformColor4fv(const float rgba[4])
void BLI_rctf_scale(rctf *rect, float scale)
MINLINE void rgb_float_to_uchar(unsigned char r_col[3], const float col_f[3])
MINLINE float cube_f(float a)
MINLINE float srgb_to_grayscale(const float rgb[3])
void BLF_disable(int fontid, FontFlags flag)
GPU_INLINE void * GPU_vertbuf_raw_step(GPUVertBufRaw *a)
MINLINE float pow3f(float x)
void BLI_rctf_rcti_copy(struct rctf *dst, const struct rcti *src)
void immUniformColor3ubv(const unsigned char rgb[3])
void GPU_line_width(float width)
VecBase< float, 4 > float4
void immAttr3fv(uint attr_id, const float data[3])
void immBindBuiltinProgram(GPUBuiltinShader shader_id)
void imm_draw_circle_wire_2d(uint shdr_pos, float x, float y, float radius, int nsegments)
void immUniformThemeColor(int color_id)
BLI_INLINE int BLI_rcti_size_y(const struct rcti *rct)
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
gpu::IndexBuf * GPU_indexbuf_build(GPUIndexBufBuilder *)
void immUniform1f(const char *name, float x)
bool BLF_str_offset_to_glyph_bounds(int fontid, const char *str, size_t str_offset, rcti *r_glyph_bounds) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(2
void immVertex2f(uint attr_id, float x, float y)
BLI_INLINE int BLI_rcti_cent_y(const struct rcti *rct)
void immAttr4fv(uint attr_id, const float data[4])
BMesh const char void * data
@ GPU_SHADER_2D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_OUTLINE_AA
@ GPU_SHADER_3D_SMOOTH_COLOR
@ GPU_SHADER_2D_WIDGET_BASE_INST
@ GPU_SHADER_3D_UNIFORM_COLOR
@ GPU_SHADER_2D_WIDGET_BASE
void GPU_scissor_get(int coords[4])
BLI_INLINE float BLI_rctf_size_y(const struct rctf *rct)
void GPU_batch_draw_instance_range(gpu::Batch *batch, int instance_first, int instance_count)
void BLI_rcti_translate(struct rcti *rect, int x, int y)
int RNA_property_flag(PropertyRNA *prop)
const char const char * BLI_str_find_next_char_utf8(const char *p, const char *str_end) ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL ATTR_NONNULL(1
constexpr size_t ARRAY_SIZE(const T(&arg)[N]) noexcept
size_t BLF_width_to_rstrlen(int fontid, const char *str, size_t str_len, float width, float *r_width) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(2)
void GPU_batch_draw(gpu::Batch *batch)
void immUniformColor3ub(unsigned char r, unsigned char g, unsigned char b)
void GPU_program_point_size(bool enable)
void gpu_batch_presets_register(gpu::Batch *preset_batch)
int BLI_str_utf8_size_safe(const char *p) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Vector< StringRef > BLF_string_wrap(int fontid, StringRef str, const int max_pixel_width, BLFWrapMode mode=BLFWrapMode::Minimal)
MINLINE void add_v3_uchar_clamped(uchar r[3], int i)
bool BLI_rcti_is_empty(const struct rcti *rect)
void GPU_indexbuf_add_tri_verts(GPUIndexBufBuilder *, uint v1, uint v2, uint v3)
MINLINE void copy_v4_v4_uchar(unsigned char r[4], const unsigned char a[4])
void GPU_matrix_translate_2f(float x, float y)
void GPU_vertbuf_attr_get_raw_data(gpu::VertBuf *, uint a_idx, GPUVertBufRaw *access)
void BLF_draw(int fontid, const char *str, size_t str_len, ResultBLF *r_info=nullptr) ATTR_NONNULL(2)
uint GPU_vertformat_attr_add(GPUVertFormat *format, StringRef name, gpu::VertAttrType type)
BLI_INLINE int BLI_rcti_size_x(const struct rcti *rct)
int BLF_ascender(int fontid) ATTR_WARN_UNUSED_RESULT
void GPU_batch_program_set_builtin(gpu::Batch *batch, GPUBuiltinShader shader_id)
void BLF_color4ubv(int fontid, const unsigned char rgba[4])
void hsl_to_rgb_v(const float hsl[3], float r_rgb[3])
BLI_INLINE float BLI_rcti_cent_x_fl(const struct rcti *rct)
MINLINE float len_squared_v2(const float v[2]) ATTR_WARN_UNUSED_RESULT
void GPU_scissor(int x, int y, int width, int height)
void IMB_colormanagement_scene_linear_to_display_v3(float pixel[3], const ColorManagedDisplay *display, ColorManagedDisplaySpace display_space=DISPLAY_SPACE_DRAW)
const char * BLI_str_find_prev_char_utf8(const char *p, const char *str_start) ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL ATTR_NONNULL(1
void immUniform4f(const char *name, float x, float y, float z, float w)
void IMB_colormanagement_color_picking_to_scene_linear_v3(float scene_linear[3], const float color_picking[3])
void imm_draw_box_wire_2d(uint pos, float x1, float y1, float x2, float y2)
BLI_INLINE float BLI_rctf_size_x(const struct rctf *rct)
void interp_v3_v3v3_uchar(unsigned char target[3], const unsigned char a[3], const unsigned char b[3], float t)
MINLINE float max_ff(float a, float b)
MINLINE void copy_v3_v3_uchar(unsigned char r[3], const unsigned char a[3])
void GPU_vertbuf_data_alloc(gpu::VertBuf &verts, uint v_len)
int BLF_descender(int fontid) ATTR_WARN_UNUSED_RESULT
bool int BLF_str_offset_to_cursor(int fontid, const char *str, size_t str_len, size_t str_offset, int cursor_width)
@ PROP_PATH_SUPPORTS_TEMPLATES
MINLINE void rgb_uchar_to_float(float r_col[3], const unsigned char col_ub[3])
MINLINE void copy_v4_v4(float r[4], const float a[4])
ColorTheme4< float > ColorTheme4f
void immUniformColor3fv(const float rgb[3])
void GPU_blend(GPUBlend blend)
void BLI_rcti_pad(struct rcti *rect, int pad_x, int pad_y)
void BLI_rcti_resize(struct rcti *rect, int x, int y)
BLI_INLINE int BLI_rcti_cent_x(const struct rcti *rct)
void imm_draw_disk_partial_fill_2d(uint pos, float x, float y, float rad_inner, float rad_outer, int nsegments, float start, float sweep)
void immUniformColor4ubv(const unsigned char rgba[4])
void immVertex2fv(uint attr_id, const float data[2])
void immUniformColor3ubvAlpha(const unsigned char rgb[3], unsigned char a)
void BLF_rotation(int fontid, float angle)
MINLINE int min_ii(int a, int b)
void immRectf(uint pos, float x1, float y1, float x2, float y2)
BLI_INLINE float BLI_rcti_cent_y_fl(const struct rcti *rct)
void BLI_rctf_pad(struct rctf *rect, float pad_x, float pad_y)
void BLF_enable(int fontid, FontFlags flag)
MINLINE void rgba_float_to_uchar(unsigned char r_col[4], const float col_f[4])
Vector< Bounds< int > > BLF_str_selection_boxes(int fontid, const char *str, size_t str_len, size_t sel_start, size_t sel_length)
ocio::Display ColorManagedDisplay
void BLI_rctf_init(struct rctf *rect, float xmin, float xmax, float ymin, float ymax)
MINLINE float clamp_f(float value, float min, float max)
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
uiWidgetColors wcol_pulldown
uiWidgetColors wcol_numslider
uiWidgetColors wcol_list_item
uiWidgetColors wcol_progress
uiWidgetColors wcol_menu_back
float icon_border_intensity
uiWidgetColors wcol_curve
uiWidgetColors wcol_menu_item
uiWidgetColors wcol_toggle
uiWidgetColors wcol_regular
uiWidgetColors wcol_tooltip
uiWidgetColors wcol_option
uiWidgetStateColors wcol_state
uiWidgetColors wcol_radio
uiWidgetColors wcol_scroll
uiWidgetColors wcol_pie_menu
uiWidgetColors wcol_toolbar_item
std::function< void(const bContext *, rcti *)> drawextra
BlockAlertLevel alert_level
Button * next_but(const Button *but) const
std::unique_ptr< PieMenuData > pie_data
int visible_lines() const
std::unique_ptr< TextWrapCache > wrap_cache
gpu::Batch * roundbox_widget
gpu::Batch * roundbox_shadow