79#include "RNA_prototypes.hh"
101#define USE_CONT_MOUSE_CORRECT
103#define USE_DRAG_TOGGLE
106#define USE_DRAG_MULTINUM
115#define USE_KEYNAV_LIMIT
118#define USE_DRAG_POPUP
136#define UI_PROP_SCALE_LOG_MIN 0.5e-8f
142#define UI_PROP_SCALE_LOG_SNAP_OFFSET 0.03f
155#define UI_DRAG_MAP_SOFT_RANGE_PIXEL_MAX 1000
163struct BlockInteraction_Handle;
166static int do_but_EXIT(bContext *
C, Button *but, HandleButtonData *
data,
const wmEvent *event);
173 HandleButtonData *
data,
174 const bool is_click);
177 const bool is_click);
179 BlockInteraction_CallbackData *callbacks,
180 BlockInteraction_Handle *interaction);
182 BlockInteraction_CallbackData *callbacks,
183 BlockInteraction_Handle *interaction);
185#ifdef USE_KEYNAV_LIMIT
193 FunctionRef<
void()> fn);
202#define BUTTON_FLASH_DELAY 0.020
203#define MENU_SCROLL_INTERVAL 0.1
204#define PIE_MENU_INTERVAL 0.01
205#define BUTTON_AUTO_OPEN_THRESH 0.2
206#define BUTTON_MOUSE_TOWARDS_THRESH 1.0
208#define BUTTON_KEYNAV_PX_LIMIT 8
211#define MENU_TOWARDS_MARGIN 20
213#define MENU_TOWARDS_WIGGLE_ROOM 64
275# define USE_ALLSELECT_LAYER_HACK
303 const double value_orig);
311# define IS_ALLSELECT_EVENT(event) (((event)->modifier & KM_ALT) != 0)
314# define BUT_IS_SELECT_CONTEXT BUT_NODE_ACTIVE
318#ifdef USE_DRAG_MULTINUM
323# define DRAG_MULTINUM_THRESHOLD_DRAG_X (UI_UNIT_Y / 4)
330# define DRAG_MULTINUM_THRESHOLD_DRAG_Y (UI_UNIT_Y / 4)
340# define DRAG_MULTINUM_THRESHOLD_VERTICAL (0.75f)
489#ifdef USE_CONT_MOUSE_CORRECT
502#ifdef USE_KEYNAV_LIMIT
506#ifdef USE_DRAG_MULTINUM
590#ifdef USE_DRAG_MULTINUM
628 static int lastdy = 0;
636 if ((dy > 0 && lastdy < 0) || (dy < 0 && lastdy > 0)) {
668 Button *but_found =
nullptr;
675 while (i < block->buttons_ptrs.size() &&
680 if (direction == 1) {
692 return shift ? 0.05f : 1.0f;
705 *r_mx = (
data->dragstartx * (1.0f - fac) + mx * fac);
706 *r_my = (
data->dragstarty * (1.0f - fac) + my * fac);
715#ifdef USE_DRAG_MULTINUM
718 const bool initializing =
ELEM(
723 return (initializing && vertical_dragging);
734 if (
data->draglock) {
735 const int threshold = drag_threshold_fn();
736 if (
abs(mx -
data->dragstartx) < threshold) {
739#ifdef USE_DRAG_MULTINUM
745 data->draglock =
false;
746 data->dragstartx = mx;
768 if (base ==
nullptr) {
772 bool is_userdef =
false;
774 RNA_AddonPreferences,
775 RNA_KeyConfigPreferences,
777 RNA_UserAssetLibrary))
797 else if (ptr->
owner_id ==
nullptr) {
818 U.runtime.is_dirty =
true;
861 *r_hue =
roundf((*r_hue) * snap_increment) / snap_increment;
874 AfterFunc *after = MEM_new<AfterFunc>(__func__);
897 const Button *context_but)
904 after->
opptr = *properties;
905 *properties =
nullptr;
908 if (context_but && context_but->
context) {
940 (text_button && (text_button->rename_func || text_button->rename_full_func)) ||
978 auto *text_button =
static_cast<ButtonText *
>(but);
980 after->
rename_func = std::move(text_button->rename_func);
985 text_button->rename_full_new =
"";
1003 but->
opptr =
nullptr;
1014 if (but->
active !=
nullptr) {
1016 if (
data->custom_interaction_handle !=
nullptr) {
1058 std::optional<StringRef>
str;
1059 size_t str_len_clip =
SIZE_MAX - 1;
1068 else if (!but->
drawstr.empty()) {
1078 if (!
str ||
str->is_empty() || str_len_clip == 0) {
1079 str =
"Unknown Action";
1080 str_len_clip =
str->size();
1090 if (
ELEM(but->
rnaprop, &rna_ID_name, &rna_Object_active_shape_key_index)) {
1100 if (undo_hints_or_none.has_value()) {
1106 undo_hints_or_none = std::nullopt;
1110 if (!undo_hints_or_none.has_value()) {
1139 if (!
str.has_value()) {
1152 for (
AfterFunc &afterf : funcs.items_mutable()) {
1155 MEM_delete(&afterf);
1164 ARegion *region_popup_prev =
nullptr;
1182 opptr = *after.
opptr;
1183 MEM_delete(after.
opptr);
1190 (after.
opptr) ? &opptr :
nullptr,
1210 if (region_popup_prev &&
1213 region_popup_prev =
nullptr;
1280 data->applied =
true;
1289 data->applied =
true;
1301 data->applied =
true;
1312 value_toggle = (value == 0.0);
1323 data->applied =
true;
1341 data->applied =
true;
1346 if (
data->apply_through_extra_icon) {
1356 if (!
data->text_edit.edit_string) {
1377 data->text_edit.original_string =
nullptr;
1397 data->applied =
true;
1402 if (
data->text_edit.edit_string) {
1412 data->applied =
true;
1417 if (
data->text_edit.edit_string) {
1430 data->cancel =
true;
1439 data->cancel =
true;
1451 data->applied =
true;
1461 data->applied =
true;
1468 data->applied =
true;
1475 data->applied =
true;
1482 data->applied =
true;
1491#ifdef USE_DRAG_MULTINUM
1500 mbut_state->
but = but;
1502# ifdef USE_ALLSELECT
1516 if (mbut_state->
but == but) {
1532# ifdef USE_ALLSELECT
1547# ifdef USE_ALLSELECT
1548 if (
data->multi_data.mbuts) {
1553 MEM_delete(mbut_state);
1562 data->multi_data.mbuts =
nullptr;
1564 if (
data->multi_data.bs_mbuts) {
1566 data->multi_data.bs_mbuts =
nullptr;
1573 bool changed =
false;
1575 seg[0][0] =
data->multi_data.drag_start[0];
1576 seg[0][1] =
data->multi_data.drag_start[1];
1578 seg[1][0] =
event->xy[0];
1579 seg[1][1] =
event->xy[1];
1586 data->multi_data.has_mbuts =
false;
1590 bool drag_prev =
false;
1591 bool drag_curr =
false;
1602 if (but_active != &but) {
1611 data->multi_data.has_mbuts =
true;
1618 changed |= (drag_prev != drag_curr);
1643 if (
data->origvalue != 0.0) {
1644 data->multi_data.is_proportional =
true;
1652 const double value_delta =
data->value -
data->origvalue;
1653 const double value_scale =
data->multi_data.is_proportional ? (
data->value /
data->origvalue) :
1666 if (mbut_state ==
nullptr) {
1677# ifdef USE_ALLSELECT
1678 if (
data->select_others.is_enabled) {
1689 but.active->origvalue = mbut_state->
origvalue;
1691 but.active->select_others.
do_free =
false;
1696 if (
data->text_edit.edit_string) {
1698 but.active->value =
data->value;
1703 if (
data->multi_data.is_proportional) {
1704 but.active->value = mbut_state->
origvalue * value_scale;
1707 but.active->value = mbut_state->
origvalue + value_delta;
1711 CLAMP(but.active->value,
double(but.softmin),
double(but.softmax));
1726#ifdef USE_DRAG_TOGGLE
1775 const bool pushed_state,
1776 const int xy_src[2],
1777 const int xy_dst[2],
1778 const bool drag_lock[2])
1782 bool changed =
false;
1785 float xy_a_block[2] = {
float(xy_src[0]),
float(xy_src[1])};
1786 float xy_b_block[2] = {
float(xy_dst[0]),
float(xy_dst[1])};
1810 if (pushed_state_but == pushed_state) {
1819 if (
U.runtime.is_dirty ==
false) {
1837 bool do_draw =
false;
1851 const float but_cent_new[2] = {
1878 xy[0] = (drag_info->
xy_lock[0] ==
false) ? xy_input[0] : drag_info->
xy_last[0];
1879 xy[1] = (drag_info->
xy_lock[1] ==
false) ? xy_input[1] : drag_info->
xy_last[1];
1895 MEM_delete(drag_info);
1903 switch (event->
type) {
1923 region, drag_info->
xy_init,
true,
false,
nullptr,
nullptr);
1957 bool success =
false;
1972 bool use_path_from_id;
1978 std::optional<std::string> path;
1986 for (i = 0, link = lb.
data(); i < selctx_data->elems.size(); i++, link++) {
1990 path.has_value() ? path->c_str() :
nullptr,
1995 selctx_data->
elems.pop_last();
2034 success = !selctx_data->
elems.is_empty();
2051 selctx_data->
elems.clear();
2061 const double value_orig)
2063 if (!selctx_data->
elems.is_empty()) {
2067 const bool use_delta = (selctx_data->
is_copy ==
false);
2069 std::variant<bool, int, float, std::string, PointerRNA> delta,
min,
max;
2075 delta.emplace<
float>(use_delta ? (value - value_orig) : value);
2078 min.emplace<
float>(min_v);
2079 max.emplace<
float>(max_v);
2082 delta.emplace<
int>(int(use_delta ? (value - value_orig) : value));
2085 min.emplace<
int>(min_v);
2086 max.emplace<
int>(max_v);
2111# ifdef USE_ALLSELECT_LAYER_HACK
2125 tmparray[
index] =
true;
2133 MEM_delete(tmparray);
2145 float other_value = std::get<float>(delta) + (use_delta ? other.val_f : 0.0f);
2146 CLAMP(other_value, std::get<float>(
min), std::get<float>(
max));
2155 int other_value = std::get<int>(delta) + (use_delta ? other.val_i : 0);
2156 CLAMP(other_value, std::get<int>(
min), std::get<int>(
max));
2165 const bool other_value = std::get<bool>(delta);
2174 const int other_value = std::get<int>(delta);
2179 const PointerRNA &other_value = std::get<PointerRNA>(delta);
2183 const std::string &other_value = std::get<std::string>(delta);
2213 const int drag_threshold =
min_ii(
2217 if (
abs(
data->dragstartx - event->
xy[0]) +
abs(
data->dragstarty - event->
xy[1]) > drag_threshold)
2220 data->cancel =
true;
2221#ifdef USE_DRAG_TOGGLE
2244 &
data->window->runtime->modalhandlers,
2270 if (lock_axis != -1) {
2271 drag_info->
xy_lock[lock_axis] =
true;
2307 MEM_delete(drag_info);
2313 if (view_item_but->view_item) {
2336 data->applied =
true;
2343 data->applied =
true;
2350 data->applied =
true;
2357 data->applied =
true;
2370 if (!
data->applied) {
2374 if (
data->text_edit.edit_string) {
2375 MEM_delete(
data->text_edit.edit_string);
2377 data->text_edit.edit_string =
data->text_edit.original_string;
2378 data->text_edit.original_string =
nullptr;
2387 data->applied_interactive =
true;
2389 else if (
data->applied_interactive) {
2394# ifdef USE_DRAG_MULTINUM
2400 if (
data->select_others.elems.is_empty())
2407 const bool is_array_paste = (
event->val ==
KM_PRESS) &&
2410 if (!is_array_paste) {
2412 data->select_others.is_enabled =
true;
2416 if (
data->select_others.elems.is_empty()) {
2418 data->select_others.elems.clear();
2425 double *editval = but->
editval;
2426 float *editvec = but->
editvec;
2545#ifdef USE_DRAG_MULTINUM
2546 if (
data->multi_data.has_mbuts) {
2548 (
data->multi_data.skip ==
false))
2565 data->origvalue = 0.0;
2585 if (
data->custom_interaction_handle !=
nullptr) {
2600 bool paste_all_lines)
2608 *r_buf_paste = text;
2642 const int values_len,
2646 const int values_end = values_len - 1;
2649 for (
int i = 0; i < values_len; i++) {
2651 output + ofs, output_maxncpy - ofs, (i != values_end) ?
"%f, " :
"%f]", values[i]);
2666 BLI_assert(0 <= values_len_expected && values_len_expected <= 4);
2669 const int values_len_actual = sscanf(
2670 text,
"[%f, %f, %f, %f, %f]", &
v[0], &
v[1], &
v[2], &
v[3], &
v[4]);
2672 if (values_len_actual == values_len_expected) {
2673 memcpy(values,
v,
sizeof(
float) * values_len_expected);
2685 if (values_len > 4) {
2716 data->value = value;
2766 float rgba[4] = {0.0, 0.0, 0.0, 1.0};
2767 bool is_parsed =
false;
2772 else if (
hex_to_rgba(buf_paste, &rgba[0], &rgba[1], &rgba[2], &rgba[3])) {
2808 if (but->
poin !=
nullptr) {
2824 if (but->
poin !=
nullptr) {
2841 if (source_channels == dest_channels) {
2857 if (but->
poin !=
nullptr) {
2893 if (prop ==
nullptr) {
2932 if (prop ==
nullptr) {
2943 C, &but->
rnapoin, prop, std::string(value).c_str(), &item_index);
2946 RPT_ERROR,
"Paste of \"%s\": cannot assign value to property", std::string(value).c_str());
2971 char buf[4096] = {0};
2972 const int buf_maxncpy =
sizeof(buf);
2975 bool is_buf_set =
false;
2977 const bool has_required_data = but->
poin || but->
rnapoin;
2979 switch (but->
type) {
2982 if (!has_required_data) {
2995 if (!has_required_data) {
3003 if (!has_required_data) {
3013 if (!has_required_data) {
3073 int buf_paste_len = 0;
3078 const bool has_required_data = but->
poin || but->
rnapoin;
3080 switch (but->
type) {
3083 if (!has_required_data) {
3095 if (!has_required_data) {
3102 if (!has_required_data) {
3111 if (!has_required_data) {
3144 MEM_delete(buf_paste);
3171 const char *strpos = butstr;
3172 const char *str_end = butstr + strlen(butstr);
3173 for (
int i = 0; i < pos; i++) {
3177 return (strpos - butstr);
3196 memcpy(butstr, password_str.data(), password_str.length() + 1);
3199 if (but->
pos >= 0) {
3210 if (but->
pos >= 0) {
3217 password_str = butstr;
3218 memset(butstr,
'*',
len);
3290 const int len = strlen(
str);
3291 bool changed =
false;
3325 float starty_dummy = 0.0f;
3326 std::string password_str;
3339 if (right_aligned) {
3340 startx +=
U.pixelsize;
3345 endx -=
U.pixelsize;
3348 else if (right_aligned) {
3349 endx -=
U.pixelsize;
3352 startx +=
U.pixelsize;
3366 if (right_aligned) {
3368 const float align_x_ofs = endx - startx - width;
3369 startx +=
max_ff(0.0f, align_x_ofs);
3373 if (xy.x < startx) {
3376 str_last = &
str[but->
ofs];
3424 bool changed =
false;
3432 size_t step = buf_len;
3452 memcpy(&
str[but->
pos], buf,
step *
sizeof(
char));
3461#ifdef WITH_INPUT_IME
3462static bool textedit_insert_ascii(Button *but, HandleButtonData *
data,
const char ascii)
3465 const char buf[2] = {ascii,
'\0'};
3475 bool jump_all_multiline =
false)
3481 const char *
str = lines.first().begin();
3484 const int pos_prev = but->
pos;
3490 if (has_sel && !
select) {
3493 line_cursor.
begin()) -
3507 int pos_i = but->
pos - (line_cursor.
data() -
str);
3509 line_cursor.
data(), line_cursor.
size(), &pos_i, direction,
jump,
true);
3510 but->
pos = pos_i + (line_cursor.
data() -
str);
3513 if (has_sel ==
false) {
3518 else if (but->
selsta == pos_prev) {
3539 const int len = strlen(
str);
3541 bool changed =
false;
3550 else if (direction) {
3554 else if (but->
pos >= 0 && but->
pos <
len) {
3568 else if (but->
pos > 0) {
3586 char *
str =
data->text_edit.edit_string;
3589 if (
data->searchbox) {
3611 bool changed =
false;
3652#ifdef WITH_INPUT_IME
3654static void textedit_ime_begin(
wmWindow *win, Button *but)
3664 WM_window_IME_end(win);
3675static void textedit_ime_end(wmWindow *win,
Button *but)
3680 WM_window_IME_end(win);
3683void button_ime_reposition(
Button *but,
int x,
int y)
3688 BLI_assert(but->active || but->semi_modal_state);
3693 wmWindow *win =
data->window;
3695 WM_window_IME_reposition(win,
x,
y, 0, 0);
3700 WM_window_IME_end(win);
3705const wmIMEData *button_ime_data_get(
Button *but)
3711 if (
data &&
data->window &&
data->window->runtime->ime_data_is_composing &&
3714 return data->window->runtime->ime_data;
3723 if (
data ==
nullptr ||
data->text_edit_unit_hint.empty()) {
3724 return std::nullopt;
3726 return data->text_edit_unit_hint;
3754 data->text_edit_unit_hint.clear();
3759 std::string name_short;
3764 data->text_edit_unit_hint.clear();
3770 data->text_edit_unit_hint.clear();
3782 else if (subtype_hint) {
3784 name_short = *subtype_hint;
3790 data->text_edit_unit_hint.clear();
3796 data->text_edit_unit_hint.clear();
3801 if (name_short.empty()) {
3802 data->text_edit_unit_hint.clear();
3807 data->text_edit_unit_hint =
" " + name_short;
3817 bool no_zero_strip =
false;
3823#if defined(__APPLE__)
3824 const int ctrl_icon = ICON_KEY_COMMAND;
3826 const int ctrl_icon = ICON_EVENT_CTRL;
3829 status.
item(
IFACE_(
"Confirm"), ICON_EVENT_RETURN);
3831 status.
item(
IFACE_(
"New Line"), ICON_EVENT_SHIFT, ICON_EVENT_RETURN);
3834 status.
item(
IFACE_(
"Cancel"), ICON_EVENT_ESC);
3837 status.
item(
IFACE_(
"Select All"), ctrl_icon, ICON_EVENT_A);
3838 status.
item(
IFACE_(
"Copy"), ctrl_icon, ICON_EVENT_C);
3839 status.
item(
IFACE_(
"Paste"), ctrl_icon, ICON_EVENT_V);
3843 status.
item(
IFACE_(
"Autocomplete"), ICON_EVENT_TAB);
3846#ifdef USE_DRAG_MULTINUM
3848 if (
data->applied_interactive) {
3850 data->cancel =
true;
3852 data->cancel =
false;
3854 data->applied_interactive =
false;
3861 data->select_others.is_enabled =
true;
3862 data->select_others.is_copy =
true;
3936 if (
data->searchbox) {
3959#ifdef WITH_INPUT_IME
3961 textedit_ime_begin(win, but);
3986 if (
data->searchbox) {
3987 if (
data->cancel ==
false) {
4001 data->cancel =
true;
4004 data->escapecancel =
true;
4014 data->searchbox =
nullptr;
4031#ifdef WITH_INPUT_IME
4032 textedit_ime_end(win, but);
4052 data->postbut = &but;
4059 if (&but == actbut) {
4064 data->postbut = &but;
4086 block->
buttons() | std::views::take(block->
but_index(actbut)) | std::views::reverse)
4090 data->postbut = &but;
4096 for (
Button &but : block->
buttons() | std::views::reverse) {
4097 if (&but == actbut) {
4102 data->postbut = &but;
4115#if defined(__APPLE__)
4135 bool changed =
false, inbox =
false, update =
false, skip_undo_push =
false;
4137#ifdef WITH_INPUT_IME
4142 const bool is_ime_composing =
false;
4146 int prev_pos = but->
pos;
4147 switch (event->
type) {
4150 if (
data->searchbox) {
4151#ifdef USE_KEYNAV_LIMIT
4170 if (
data->is_semi_modal) {
4176 if (
data->searchbox) {
4184#ifdef WITH_INPUT_IME
4186 if (is_ime_composing) {
4190 data->cancel =
true;
4191 data->escapecancel =
true;
4206 if (
data->searchbox) {
4210 bool is_press_in_button =
false;
4212 float mx =
event->xy[0];
4213 float my =
event->xy[1];
4217 is_press_in_button =
true;
4224 if (is_press_in_button) {
4239 else if (inbox ==
false && !
data->is_semi_modal) {
4241 if (
data->searchbox) {
4242 data->cancel =
data->escapecancel =
true;
4244#ifdef WITH_INPUT_IME
4245 else if (is_ime_composing && !ime_data->composite.empty() &&
4249 but, text_edit, ime_data->composite.c_str(), ime_data->composite.size());
4259 if (is_press_in_button) {
4260 const int str_len = strlen(text_edit.
edit_string);
4272 text_edit.
sel_pos_init = ((selend == str_len) && (selsta != 0)) ? selend : selsta;
4277 else if (inbox && !
data->is_semi_modal) {
4292 if (event->
val ==
KM_PRESS && !is_ime_composing) {
4293 switch (event->
type) {
4297#if defined(__APPLE__)
4328 if (
data->searchbox) {
4329#ifdef USE_KEYNAV_LIMIT
4355 if (
data->searchbox) {
4356#ifdef USE_KEYNAV_LIMIT
4383 char utf8_buf[2] =
"\n";
4406#if defined(__APPLE__)
4430 data->postbut = but;
4451 const bool is_redo = (
event->modifier &
KM_SHIFT);
4453#
if defined(__APPLE__)
4461 if (undo_str !=
nullptr) {
4465 but->
pos = undo_pos;
4471 skip_undo_push =
true;
4481#ifdef WITH_INPUT_IME
4482 && !is_ime_composing && !WM_event_is_ime_switch(event)
4486 char utf8_buf_override[2] = {
'\0',
'\0'};
4487 const char *utf8_buf =
event->utf8_buf;
4493 utf8_buf_override[0] =
'.';
4494 utf8_buf = utf8_buf_override;
4512#ifdef WITH_INPUT_IME
4521 if (!ime_data->result.empty()) {
4523 STREQ(ime_data->result.c_str(),
"\xE3\x80\x82"))
4526 textedit_insert_ascii(but,
data,
'.');
4537 if (textbox && changed) {
4546 if ((skip_undo_push ==
false) && (text_edit.
undo_stack_text !=
nullptr)) {
4553 if (update &&
data->interactive) {
4561 if (
data->searchbox) {
4568 if (!
data->searchbox) {
4586 switch (event->
type) {
4588 if (!textbox || event->
customdata !=
data->text_select_auto_scroll) {
4592 const wmTimer *timer =
static_cast<const wmTimer *
>(
event->customdata);
4659 data->origvalue =
data->startvalue;
4665#ifdef WITH_INPUT_IME
4666 WM_window_IME_end(
data->window);
4698 float softrange = softmax - softmin;
4711 const float value_step_float_min = 0.1f;
4713 const double value_step = is_float ?
4717 const float softrange_max =
min_ff(
4719 2 * (is_float ?
min_ff(value_step, value_step_float_min) *
4720 (drag_map_softrange_max / value_step_float_min) :
4721 drag_map_softrange_max));
4723 if (softrange > softrange_max) {
4725 softmin =
data->origvalue - (softrange_max / 2);
4726 softmax =
data->origvalue + (softrange_max / 2);
4727 if (!isfinite(softmin)) {
4730 if (!isfinite(softmax)) {
4734 if (softmin < but->softmin) {
4736 softmax = softmin + softrange_max;
4738 else if (softmax > but->
softmax) {
4740 softmin = softmax - softrange_max;
4744 if (softmin == softmax) [[unlikely]] {
4745 if (
data->origvalue > 0.0) {
4746 softmin = nextafterf(softmin, -
FLT_MAX);
4749 softmax = nextafterf(softmax,
FLT_MAX);
4753 softrange = softmax - softmin;
4757 if (softrange == 0.0f) {
4758 data->dragfstart = 0.0f;
4761 switch (scale_type) {
4763 data->dragfstart = (
float(
data->value) - softmin) / softrange;
4768 const float base = softmax / log_min;
4773 const float cubic_min =
cube_f(softmin);
4774 const float cubic_max =
cube_f(softmax);
4775 const float cubic_range = cubic_max - cubic_min;
4776 const float f = (
float(
data->value) - softmin) * cubic_range / softrange + cubic_min;
4777 data->dragfstart = (cbrtf(f) - softmin) / softrange;
4784 data->drag_map_soft_min = softmin;
4785 data->drag_map_soft_max = softmax;
4788 data->dragchange =
false;
4789 data->draglock =
true;
4808 data->dragstartx = 0;
4809 data->draglastx = 0;
4810 data->dragchange =
false;
4811 data->dragcbd =
nullptr;
4817 if (
data->interactive) {
4863 PanelType *popover_panel_type =
nullptr;
4864 void *arg =
nullptr;
4869 status.
item(
" ", ICON_NONE);
4872 switch (but->
type) {
4887 const char *idname =
static_cast<const char *
>(but->
func_argN);
4891 if (popover_panel_type) {
4902 popover_panel_type =
reinterpret_cast<PanelType *
>(but->
poin);
4910 const char *idname =
static_cast<const char *
>(but->
func_argN);
4914 if (popover_panel_type) {
4928 if (func || handlefunc) {
4934 else if (menufunc) {
4950 else if (popoverfunc) {
4960 data->select_others.is_enabled =
true;
4988 data->menu =
nullptr;
4997 return data->menu->direction;
5018 data->cancel =
true;
5043 int x =
event->xy[0],
y =
event->xy[1];
5052 xmax -= 0.2 * icon_size;
5061 if ((
x > (xmax - icon_size)) &&
x <= xmax) {
5112 old_highlighted = &op_icon;
5123 if (old_highlighted != hovered) {
5128#ifdef USE_DRAG_TOGGLE
5137 data->dragstartx =
event->xy[0];
5138 data->dragstarty =
event->xy[1];
5146 data->applied =
false;
5156#ifdef USE_DRAG_TOGGLE
5168 data->changed_cursor =
true;
5173 data->changed_wokspace_status =
true;
5183 data->cancel =
true;
5196 data->cancel =
true;
5237 data->cancel =
true;
5239 data->escapecancel =
true;
5257 data->cancel =
true;
5265 data->cancel =
true;
5266 data->escapecancel =
true;
5294 data->cancel =
true;
5307 const bool is_property = (but->
rnaprop !=
nullptr);
5309#ifdef USE_DRAG_TOGGLE
5330 if (event->
val == event_val) {
5355 const int inc_value)
5369 bool no_zero_strip =
false;
5370 if (str_maxncpy != 0) {
5379 if (but_string[0] ==
'\0') {
5381 MEM_delete(but_string);
5393 MEM_delete(but_string);
5394 if (
num == 0 && digits == 0) {
5455 const int inc_value = (
event->type ==
WHEELUPMOUSE) ? 1 : -1;
5478 switch (
data->state) {
5482 int type =
event->type;
5483 int value =
event->val;
5508 rctf scroll_rect = rect;
5512 rctf grip_rect = rect;
5522 data->changed_cursor =
false;
5529 data->changed_cursor =
true;
5539 data->changed_cursor =
false;
5544 data->changed_cursor =
true;
5558 data->changed_cursor =
false;
5568 data->changed_cursor =
true;
5569 data->dragstarty =
event->xy[1];
5582 int mx =
event->xy[0];
5583 int my =
event->xy[1];
5586 const float range = textbox->
rect.
ymax - ymin;
5588 (range - (my - ymin)) / range *
5606 int visible_lines =
data->origvalue +
5607 ((
data->dragstarty -
event->xy[1]) /
5648#ifdef USE_DRAG_TOGGLE
5658 bool do_activate =
false;
5695 int type =
event->type;
5696 int val =
event->val;
5715 data->cancel =
true;
5751 const bool close_popup =
true)
5777 switch (event->
val) {
5792 data->dragstartx =
event->xy[0];
5793 data->dragstarty =
event->xy[1];
5802 data->cancel =
true;
5831 data->dragstartx =
event->xy[0];
5832 data->dragstarty =
event->xy[1];
5836#ifdef USE_DRAG_TOGGLE
5839 data->dragstartx =
event->xy[0];
5840 data->dragstarty =
event->xy[1];
5887 if (tempf == softmin || tempf == softmax ||
snap ==
SNAP_OFF) {
5892 float softrange = softmax - softmin;
5918 if (softrange >= 21.0f) {
5930 switch (scale_type) {
5934 if (softrange < 2.10f) {
5935 tempf =
roundf(tempf * 10.0f / snap_fac) * 0.1f * snap_fac;
5937 else if (softrange < 21.0f) {
5938 tempf =
roundf(tempf / snap_fac) * snap_fac;
5941 tempf =
roundf(tempf * 0.1f / snap_fac) * 10.0f * snap_fac;
5946 const float snap_fac =
powf(10.0f,
5949 tempf =
roundf(tempf / snap_fac) * snap_fac;
5964 if (
ELEM(temp, softmin, softmax)) {
5972 temp = 10 * (temp / 10);
5975 temp = 100 * (temp / 100);
5986 const bool is_motion,
5992 bool changed =
false;
5997 if ((is_motion ||
data->draglock) &&
6007 const float softmin = but->
softmin;
6008 const float softmax = but->
softmax;
6009 const float softrange = softmax - softmin;
6020 switch (scale_type) {
6026 const float startvalue =
max_ff(
float(
data->startvalue), log_min);
6027 tempf =
expf(
float(mx -
data->dragstartx) * fac) * startvalue;
6028 if (tempf <= log_min) {
6034 tempf = cbrtf(
float(
data->startvalue)) +
float(mx -
data->dragstartx) * fac;
6035 tempf *= tempf * tempf;
6043 switch (scale_type) {
6045 if (tempf < softmin) {
6046 data->dragstartx -= (softmin - tempf) / fac;
6049 else if (tempf > softmax) {
6050 data->dragstartx -= (softmax - tempf) / fac;
6056 const float startvalue =
max_ff(
float(
data->startvalue), log_min);
6057 if (tempf < log_min) {
6058 data->dragstartx -=
logf(log_min / startvalue) / fac -
float(mx -
data->dragstartx);
6061 else if (tempf > softmax) {
6062 data->dragstartx -=
logf(softmax / startvalue) / fac -
float(mx -
data->dragstartx);
6068 if (tempf < softmin) {
6069 data->dragstartx = mx - int((cbrtf(softmin) - cbrtf(
float(
data->startvalue))) / fac);
6072 else if (tempf > softmax) {
6073 data->dragstartx = mx - int((cbrtf(softmax) - cbrtf(
float(
data->startvalue))) / fac);
6080 CLAMP(tempf, softmin, softmax);
6083 if (tempf !=
float(
data->value)) {
6084 data->dragchange =
true;
6085 data->value = tempf;
6090 if (softrange > 256) {
6093 else if (softrange > 32) {
6100 temp =
data->startvalue + ((double(mx) -
data->dragstartx) * double(fac));
6104 if (temp < softmin) {
6105 data->dragstartx -= (softmin - temp) / fac;
6108 else if (temp > softmax) {
6109 data->dragstartx += (temp - softmax) / fac;
6113 CLAMP(temp, softmin, softmax);
6116 if (temp !=
data->value) {
6117 data->dragchange =
true;
6123 data->draglastx = mx;
6127 const float softmin =
data->drag_map_soft_min;
6128 const float softmax =
data->drag_map_soft_max;
6129 const float softrange = softmax - softmin;
6131 float non_linear_range_limit;
6132 float non_linear_pixel_map;
6133 float non_linear_scale;
6140 non_linear_range_limit = 11.0f;
6141 non_linear_pixel_map = 500.0f;
6145 non_linear_range_limit = 129.0f;
6147 non_linear_pixel_map = 250.0f;
6150 if (softrange > 600) {
6151 deler =
powf(softrange, 0.75f);
6153 else if (softrange < 25) {
6156 else if (softrange < 100) {
6162 if (softrange > non_linear_range_limit) {
6163 non_linear_scale =
float(
abs(mx -
data->dragstartx)) / non_linear_pixel_map;
6166 non_linear_scale = 1.0f;
6169 if (is_float ==
false) {
6174 data->dragf += (
float(mx -
data->draglastx) / deler) * non_linear_scale;
6176 if (but->
softmin == softmin) {
6179 if (but->
softmax == softmax) {
6183 data->draglastx = mx;
6185 switch (scale_type) {
6187 tempf = (softmin +
data->dragf * softrange);
6193 const float base = softmax / log_min;
6194 tempf =
powf(base,
data->dragf) * log_min;
6195 if (tempf <= log_min) {
6201 tempf = (softmin +
data->dragf * softrange);
6202 tempf *= tempf * tempf;
6203 float cubic_min = softmin * softmin * softmin;
6204 float cubic_max = softmax * softmax * softmax;
6205 tempf = (tempf - cubic_min) / (cubic_max - cubic_min) * softrange + softmin;
6216 lvalue = int(
data->value);
6218 if (temp != lvalue) {
6219 data->dragchange =
true;
6220 data->value = double(temp);
6230 if (tempf !=
float(
data->value)) {
6231 data->dragchange =
true;
6232 data->value = tempf;
6252 if (
data->dragchange ==
false) {
6257 int mx =
data->window->runtime->eventstate->xy[0];
6258 int my =
data->window->runtime->eventstate->xy[1];
6261 if (mx < (but->
rect.
xmin + handle_width)) {
6264 else if (mx > (but->
rect.
xmax - handle_width)) {
6275 if (
data->changed_cursor) {
6277 data->changed_cursor =
false;
6281 if (
data->changed_cursor ==
false) {
6283 data->changed_cursor =
true;
6301 int mx =
event->xy[0];
6302 int my =
event->xy[1];
6304 const int screen_mx =
event->xy[0];
6315 int type =
event->type, val =
event->val;
6363#ifdef USE_DRAG_MULTINUM
6365 data->multi_data.drag_dir_prev[0] = mx;
6366 data->multi_data.drag_dir_prev[1] = my;
6373 data->cancel =
true;
6374 data->escapecancel =
true;
6379 if (
data->dragchange) {
6380#ifdef USE_DRAG_MULTINUM
6396 const bool is_motion = (
event->type ==
MOUSEMOVE);
6400#ifdef USE_DRAG_MULTINUM
6401 data->multi_data.drag_dir[0] +=
abs(
data->multi_data.drag_dir_prev[0] - mx);
6402 data->multi_data.drag_dir[1] +=
abs(
data->multi_data.drag_dir_prev[1] - my);
6403 data->multi_data.drag_dir_prev[0] = mx;
6404 data->multi_data.drag_dir_prev[1] = my;
6422#ifdef USE_DRAG_MULTINUM
6423 else if (
data->multi_data.has_mbuts) {
6451 const int value_step = std::max(1,
step);
6456 double(
max_ii(softmin,
int(
data->value) - value_step)) :
6457 double(
min_ii(softmax,
int(
data->value) + value_step));
6458 if (value_test !=
data->value) {
6459 data->value = double(value_test);
6462 data->cancel =
true;
6482 if (!isfinite(precision)) [[unlikely]] {
6498 const double value_test =
6502 if (value_test !=
data->value) {
6506 data->cancel =
true;
6518 data->draglastx = mx;
6519 data->draglasty = my;
6528 const bool is_horizontal,
6529 const bool is_motion,
6533 float cursor_x_range, f, tempf, softmin, softmax, softrange;
6535 bool changed =
false;
6552 softrange = softmax - softmin;
6572 f = (mx_fl -
data->dragstartx) / cursor_x_range +
data->dragfstart;
6573 CLAMP(f, 0.0f, 1.0f);
6576#ifdef USE_CONT_MOUSE_CORRECT
6579 if (is_horizontal) {
6580 data->ungrab_mval[0] = but->
rect.
xmin + (f * cursor_x_range);
6584 data->ungrab_mval[1] = but->
rect.
ymin + (f * cursor_x_range);
6592 switch (scale_type) {
6594 tempf = softmin + f * softrange;
6598 tempf =
powf(softmax / softmin, f) * softmin;
6602 const float cubicmin =
cube_f(softmin);
6603 const float cubicmax =
cube_f(softmax);
6604 const float cubicrange = cubicmax - cubicmin;
6605 tempf =
cube_f(softmin + f * softrange);
6606 tempf = (tempf - cubicmin) / cubicrange * softrange + softmin;
6613 if (
ELEM(tempf, softmin, softmax)) {
6619 if (
ELEM(tempf, softmin, softmax)) {
6621 else if (softrange < 2.10f) {
6622 tempf =
roundf(tempf * 100.0f) * 0.01f;
6624 else if (softrange < 21.0f) {
6625 tempf =
roundf(tempf * 10.0f) * 0.1f;
6632 if (softrange < 2.10f) {
6633 tempf =
roundf(tempf * 10.0f) * 0.1f;
6635 else if (softrange < 21.0f) {
6639 tempf =
roundf(tempf * 0.1f) * 10.0f;
6644 temp = 10 * (temp / 10);
6652 CLAMP(temp, softmin, softmax);
6654 if (temp != lvalue) {
6656 data->dragchange =
true;
6661 CLAMP(tempf, softmin, softmax);
6663 if (tempf !=
float(
data->value)) {
6664 data->value = tempf;
6665 data->dragchange =
true;
6679 int mx =
event->xy[0];
6680 int my =
event->xy[1];
6687 int type =
event->type, val =
event->val;
6711#ifndef USE_ALLSELECT
6726 data->dragstartx = mx;
6727 data->draglastx = mx;
6741#ifdef USE_DRAG_MULTINUM
6743 data->multi_data.drag_dir_prev[0] = mx;
6744 data->multi_data.drag_dir_prev[1] = my;
6750 data->cancel =
true;
6751 data->escapecancel =
true;
6756 if (
data->dragchange) {
6757#ifdef USE_DRAG_MULTINUM
6769#ifdef USE_CONT_MOUSE_CORRECT
6777 const bool is_motion = (
event->type ==
MOUSEMOVE);
6778#ifdef USE_DRAG_MULTINUM
6779 data->multi_data.drag_dir[0] +=
abs(
data->multi_data.drag_dir_prev[0] - mx);
6780 data->multi_data.drag_dir[1] +=
abs(
data->multi_data.drag_dir_prev[1] - my);
6781 data->multi_data.drag_dir_prev[0] = mx;
6782 data->multi_data.drag_dir_prev[1] = my;
6796#ifdef USE_DRAG_MULTINUM
6797 else if (
data->multi_data.has_mbuts) {
6820 float f, tempf, softmin, softmax, softrange;
6827 softrange = softmax - softmin;
6829 tempf =
data->value;
6830 temp = int(
data->value);
6833 if (but->
type == SLI) {
6844 f =
powf(softmax / softmin, f) * softmin;
6847 f = softmin + f * softrange;
6859 if (temp >= softmin && temp <= softmax) {
6863 data->cancel =
true;
6867 if (tempf >= softmin && tempf <= softmax) {
6877 tempf -= value_step;
6880 tempf += value_step;
6883 CLAMP(tempf, softmin, softmax);
6884 data->value = tempf;
6887 data->cancel =
true;
6901 data->draglastx = mx;
6902 data->draglasty = my;
6913 int mx =
event->xy[0];
6914 int my =
event->xy[1];
6924 data->dragstartx = mx;
6925 data->draglastx = mx;
6928 data->dragstartx = my;
6929 data->draglastx = my;
6939 data->cancel =
true;
6940 data->escapecancel =
true;
6948 const bool is_motion =
true;
6951 (horizontal) ? mx : my,
6984 int mx =
event->xy[0];
6985 int my =
event->xy[1];
6991 data->dragstartx =
event->xy[0];
6992 data->dragstarty =
event->xy[1];
7001 data->cancel =
true;
7002 data->escapecancel =
true;
7010 int dragstartx =
data->dragstartx;
7011 int dragstarty =
data->dragstarty;
7013 data->value =
data->origvalue + (horizontal ? mx - dragstartx : dragstarty - my);
7056 data->dragstartx =
event->xy[0];
7057 data->dragstarty =
event->xy[1];
7061#ifdef USE_DRAG_TOGGLE
7064 data->dragstartx =
event->xy[0];
7065 data->dragstarty =
event->xy[1];
7077 int type =
event->type;
7078 int val =
event->val;
7104 data->postbut = but;
7131 data->cancel =
true;
7148 bool changed =
true;
7156 float *fp =
data->origvec;
7158 const float radsq = rad * rad;
7162 mdx = (rad * fp[0]);
7163 mdy = (rad * fp[1]);
7165 else if (fp[2] > -1.0f) {
7166 mrad = rad /
sqrtf(fp[0] * fp[0] + fp[1] * fp[1]);
7168 mdx = 2.0f * mrad * fp[0] - (rad * fp[0]);
7169 mdy = 2.0f * mrad * fp[1] - (rad * fp[1]);
7175 float dx =
float(mx + mdx -
data->dragstartx);
7176 float dy =
float(my + mdy -
data->dragstarty);
7179 mrad = dx * dx + dy * dy;
7183 fp[2] =
sqrtf(radsq - dx * dx - dy * dy);
7187 mrad = rad /
sqrtf(mrad);
7189 dx *= (2.0f * mrad - 1.0f);
7190 dy *= (2.0f * mrad - 1.0f);
7192 mrad = dx * dx + dy * dy;
7196 fp[2] = -
sqrtf(radsq - dx * dx - dy * dy);
7202 const int snap_steps = (
snap ==
SNAP_ON) ? 4 : 12;
7203 const float snap_steps_angle =
M_PI / snap_steps;
7204 float angle, angle_snap;
7208 for (
int i = 0; i < 3; i++) {
7210 angle_snap =
roundf(
angle / snap_steps_angle) * snap_steps_angle;
7211 fp[i] =
sinf(angle_snap);
7217 data->draglastx = mx;
7218 data->draglasty = my;
7243 data->dragstartx =
event->xy[0];
7244 data->dragstarty =
event->xy[1];
7248#ifdef USE_DRAG_TOGGLE
7252 data->dragstartx =
event->xy[0];
7253 data->dragstarty =
event->xy[1];
7265 float hsv_static[3] = {0.0f};
7273 hsv[2] =
clamp_f(hsv[2] - 0.05f, 0.0f, 1.0f);
7276 hsv[2] =
clamp_f(hsv[2] + 0.05f, 0.0f, 1.0f);
7279 const float fac = 0.005 * (
event->xy[1] -
event->prev_xy[1]);
7280 hsv[2] =
clamp_f(hsv[2] + fac, 0.0f, 1.0f);
7316 data->cancel =
true;
7325 if (
paint !=
nullptr) {
7328 if (
brush ==
nullptr) {
7332 float *target = &
brush->gradient->data[
brush->gradient->cur].r;
7344 bool updated =
false;
7389 int mx =
event->xy[0];
7390 int my =
event->xy[1];
7396 data->dragstartx = mx;
7397 data->dragstarty = my;
7398 data->draglastx = mx;
7399 data->draglasty = my;
7421 data->cancel =
true;
7422 data->escapecancel =
true;
7440 const float v_max = std::max({
v[0],
v[1],
v[2]});
7443 v[0] = std::min(
v[0],
max);
7444 v[1] = std::min(
v[1],
max);
7445 v[2] = std::min(
v[2],
max);
7491 const bool use_continuous_grab,
7492 bool start_drag =
false)
7499 const bool changed =
true;
7503 float xpos, ypos, hsvo[3];
7514 data->relative_drag = {xpos, ypos};
7521 if (use_continuous_grab || shift) {
7531 data->relative_drag.x = mx;
7532 data->relative_drag.y = my;
7535#ifdef USE_CONT_MOUSE_CORRECT
7536 if (use_continuous_grab) {
7537 data->ungrab_mval[0] =
data->relative_drag.x;
7538 data->ungrab_mval[1] =
data->relative_drag.y;
7606 data->draglastx = mx;
7607 data->draglasty = my;
7612#ifdef WITH_INPUT_NDOF
7613static void ndofedit_but_HSVCUBE(ButtonHSVCube *hsv_but,
7614 HandleButtonData *
data,
7615 const wmNDOFMotionData &ndof,
7619 ColorPicker *cpicker =
static_cast<ColorPicker *
>(hsv_but->custom_data);
7620 float *hsv = cpicker->hsv_perceptual;
7621 const float hsv_v_max =
max_ff(hsv[2], hsv_but->softmax);
7623 const float sensitivity = (shift ? 0.15f : 0.3f) * ndof.time_delta;
7629 switch (hsv_but->gradient_type) {
7631 hsv[1] += ndof.rvec[2] * sensitivity;
7632 hsv[2] += ndof.rvec[0] * sensitivity;
7635 hsv[0] += ndof.rvec[2] * sensitivity;
7636 hsv[2] += ndof.rvec[0] * sensitivity;
7639 hsv[0] += ndof.rvec[2] * sensitivity;
7640 hsv[1] += ndof.rvec[0] * sensitivity;
7643 hsv[0] += ndof.rvec[2] * sensitivity;
7646 hsv[1] += ndof.rvec[2] * sensitivity;
7649 hsv[2] += ndof.rvec[2] * sensitivity;
7656 hsv[2] += ndof.rvec[0] * sensitivity;
7658 CLAMP(hsv[2], hsv_but->softmin, hsv_but->softmax);
7686 int mx =
event->xy[0];
7687 int my =
event->xy[1];
7694 data->dragstartx = mx;
7695 data->dragstarty = my;
7696 data->draglastx = mx;
7697 data->draglasty = my;
7701 const bool shift =
event->modifier &
KM_SHIFT;
7710#ifdef WITH_INPUT_NDOF
7712 const wmNDOFMotionData &ndof = *
static_cast<const wmNDOFMotionData *
>(
event->customdata);
7732 float rgb[3], def_hsv[3];
7743 def_hsv[0] = hsv[0];
7744 def_hsv[1] = hsv[1];
7759 data->cancel =
true;
7760 data->escapecancel =
true;
7768 const bool shift =
event->modifier &
KM_SHIFT;
7792 const bool use_continuous_grab,
7793 const bool start_drag =
false)
7795 const bool changed =
true;
7804 float hsvo[3], rgbo[3];
7814 cpicker, &rect, hsvo, &
data->relative_drag.x, &
data->relative_drag.y);
7817 data->relative_drag.x = mx;
7818 data->relative_drag.y = my;
7827 if (use_continuous_grab || shift) {
7829 data->relative_drag.x += (mx -
float(
data->draglastx)) * fac;
7830 data->relative_drag.y += (my -
float(
data->draglasty)) * fac;
7841 data->relative_drag.x = mx;
7842 data->relative_drag.y = my;
7845#ifdef USE_CONT_MOUSE_CORRECT
7846 if (use_continuous_grab) {
7848 data->ungrab_mval[0] =
data->relative_drag.x;
7849 data->ungrab_mval[1] =
data->relative_drag.y;
7856 if (hsv[2] == 0.0f) {
7861 if (hsv[2] == 0.0f) {
7864 hsv[2] = std::min(hsv[2], 0.9999f);
7871 hsv[1] = 1.0f -
sqrt3f(1.0f - hsv[1]);
7889 data->draglastx = mx;
7890 data->draglasty = my;
7895#ifdef WITH_INPUT_NDOF
7896static void ndofedit_but_HSVCIRCLE(Button *but,
7897 HandleButtonData *
data,
7898 const wmNDOFMotionData &ndof,
7902 ColorPicker *cpicker =
static_cast<ColorPicker *
>(but->custom_data);
7903 float *hsv = cpicker->hsv_perceptual;
7906 const float sensitivity = (shift ? 0.06f : 0.3f) * ndof.time_delta;
7918 v[0] = r *
cosf(phi);
7919 v[1] = r *
sinf(phi);
7922 v[0] += ndof.rvec[2] * sensitivity;
7923 v[1] += ndof.rvec[0] * sensitivity;
7929 phi += ndof.rvec[1] * sensitivity * 0.5f;
7938 if (cpicker->use_color_lock) {
7940 if (hsv[2] == 0.0f) {
7945 if (hsv[2] == 0.0f) {
7948 if (hsv[2] == 1.0f) {
7962 if (cpicker->use_luminosity_lock) {
7978 int mx =
event->xy[0];
7979 int my =
event->xy[1];
7985 data->dragstartx = mx;
7986 data->dragstarty = my;
7987 data->draglastx = mx;
7988 data->draglasty = my;
7990 const bool shift =
event->modifier &
KM_SHIFT;
8000#ifdef WITH_INPUT_NDOF
8003 const wmNDOFMotionData &ndof = *
static_cast<const wmNDOFMotionData *
>(
event->customdata);
8021 float rgb[3], def_hsv[3];
8030 def_hsv[0] = hsv[0];
8031 def_hsv[2] = hsv[2];
8047 data->cancel =
true;
8048 data->escapecancel =
true;
8054 hsv[2] =
clamp_f(hsv[2] - 0.05f, 0.0f, 1.0f);
8059 hsv[2] =
clamp_f(hsv[2] + 0.05f, 0.0f, 1.0f);
8066 const bool shift =
event->modifier &
KM_SHIFT;
8085 bool changed =
false;
8087 if (
data->draglastx == mx) {
8091 if (
data->coba->tot == 0) {
8096 data->dragcbd->pos += dx;
8102 data->draglastx = mx;
8111 int mx =
event->xy[0];
8112 int my =
event->xy[1];
8130 data->dragstartx = mx;
8131 data->dragstarty = my;
8132 data->draglastx = mx;
8133 data->draglasty = my;
8137 for (a = 0, cbd = coba->
data; a < coba->tot; a++, cbd++) {
8139 xco =
abs(xco - mx);
8140 if (a == coba->
cur) {
8144 if (xco < mindist) {
8151 data->dragfstart =
data->dragcbd->pos;
8160 if (mx !=
data->draglastx || my !=
data->draglasty) {
8171 data->dragcbd->pos =
data->dragfstart;
8173 data->cancel =
true;
8174 data->escapecancel =
true;
8195 bool changed =
false;
8202 int dragx =
data->draglastx;
8203 int dragy =
data->draglasty;
8212 d[0] = mx -
data->dragstartx;
8213 d[1] = my -
data->dragstarty;
8220 float fx = (mx - dragx) / zoomx;
8221 float fy = (my - dragy) / zoomy;
8223 if (
data->dragsel != -1) {
8226 bool moved_point =
false;
8231 for (
int a = 0; a < cuma->
totpoint; a++) {
8233 const float origx = cmp[a].
x, origy = cmp[a].
y;
8237 cmp[a].
x = 0.125f *
roundf(8.0f * cmp[a].
x);
8238 cmp[a].
y = 0.125f *
roundf(8.0f * cmp[a].
y);
8240 if (cmp[a].
x != origx || cmp[a].
y != origy) {
8251 data->draglastx = evtx;
8252 data->draglasty = evty;
8255#ifdef USE_CONT_MOUSE_CORRECT
8267 data->dragchange =
true;
8272 if (cumap->
curr.
xmin - fx < cumap->clipr.xmin) {
8278 if (cumap->
curr.
ymin - fy < cumap->clipr.ymin) {
8291 data->draglastx = evtx;
8292 data->draglasty = evty;
8303 bool changed =
false;
8306 int mx =
event->xy[0];
8307 int my =
event->xy[1];
8314 const float m_xy[2] = {
float(mx),
float(my)};
8329 for (
int a = 0; a < cuma->
totpoint; a++) {
8333 if (dist_sq < dist_min_sq) {
8335 dist_min_sq = dist_sq;
8340 float f_xy[2], f_xy_prev[2];
8352 for (
int i = 1; i <=
CM_TABLE; i++) {
8370 for (
int a = 0; a < cuma->
totpoint; a++) {
8371 if (cmp[a].
x == f_xy[0]) {
8392 for (
int a = 0; a < cuma->
totpoint; a++) {
8399 for (
int a = 0; a < cuma->
totpoint; a++) {
8407 data->cancel =
true;
8410 data->dragsel = sel;
8412 data->dragstartx =
event->xy[0];
8413 data->dragstarty =
event->xy[1];
8414 data->draglastx =
event->xy[0];
8415 data->draglasty =
event->xy[1];
8423 if (event->
xy[0] !=
data->draglastx || event->
xy[1] !=
data->draglasty) {
8438 if (
data->dragsel != -1) {
8443 if (
data->dragchange ==
false) {
8446 for (
int a = 0; a < cuma->
totpoint; a++) {
8481 bool changed =
false;
8488 int dragx =
data->draglastx;
8489 int dragy =
data->draglasty;
8502 float fx = (mx - dragx) / zoomx;
8503 float fy = (my - dragy) / zoomy;
8505 if (
data->dragsel != -1) {
8506 float last_x, last_y;
8508 bool moved_point =
false;
8514 const float delta[2] = {fx, fy};
8515 for (
int a = 0; a < profile->
path_len; a++) {
8526 last_x = pts[a].
h1_loc[0];
8527 last_y = pts[a].
h1_loc[1];
8531 last_x = pts[a].
h2_loc[0];
8532 last_y = pts[a].
h2_loc[1];
8540 data->draglastx = evtx;
8541 data->draglasty = evty;
8543#ifdef USE_CONT_MOUSE_CORRECT
8554 data->dragchange =
true;
8559 if (profile->
view_rect.
xmin - fx < profile->clip_rect.xmin) {
8565 if (profile->
view_rect.
ymin - fy < profile->clip_rect.ymin) {
8578 data->draglastx = evtx;
8579 data->draglasty = evty;
8615 int mx =
event->xy[0];
8616 int my =
event->xy[1];
8622 data->dragstartx = mx;
8623 data->dragstarty = my;
8624 data->draglastx = mx;
8625 data->draglasty = my;
8641 const float m_xy[2] = {
float(mx),
float(my)};
8655 int i_selected = -1;
8657 for (
int i = 0; i < profile->
path_len; i++) {
8661 if (dist_sq < dist_min_sq) {
8664 dist_min_sq = dist_sq;
8672 if (dist_sq < dist_min_sq) {
8675 dist_min_sq = dist_sq;
8681 if (dist_sq < dist_min_sq) {
8684 dist_min_sq = dist_sq;
8691 if (i_selected == -1) {
8692 float f_xy[2], f_xy_prev[2];
8711 i_selected = int(new_pt - profile->
path);
8712 BLI_assert(i_selected >= 0 && i_selected <= profile->path_len);
8722 pts = profile->
path;
8723 if (i_selected != -1) {
8726 if (pts[i_selected].flag & selection_type) {
8728 pts[i_selected].
flag ^= selection_type;
8730 if (pts[i_selected].flag & active_type) {
8750 for (
int a = 0; a < profile->
path_len; a++) {
8753 pts[i_selected].
flag |= (selection_type | active_type);
8757 for (
int i = 0; i < profile->
path_len; i++) {
8762 profile->
path[i_selected].
flag |= (selection_type | active_type);
8767 data->cancel =
true;
8770 data->dragsel = i_selected;
8772 data->dragstartx = mx;
8773 data->dragstarty = my;
8774 data->draglastx = mx;
8775 data->draglasty = my;
8783 if (mx !=
data->draglastx || my !=
data->draglasty) {
8793 if (
data->dragsel != -1) {
8795 if (
data->dragchange ==
false) {
8814 const bool changed =
true;
8815 const float dy = my -
data->draglasty;
8819 hist->
ymax += (dy * 0.1f) * yfac;
8824 data->draglastx = mx;
8825 data->draglasty = my;
8833 int mx =
event->xy[0];
8834 int my =
event->xy[1];
8839 data->dragstartx = mx;
8840 data->dragstarty = my;
8841 data->draglastx = mx;
8842 data->draglasty = my;
8864 data->cancel =
true;
8865 data->escapecancel =
true;
8870 if (mx !=
data->draglastx || my !=
data->draglasty) {
8888 const bool changed =
true;
8890 const float dy = my -
data->draglasty;
8897 data->draglastx = mx;
8898 data->draglasty = my;
8906 int mx =
event->xy[0];
8907 int my =
event->xy[1];
8912 data->dragstartx = mx;
8913 data->dragstarty = my;
8914 data->draglastx = mx;
8915 data->draglasty = my;
8937 data->cancel =
true;
8938 data->escapecancel =
true;
8943 if (mx !=
data->draglastx || my !=
data->draglasty) {
8962 const bool changed =
true;
8964 float dx = mx -
data->draglastx;
8965 float dy = my -
data->draglasty;
8988 data->draglastx = mx;
8989 data->draglasty = my;
8997 int mx =
event->xy[0];
8998 int my =
event->xy[1];
9003 data->dragstartx = mx;
9004 data->dragstarty = my;
9005 data->draglastx = mx;
9006 data->draglasty = my;
9020 data->cancel =
true;
9021 data->escapecancel =
true;
9026 if (mx !=
data->draglastx || my !=
data->draglasty) {
9066 bool is_press_ctrl_but_no_shift = (
event->val ==
KM_PRESS) &&
9069 const bool do_copy =
event->type ==
EVT_CKEY && is_press_ctrl_but_no_shift;
9070 const bool do_paste =
event->type ==
EVT_VKEY && is_press_ctrl_but_no_shift;
9107 if (clicked_view_item_but) {
9108 clicked_view_item_but->view_item->activate_for_context_menu(*
C);
9123#ifdef WITH_INPUT_NDOF
9161 switch (but->
type) {
9279#ifdef USE_DRAG_MULTINUM
9297 const float dir_nor_y[2] = {0.0, 1.0f};
9298 float dir_nor_drag[2];
9304 data->multi_data.drag_lock_x =
event->xy[0];
9315 if ((
data->text_edit.edit_string &&
9317 ((
abs(
data->multi_data.drag_lock_x - event->
xy[0]) > margin_x) &&
9321 if (
data->multi_data.has_mbuts) {
9377 if (
data->autoopentimer) {
9379 data->autoopentimer =
nullptr;
9389 bContext *
C,
ARegion *region,
int *pass,
double *r_pass_delay,
bool *r_exit_on_event)
9391 bool is_quick_tip =
false;
9393 is_quick_tip =
true;
9399 *r_exit_on_event =
false;
9419 if (!
wm->runtime->drags.first_) {
9474 if (
data->used_mouse && !
data->autoopentimer) {
9486 time = 5 *
U.menuthreshold1;
9509 data->text_select_auto_scroll =
nullptr;
9552 status.
item(
IFACE_(
"Cancel"), ICON_EVENT_ESC);
9553#if defined(__APPLE__)
9554 status.
item(
IFACE_(
"Snap"), ICON_KEY_COMMAND);
9556 status.
item(
IFACE_(
"Snap"), ICON_EVENT_CTRL);
9559 status.
item(
IFACE_(
"Precision"), ICON_EVENT_SHIFT);
9577 "Can't edit driven number value, see driver editor for the driver setup");
9583#ifdef USE_CONT_MOUSE_CORRECT
9586 int mouse_ungrab_xy[2];
9588 mouse_ungrab_xy[0] =
data->ungrab_mval[0];
9589 mouse_ungrab_xy[1] =
data->ungrab_mval[1];
9613 else if (
data->flashtimer) {
9615 data->flashtimer =
nullptr;
9623 else if (
data->hold_action_timer) {
9625 data->hold_action_timer =
nullptr;
9634 &
data->window->runtime->modalhandlers,
9711 data->region = region;
9713#ifdef USE_CONT_MOUSE_CORRECT
9722 data->interactive =
true;
9743 data->used_mouse =
true;
9751 if (
data->menu &&
data->menu->region) {
9815#ifdef USE_DRAG_MULTINUM
9816 if (
data->multi_data.has_mbuts) {
9821 if (!
data->cancel) {
9835 if (!
data->cancel ||
data->escapecancel) {
9843 if (!onfree && !
data->cancel) {
9865 if (
U.runtime.is_dirty ==
false) {
9871 for (
Block &block_iter :
data->region->runtime->uiblocks) {
9882 if (
data->text_edit.edit_string) {
9883 MEM_delete(
data->text_edit.edit_string);
9885 if (
data->text_edit.original_string) {
9886 MEM_delete(
data->text_edit.original_string);
9893 if (
data->changed_cursor) {
9899 if (
data->changed_wokspace_status) {
9908 if (
data->custom_interaction_handle !=
nullptr) {
9911 data->custom_interaction_handle->user_count--;
9914 if (
data->custom_interaction_handle->user_count == 0) {
9918 data->custom_interaction_handle =
nullptr;
9948 data->cancel =
true;
9962 [&]() { button_active_free(C, but); });
9968 Button *but_found =
nullptr;
9976 Button *active_but_override =
nullptr;
9977 Button *active_but_real =
nullptr;
9978 Button *active_but_last =
nullptr;
9984 active_but_override = &but;
9987 active_but_real = &but;
9990 active_but_last = &but;
9995 Button *activebut = active_but_override;
9997 activebut = active_but_real;
10000 activebut = active_but_last;
10003 if (activebut && (but_check_cb ==
nullptr || but_check_cb(activebut))) {
10006 but_found = activebut;
10009 if (
data &&
data->menu && (region !=
data->menu->region)) {
10010 region =
data->menu->region;
10058 if (activebut && activebut->
rnapoin) {
10060 *r_prop = activebut->
rnaprop;
10079 region_popup ? region_popup :
CTX_wm_region(
C), r_ptr, r_prop, r_index);
10097 if (activebut->
func) {
10121 if (region_ctx ==
nullptr) {
10137 if (®ion == region_ctx) {
10168 Button *activebut =
nullptr;
10193 region =
data->menu->region;
10209 if (!active_but || !active_but->
active || !active_but->
changed || active_but->
block != block) {
10215 if (
data->searchbox) {
10243 const bool labeledit =
event->modifier &
KM_CTRL;
10247 const bool for_tooltip =
true;
10249 region, event->
xy, labeledit, for_tooltip,
nullptr,
nullptr);
10286 event.customdata = but;
10287 event.customdata_free =
false;
10304 *active_back = but->
active;
10305 data = MEM_new<HandleButtonData>(__func__);
10308 data->region = region;
10331 data->cancel =
true;
10357 CLOG_WARN(&
LOG,
"%s: error, unhandled type: %d", __func__,
int(but->
type));
10383 if (prev_active_but) {
10384 prev_active_but->
active =
nullptr;
10400 if (prev_active_but) {
10401 prev_active_but->
active = prev_active_data;
10437 double default_value;
10441 default_value = double(
10450 default_value = double(
10458 *r_value = default_value;
10476 switch (event->
type) {
10479 data->cancel =
true;
10482#ifdef USE_UI_POPOVER_ONCE
10488 data->cancel =
false;
10524 data->cancel =
true;
10534 bool reenable_tooltip =
true;
10544 reenable_tooltip = (large_button && movement > threshold);
10549 reenable_tooltip = (movement > threshold);
10553 if (reenable_tooltip) {
10568 data->autoopentimer =
nullptr;
10595 switch (event->
type) {
10597 data->cancel =
true;
10604 data->cancel =
true;
10612 data->hold_action_timer =
nullptr;
10625 if (
data->hold_action_timer) {
10629 if (movement <= threshold) {
10641 data->cancel =
false;
10648 data->cancel =
true;
10663 switch (event->
type) {
10679 switch (event->
type) {
10683 if (
data->menu &&
data->menu->region) {
10693 data->cancel =
true;
10728 if ((
data->cancel ==
false) && (
data->text_edit.edit_string !=
nullptr) &&
10729 (
data->text_edit.edit_string[0] ==
'\0') &&
10732 MEM_SAFE_DELETE(
data->text_edit.edit_string);
10735#ifdef USE_DRAG_MULTINUM
10736 if (
data->multi_data.mbuts) {
10740 double default_value;
10747 data->multi_data.skip =
true;
10795 int type =
event->type, val =
event->val;
10796 int scroll_dir = 1;
10797 bool redraw =
false;
10800 if (!ui_list || !ui_list->
dyn_data) {
10805 int mx =
event->xy[0];
10806 int my =
event->xy[1];
10833 value = value_orig;
10842 int current_idx = -1;
10844 for (
int i = 0; i <
len; i++) {
10846 org_order[new_order ? new_order[++org_idx] : ++org_idx] = i;
10848 current_idx = new_order ? new_order[org_idx] : org_idx;
10851 else if (i == value && org_idx >= 0) {
10852 current_idx = -(new_order ? new_order[org_idx] : org_idx) - 1;
10859 if (current_idx < 0) {
10860 current_idx = (current_idx * -1) + (inc < 0 ? inc : inc - 1);
10863 current_idx += inc;
10866 value = org_order[current_idx];
10867 MEM_delete(org_order);
10878 if (value != value_orig) {
10926 const bool has_list = !region->
ui_lists.is_empty();
10927 const bool has_view = [&]() {
10929 if (!block.
views.is_empty()) {
10936 if (!has_view && !has_list) {
10955 bool changed =
false;
10957 if (highlight_row_but && !(highlight_row_but->
flag &
UI_HOVER)) {
10964 if (&but == highlight_row_but) {
10990 switch (event->
type) {
11017 const bool close_popup = view_but == active_but;
11056 if (
data->interactive) {
11069 data->cancel =
true;
11085 data->cancel =
true;
11140 const bool use_wiggle_room)
11155 }
while ((region = region->
next));
11164 const float newp[2] = {
float(xy[0]),
float(xy[1])};
11177 const float p1[2] = {rect_px.
xmin - margin, rect_px.
ymin - margin};
11178 const float p2[2] = {rect_px.
xmax + margin, rect_px.
ymin - margin};
11179 const float p3[2] = {rect_px.
xmax + margin, rect_px.
ymax + margin};
11180 const float p4[2] = {rect_px.
xmin - margin, rect_px.
ymax + margin};
11184 if (use_wiggle_room) {
11209#ifdef USE_KEYNAV_LIMIT
11239 rctf auto_scroll_bounds = block->
rect;
11241 BLI_rctf_pad(&auto_scroll_bounds, shadow_width, shadow_width);
11274 bt.rect.ymin += dy;
11275 bt.rect.ymax += dy;
11315 else if (test ==
'b') {
11328 if (scroll_dir == 1) {
11334 else if (scroll_dir == -1) {
11373 const bool is_parent_menu,
11379 if ((level != 0) && (but ==
nullptr) && (is_parent_menu || menu->
popup ==
false)) {
11481 if (num_bytes == -1) {
11484 char buf[
sizeof(
event->utf8_buf) + 1];
11485 memcpy(buf, event->
utf8_buf, num_bytes);
11486 buf[num_bytes] =
'\0';
11511 const bool is_parent_menu)
11517 int mx =
event->xy[0];
11518 int my =
event->xy[1];
11606 const bool is_parent_inside,
11607 const bool is_parent_menu,
11608 const bool is_floating)
11616 int mx =
event->xy[0];
11617 int my =
event->xy[1];
11623 const bool inside_title = inside && ((my + (
UI_UNIT_Y * 1.4f)) > block->
rect.
ymax);
11628#ifdef USE_DRAG_POPUP
11630# if defined(__APPLE__)
11651 else if (win->
cursor == PopupTitleHoverCursor) {
11724 switch (event->
type) {
11732 if (inside ==
false) {
11734 if (block->
saferct.first()) {
11752 if (block->
saferct.first()) {
11794 const float dy =
event->xy[1] -
event->prev_xy[1];
11817 const int scroll_dir = (
event->type ==
WHEELUPMOUSE) ? 1 : -1;
11843 int type =
event->type;
11844 int val =
event->val;
11873#ifdef USE_KEYNAV_LIMIT
11896 Button *but_wrap =
nullptr;
12083 if ((level != 0) && (but ==
nullptr || !menu->
menu_idname[0])) {
12099 if (!(but_iter.flag &
BUT_DISABLED) && but_iter.menu_key == event->
type) {
12100 if (
ELEM(but_iter.type,
12133 if ((inside ==
false) && (menu->
menuretval == 0)) {
12152 &saferct->
parent,
float(event->
xy[0]),
float(event->
xy[1])))
12177#ifdef USE_KEYNAV_LIMIT
12195 else if ((but_default !=
nullptr) &&
12197 ((but_default->
active ==
nullptr) ||
12210 else if ((but_default !=
nullptr) && (but_default->
active ==
nullptr)) {
12215 else if (but_active ==
nullptr) {
12219#ifdef USE_DRAG_POPUP
12221 (inside && is_floating && inside_title))
12245 for (saferct = block->
saferct.first(); saferct; saferct = saferct->
next) {
12291#ifdef USE_UI_POPOVER_ONCE
12375 if (!force_close) {
12417 if (but ==
nullptr) {
12474 if (duration > 0.01 *
U.pie_initial_timeout) {
12481 float fac = animate ? duration / (0.01f * double(
U.pie_animation_timeout)) : 1.0f;
12496 center[0] = (vec[0] > 0.01f) ? 0.5f : ((vec[0] < -0.01f) ? -0.5f : 0.0f);
12497 center[1] = (vec[1] > 0.99f) ? 0.5f : ((vec[1] < -0.99f) ? -0.5f : 0.0f);
12521 if (duration - block->
pie_data->duration_gesture > 0.02) {
12524 block->
pie_data->duration_gesture = duration;
12527 if (len_sq < 1.0f) {
12537 if (event->
type == block->
pie_data->event_type && !is_click_style) {
12556 if (but && (
U.pie_menu_confirm > 0) &&
12557 (dist >=
UI_SCALE_FAC * (
U.pie_menu_threshold +
U.pie_menu_confirm)))
12570 switch (event->
type) {
12572 if (!is_click_style) {
12582 if ((
U.pie_menu_confirm > 0) &&
12583 (dist >=
UI_SCALE_FAC * (
U.pie_menu_threshold +
U.pie_menu_confirm)))
12587 block->
pie_data->duration_gesture = duration;
12598 if (is_click_style) {
12659#define CASE_NUM_TO_DIR(n, d) \
12660 case (EVT_ZEROKEY + n): \
12661 case (EVT_PAD0 + n): { \
12662 if (num_dir == UI_RADIAL_NONE) { \
12688#undef CASE_NUM_TO_DIR
12703 const bool is_parent_inside,
12704 const bool is_parent_menu,
12705 const bool is_floating)
12708 bool do_towards_reinit =
false;
12718 bool inside =
false;
12722 event->type != block->
pie_data->event_type);
12724 if (do_recursion) {
12725 if (is_parent_inside ==
false) {
12726 int mx =
event->xy[0];
12727 int my =
event->xy[1];
12733 C, event, submenu, level + 1, is_parent_inside || inside, is_menu,
false);
12739 int mx =
event->xy[0];
12740 int my =
event->xy[1];
12782 if (do_but_search) {
12791 do_towards_reinit =
true;
12802 bool handled =
false;
12804 const bool is_actbut_in_modal_state = active_but &&
12808 listbox && !is_actbut_in_modal_state)
12812 retval = retval_test;
12817 if (handled ==
false) {
12819 C, event, menu, level, is_parent_inside, is_parent_menu, is_floating);
12831 if (do_towards_reinit) {
12915 if (region ==
nullptr) {
12921 if (screen ==
nullptr) {
12937 BLI_assert(active_but->semi_modal_state ==
nullptr);
12974 if (
data->menu &&
data->menu->region &&
12982 if (
data->menu &&
data->menu->region) {
12990 submenu = (
data) ?
data->menu :
nullptr;
12995 if (!but_other->
str.empty()) {
13022 if (but_other->
icon && !but_other->
str.empty()) {
13029 return (event->
mval[0] <
int(left) || event->
mval[0] >
int(right));
13079 if (
data->menu &&
data->menu->menuretval) {
13132 bool reset_pie =
false;
13169#ifdef USE_DRAG_TOGGLE
13242 ListBaseT<wmEventHandler> *handlers,
13246#ifdef WITH_INPUT_IME
13252 WM_window_IME_end(win);
13357 bool have_reference =
false;
13359 bool valid_for_refresh = popup_block_handle->
can_refresh;
13364 have_reference =
true;
13365 valid_for_refresh =
false;
13373 if (search_button.
active) {
13376 have_reference =
true;
13377 valid_for_refresh =
false;
13389 if (have_reference) {
13390 if (valid_for_refresh) {
13411 if (valid_for_refresh) {
13426 if (
G.background) {
13429 if (!srna_to_unreg) {
13434 auto refresh_or_remove_handler = [&](
wmEventHandler &handler_base,
13435 ListBaseT<wmEventHandler> &handlers) {
13486 const void *rna_poin_data,
13487 const char *rna_prop_id)
13503 const void *rna_poin_data,
13504 const char *rna_prop_id,
13523 const void *rna_poin_data,
13524 const char *rna_prop_id)
13526 Button *but_text =
nullptr;
13527 Block *block_text =
nullptr;
13530 block_text = █
13549 Block *block_text =
nullptr;
13550 Button *but_text =
nullptr;
13555 block_text = █
13583 if (but.
active ==
nullptr) {
13596 for (
ARegion ®ion : area->regionbase) {
13601 if (
data->menu ==
nullptr &&
data->searchbox ==
nullptr) {
13658 const bool is_click)
13663 int unique_retval_ids_len = 0;
13666 unique_retval_ids_len++;
13671 unique_retval_ids_len = 0;
13674 unique_retval_ids[unique_retval_ids_len++] = but.
retval;
13678 if (unique_retval_ids_len > 1) {
13681 unique_retval_ids_len);
13683 unique_retval_ids,
sizeof(*unique_retval_ids) * unique_retval_ids_len));
13692 return interaction;
13702 MEM_delete(interaction);
13727 const bool is_click)
13729 if (
data->custom_interaction_handle) {
13738 data->custom_interaction_handle = interaction;
13748 bool warp_cursor_at_button,
13752 switch (target_state) {
13765 return std::nullopt;
13771 for (
ARegion &other_region : area->regionbase) {
13774 return std::nullopt;
13781 if (std::find_if(test_area.
regionbase.begin(),
13792 return std::nullopt;
13795 Button *button =
nullptr;
13797 auto but_itr = std::ranges::find_if(
13798 block.
buttons_ptrs, [&](
const std::unique_ptr<Button> &but) {
13799 return but->rnapoin.data == ptr->data && but->rnaprop == prop && but->rnaindex == index;
13802 button = but_itr->get();
13808 return std::nullopt;
13830 const rctf button_rect = button->
rect;
13837 button->
rect = button_rect;
13849 rctf button_view_rect;
13852 if (warp_cursor_at_button) {
13861 button->
rect = button_rect;
13862 return std::nullopt;
Generic array manipulation API.
#define BLI_array_deduplicate_ordered(arr, arr_len)
#define BLI_SCOPED_DEFER(function_to_defer)
#define STRNCPY_UTF8(dst, src)
Platform independent time functions.
#define CLOG_WARN(clg_ref,...)
#define CLOG_INFO_NOCHECK(clg_ref, format,...)
#define RGN_ALIGN_ENUM_FROM_MASK(align)
#define UI_LIST_AUTO_SIZE_THRESHOLD
#define ED_screen_areas_iter(win, screen, area_name)
Read Blender memory allocation and freeing.
#define RNA_SUBTYPE_UNIT_VALUE(subtype)
#define AUTOCOMPLETE_FULL_MATCH
#define AUTOCOMPLETE_NO_MATCH
#define UI_PRECISION_FLOAT_MAX
#define UI_PRECISION_FLOAT_SCALE
#define button_is_decorator(but)
#define UI_TOOLTIP_DELAY_QUICK
#define WM_UI_HANDLER_CONTINUE
#define ND_SPACE_INFO_REPORT
#define WM_UI_HANDLER_BREAK
#define BLI_assert_unreachable()
#define IN_RANGE(a, b, c)
#define UNUSED_VARS_NDEBUG(...)
#define BLI_assert_msg(a, msg)
#define MEM_realloc_uninitialized(vmemh, len)
void activate(bool forceActivation=false) const
void jump(const btVector3 &v=btVector3(0, 0, 0))
SIMD_FORCE_INLINE btScalar angle(const btVector3 &v) const
Return the angle between this and another vector.
static GHOST_ISystem * getSystem()
virtual void setAutoFocus(const bool auto_focus)=0
constexpr const char * c_str() const
void item(std::string text, int icon1, int icon2=0)
constexpr const char * end() const
constexpr const char * begin() const
static constexpr int64_t not_found
constexpr bool is_empty() const
constexpr int64_t size() const
constexpr const char * data() const
void copy_utf8_truncated(char *dst, int64_t dst_size) const
void activate(bContext &C)
virtual bool rename(const bContext &C, StringRefNull new_name)
virtual StringRef get_rename_string() const
VecBase< float, D > step(VecOp< float, D >, VecOp< float, D >) RET
float length(VecOp< float, D >) RET
#define BUTTON_FLASH_DELAY
#define DRAG_MULTINUM_THRESHOLD_DRAG_X
#define MENU_TOWARDS_WIGGLE_ROOM
#define BUTTON_MOUSE_TOWARDS_THRESH
#define DRAG_MULTINUM_THRESHOLD_DRAG_Y
#define UI_PROP_SCALE_LOG_SNAP_OFFSET
#define UI_PROP_SCALE_LOG_MIN
#define MENU_SCROLL_INTERVAL
#define MENU_TOWARDS_MARGIN
#define DRAG_MULTINUM_THRESHOLD_VERTICAL
#define UI_DRAG_MAP_SOFT_RANGE_PIXEL_MAX
#define IS_ALLSELECT_EVENT(event)
#define BUT_IS_SELECT_CONTEXT
#define CASE_NUM_TO_DIR(n, d)
#define BUTTON_KEYNAV_PX_LIMIT
#define PIE_MENU_INTERVAL
#define BUTTON_AUTO_OPEN_THRESH
#define UI_BITBUT_VALUE_TOGGLED(a, b)
#define PIE_CLICK_THRESHOLD_SQ
#define UI_MENU_SCROLL_MOUSE
ccl_device_inline dual1 len(const ccl_private dual< T > &a)
void invalidate_cursor_overlay(Scene &scene, CurveMapping *curve)
void add_recent_search(StringRef chosen_str)
int get_menu_shadow_width()
void button_execute_begin(bContext *, ARegion *region, Button *but, void **active_back)
void butstore_free(Block *block, ButStore *bs_handle)
static void textedit_prev_but(Block *block, Button *actbut, HandleButtonData *data)
std::optional< int2 > try_activate_rna_button(bContext *C, ARegion *region, ActivationButtonState target_state, PointerRNA *ptr, PropertyRNA *prop, bool warp_cursor_at_button=false, int index=0)
void block_interaction_set(Block *block, BlockInteraction_CallbackData *callbacks)
bool button_active_drop_color(bContext *C)
static int popup_handler(bContext *C, const wmEvent *event, void *userdata)
size_t button_drawstr_len_without_sep_char(const Button *but)
static bool but_is_drag_toggle(const Button *but)
void textbox_add_scroll(ButtonTextBox *textbox, int step)
static void handle_afterfunc_add_operator_ex(wmOperatorType *ot, PointerRNA **properties, wm::OpCallContext opcontext, const Button *context_but)
LayoutPanelHeader * layout_panel_header_under_mouse(const Panel &panel, const int my)
void button_anim_decorate_update_from_flag(ButtonDecorator *but)
Block * block_func_COLOR(bContext *C, PopupBlockHandle *handle, void *arg_but)
static void textedit_move(Button *but, TextEdit &text_edit, eStrCursorJumpDirection direction, const bool select, eStrCursorJumpType jump, bool jump_all_multiline=false)
static void but_paste_curvemapping(bContext *C, Button *but)
static std::optional< StringRef > button_edit_unit_hint_get_from_prop_subtype(const PropertySubType subtype)
static eSnapType event_to_snap(const wmEvent *event)
static Button * context_button_active(const ARegion *region, bool(*but_check_cb)(const Button *))
void button_update_view_for_active(const bContext *C, const Block *block)
void blocklist_free(const bContext *C, ARegion *region)
int button_unit_type_get(const Button *but)
int button_string_get_maxncpy(Button *but)
void UI_screen_free_active_but_highlight(const bContext *C, bScreen *screen)
static void afterfunc_update_preferences_dirty(AfterFunc *after)
void button_execute_end(bContext *C, ARegion *, Button *but, void *active_back)
static void apply_but(bContext *C, Block *block, Button *but, HandleButtonData *data, const bool interactive)
UndoStack_Text * textedit_undo_stack_create()
static bool numedit_but_HSVCUBE(Button *but, HandleButtonData *data, int mx, int my, const eSnapType snap, const bool shift, const bool use_continuous_grab, bool start_drag=false)
static void numedit_begin(Button *but, HandleButtonData *data)
void(*)(bContext *C, Layout *layout, void *arg1) MenuCreateFunc
Button * block_active_but_get(const Block *block)
void layout_panel_popup_scroll_apply(Panel *panel, const float dy)
void hsvcircle_vals_from_pos(const rcti *rect, float mx, float my, float *r_val_rad, float *r_val_dist)
static bool button_value_default(Button *but, double *r_value)
void perceptual_to_scene_linear_space(Button *but, float rgb[3])
Button * button_prev(Button *but) ATTR_WARN_UNUSED_RESULT
ARegion * tooltip_create_from_button_or_extra_icon(bContext *C, ARegion *butregion, Button *but, ButtonExtraOpIcon *extra_icon, bool is_quick_tip)
Button * button_active_drop_name_button(const bContext *C)
static void do_but_extra_operator_icons_mousemove(Button *but, HandleButtonData *data, const wmEvent *event)
void button_extra_operator_icons_free(Button *but)
bool button_supports_cycling(const Button *but)
void button_active_free(const bContext *C, Button *but)
static int handle_button_event(bContext *C, const wmEvent *event, Button *but)
void button_active_string_clear_and_exit(bContext *C, Button *but)
void button_anim_flag(Button *but, const AnimationEvalContext *anim_eval_context)
bool layout_panel_toggle_open(const bContext *C, LayoutPanelHeader *header)
bool but_contains_point_px_icon(const Button *but, ARegion *region, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
static void apply_but_WAVEFORM(bContext *C, Button *but, HandleButtonData *data)
void button_anim_autokey(bContext *C, Button *but, Scene *scene, float cfra)
static bool drag_toggle_set_xy_xy(bContext *C, ARegion *region, const bool pushed_state, const int xy_src[2], const int xy_dst[2], const bool drag_lock[2])
Button * region_but_find_rect_over(const ARegion *region, const rcti *rect_px)
void button_string_get(Button *but, char *str, const size_t str_maxncpy)
static void but_get_pasted_text_from_clipboard(const bool ensure_utf8, char **r_buf_paste, int *r_buf_len, bool paste_all_lines)
bool button_contains_pt(const Button *but, float mx, float my) ATTR_WARN_UNUSED_RESULT
void(*)(bContext *C, void *argN, void *arg2) ButtonHandleNFunc
void region_views_clear_search_highlight(const ARegion *region)
bool but_contains_password(const Button *but) ATTR_WARN_UNUSED_RESULT
static void handle_button_activate(bContext *C, ARegion *region, Button *but, ButtonActivateType type)
void(*)(bContext *C, void *arg1, void *arg2) ButtonHandleFunc
bool button_menu_draw_as_popover(const Button *but)
static void apply_but_COLORBAND(bContext *C, Button *but, HandleButtonData *data)
static BlockInteraction_Handle * block_interaction_begin(bContext *C, Block *block, const bool is_click)
static int do_but_CURVEPROFILE(bContext *C, Block *block, Button *but, HandleButtonData *data, const wmEvent *event)
static int uilist_get_increment(const uiList *list, const int type)
void butstore_register(ButStore *bs_handle, Button **but_p)
void button_v4_get(Button *but, float vec[4])
static bool numedit_but_HSVCIRCLE(Button *but, HandleButtonData *data, float mx, float my, const eSnapType snap, const bool shift, const bool use_continuous_grab, const bool start_drag=false)
static void apply_but_IMAGE(bContext *C, Button *but, HandleButtonData *data)
Button * view_item_find_mouse_over(const ARegion *region, const int xy[2]) ATTR_NONNULL(1
Vector< StringRef > textbox_wrap_lines(ButtonTextBox *textbox)
bool context_copy_to_selected_list(bContext *C, PointerRNA *ptr, PropertyRNA *prop, Vector< PointerRNA > *r_lb, bool *r_use_path_from_id, std::optional< std::string > *r_path)
static void mouse_scale_warp(HandleButtonData *data, const float mx, const float my, float *r_mx, float *r_my, const bool shift)
Button * view_item_find_search_highlight(const ARegion *region)
Button * context_active_but_get_respect_popup(const bContext *C)
void button_value_set(Button *but, double value)
void button_range_set_hard(Button *but)
const uiStyle * style_get()
@ BUTTON_ACTIVATE_TEXT_EDITING
static eStrCursorJumpType textedit_jump_type_from_event(const wmEvent *event)
static void mouse_motion_keynav_init(KeyNavLock *keynav, const wmEvent *event)
bool but_has_quick_tooltip(const Button *but)
void button_text_password_hide(std::string &password_str, Button *but, const bool restore)
bool region_contains_point_px(const ARegion *region, const int xy[2]) ATTR_NONNULL(1
void searchbox_update(bContext *C, ARegion *region, Button *but, bool reset)
static int handler_region_menu(bContext *C, const wmEvent *event, void *userdata)
static void menu_scroll_apply_offset_y(ARegion *region, Block *block, float dy)
static bool selectcontext_begin(bContext *C, Button *but, uiSelectContextStore *selctx_data)
void popup_block_free(bContext *C, PopupBlockHandle *handle)
bool button_is_cursor_warp(const Button *but) ATTR_WARN_UNUSED_RESULT
static int do_but_SEARCH_UNLINK(bContext *C, Block *block, Button *but, HandleButtonData *data, const wmEvent *event)
bool textbutton_activate_rna(const bContext *C, ARegion *region, const void *rna_poin_data, const char *rna_prop_id)
void button_semi_modal_state_free(const bContext *C, Button *but)
void UI_region_free_active_but_all(bContext *C, ARegion *region)
static float numedit_apply_snap(int temp, float softmin, float softmax, const eSnapType snap)
void button_pie_dir(RadialDirection dir, float vec[2])
void button_update_edited(Button *but)
bool button_is_float(const Button *but)
static bool but_dragedit_update_mval(HandleButtonData *data, int mx, FunctionRef< int()> drag_threshold_fn)
bool block_layout_needs_resolving(const Block *block)
bool button_is_userdef(const Button *but)
static int handle_region_semi_modal_buttons(bContext *C, const wmEvent *event, ARegion *region)
void button_activate_event(bContext *C, ARegion *region, Button *but)
static bool but_find_select_in_enum__cmp(const Button *but_a, const Button *but_b)
Button * but_find_mouse_over(const ARegion *region, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
void panel_drag_collapse_handler_add(const bContext *C, const bool was_open)
void button_drag_start(bContext *C, Button *but)
static void apply_but_VIEW_ITEM(bContext *C, Block *block, Button *but, HandleButtonData *data)
static bool textedit_delete_selection(Button *but, TextEdit &text_edit)
int handler_panel_region(bContext *C, const wmEvent *event, ARegion *region, const Button *active_but)
static bool event_is_snap(const wmEvent *event)
static void but_copy_numeric_array(Button *but, char *output, int output_maxncpy)
static void numedit_set_active(Button *but)
Button * region_find_first_but_test_flag(ARegion *region, int64_t flag_include, int64_t flag_exclude)
static int do_but_TOG(bContext *C, Button *but, HandleButtonData *data, const wmEvent *event)
static int do_but_HOTKEYEVT(bContext *C, Button *but, HandleButtonData *data, const wmEvent *event)
bool button_active_drop_name(const bContext *C)
static bool menu_pass_event_to_parent_if_nonactive(PopupBlockHandle *menu, const Button *but, const int level, const bool is_parent_menu, const int retval)
bool view_item_can_rename(const AbstractViewItem &item)
@ BUTTON_STATE_TEXT_SELECTING
@ BUTTON_STATE_NUM_EDITING
@ BUTTON_STATE_TEXTBOX_SCROLLING
@ BUTTON_STATE_TEXTBOX_RESIZING
@ BUTTON_STATE_TEXT_EDITING
@ BUTTON_STATE_WAIT_RELEASE
@ BUTTON_STATE_WAIT_KEY_EVENT
@ BUTTON_STATE_WAIT_FLASH
bool searchbox_event(bContext *C, ARegion *region, Button *but, ARegion *butregion, const wmEvent *event)
void window_to_block(const ARegion *region, const Block *block, int *x, int *y)
static void handle_button_return_submenu(bContext *C, const wmEvent *event, Button *but)
static int do_but_BUT(bContext *C, Button *but, HandleButtonData *data, const wmEvent *event)
void popup_block_scrolltest(Block *block)
PointerRNA * button_operator_ptr_ensure(Button *but)
wmOperator * context_active_operator_get(const bContext *C)
static int handle_viewlist_items_hover(const wmEvent *event, ARegion *region)
static void but_copy_colorband(Button *but)
static void apply_but_autokey(bContext *C, Button *but)
bool button_is_compatible(const Button *but_a, const Button *but_b)
static void multibut_states_create(Button *but_active, HandleButtonData *data)
static int do_but_COLOR(bContext *C, Button *but, HandleButtonData *data, const wmEvent *event)
float block_to_window_scale(const ARegion *region, const Block *block)
static void numedit_end(Button *but, HandleButtonData *data)
bool view_item_supports_drag(const AbstractViewItem &item)
static void textedit_string_set(Button *but, TextEdit &text_edit, const char *str)
void block_to_window_fl(const ARegion *region, const Block *block, float *x, float *y)
static void blocks_set_tooltips(ARegion *region, const bool enable)
static void region_auto_open_clear(ARegion *region)
void fontstyle_set(const uiFontStyle *fs)
static void but_paste_CurveProfile(bContext *C, Button *but)
static bool numedit_but_HISTOGRAM(Button *but, HandleButtonData *data, int mx, int my)
wmOperatorType * button_operatortype_get_from_enum_menu(Button *but, PropertyRNA **r_prop)
static void apply_but_TEX(bContext *C, Button *but, HandleButtonData *data)
static void apply_but_BLOCK(bContext *C, Button *but, HandleButtonData *data)
static void but_copy_text(Button *but, char *output, int output_maxncpy)
static AfterFunc * afterfunc_new()
static int do_but_HISTOGRAM(bContext *C, Block *block, Button *but, HandleButtonData *data, const wmEvent *event)
Button * region_find_active_but(ARegion *region) ATTR_WARN_UNUSED_RESULT
static int do_but_SCROLL(bContext *C, Block *block, Button *but, HandleButtonData *data, const wmEvent *event)
PropertyScaleType button_scale_type(const Button *but)
void view_item_begin_rename(AbstractViewItem &item)
static void apply_but_funcs_after(bContext *C)
static void palette_set_active(ButtonColor *color_but)
ARegion * region_searchbox_region_get(const ARegion *button_region)
void searchbox_free(bContext *C, ARegion *region)
static void but_copy_operator(bContext *C, Button *but, char *output, int output_maxncpy)
void fontscale(float *points, float aspect)
size_t button_tip_len_only_first_line(const Button *but)
void hsvcube_pos_from_vals(const ButtonHSVCube *hsv_but, const rcti *rect, const float *hsv, float *r_xp, float *r_yp)
static int do_but_EXIT(bContext *C, Button *but, HandleButtonData *data, const wmEvent *event)
const char * textedit_undo(UndoStack_Text *stack, int direction, int *r_cursor_index)
static int do_but_UNITVEC(bContext *C, Block *block, Button *but, HandleButtonData *data, const wmEvent *event)
bool block_is_menu(const Block *block) ATTR_WARN_UNUSED_RESULT
static int handle_uilist_event(bContext *C, const wmEvent *event, ARegion *region, Button *listbox)
static int handle_menus_recursive(bContext *C, const wmEvent *event, PopupBlockHandle *menu, int level, const bool is_parent_inside, const bool is_parent_menu, const bool is_floating)
static int do_but_TAB(bContext *C, Block *block, Button *but, HandleButtonData *data, const wmEvent *event)
static void button_tooltip_timer_reset(bContext *C, Button *but)
Block * region_block_find_mouse_over(const ARegion *region, const int xy[2], bool only_clip)
static int text_position_to_hidden(Button *but, int pos)
void textbox_textedit_set_cursor_pos(ButtonTextBox *textbox, const ARegion *region, const float2 xy)
PanelType * button_paneltype_get(const Button *but)
static int do_but_TRACKPREVIEW(bContext *C, Block *block, Button *but, HandleButtonData *data, const wmEvent *event)
void popup_handlers_remove_all(bContext *C, ListBaseT< wmEventHandler > *handlers)
static void set_initial_search_query_from_event(const wmEvent *event, PointerRNA *props, const StringRefNull prop_name)
static void numedit_begin_set_values(Button *but, HandleButtonData *data)
void button_range_set_soft(Button *but)
static void but_paste_numeric_array(bContext *C, Button *but, HandleButtonData *data, char *buf_paste)
Button * button_find_select_in_enum(Button *but, int direction)
static void multibut_free(HandleButtonData *data, Block *block)
static void rgb_to_color_picker_HSVCUBE_compat_v(const ButtonHSVCube *hsv_but, const float rgb[3], float hsv[3])
static bool numedit_but_CURVE(Block *block, Button *but, HandleButtonData *data, int evtx, int evty, bool snap, const bool shift)
static ButtonMultiState * multibut_lookup(HandleButtonData *data, const Button *but)
bool but_is_utf8(const Button *but)
static int handler_region_drag_toggle(bContext *C, const wmEvent *event, void *userdata)
static bool but_copy(bContext *C, Button *but, const bool copy_array)
PopupBlockHandle * popup_menu_create(bContext *C, ARegion *butregion, Button *but, MenuCreateFunc menu_func, void *arg, bool can_refresh)
void textedit_undo_stack_destroy(UndoStack_Text *stack)
static void float_array_to_string(const float *values, const int values_len, char *output, int output_maxncpy)
static int do_but_CURVE(bContext *C, Block *block, Button *but, HandleButtonData *data, const wmEvent *event)
static void mouse_motion_towards_init(PopupBlockHandle *menu, const int xy[2])
static void apply_but_CURVEPROFILE(bContext *C, Button *but, HandleButtonData *data)
static void textedit_set_cursor_select(Button *but, HandleButtonData *data, const float2 xy)
static void multibut_restore(bContext *C, HandleButtonData *data, Block *block)
static int do_but_KEYEVT(bContext *C, Button *but, HandleButtonData *data, const wmEvent *event)
bool button_is_bool(const Button *but)
static int text_position_from_hidden(Button *but, int pos)
static void but_paste_text(bContext *C, Button *but, HandleButtonData *data, char *buf_paste)
static bool multibut_drag_wait(const HandleButtonMulti &multi_data)
static bool handle_button_activate_by_type(bContext *C, ARegion *region, Button *but)
static void rna_update_preferences_dirty(PointerRNA *ptr, PropertyRNA *prop)
static int handle_menu_button(bContext *C, const wmEvent *event, PopupBlockHandle *menu)
void scene_linear_to_perceptual_space(Button *but, float rgb[3])
void region_to_window(const ARegion *region, int *x, int *y)
bool button_anim_expression_get(Button *but, char *str, size_t str_maxncpy)
static bool textedit_delete(Button *but, TextEdit &text_edit, eStrCursorJumpDirection direction, eStrCursorJumpType jump)
bool button_color_has_alpha(Button *but)
static bool popup_needs_update_for_unreg_srna_recursive(bContext *C, PopupBlockHandle *popup_block_handle, StructRNA *srna_to_unreg)
static void but_paste(bContext *C, Button *but, HandleButtonData *data, const bool paste_array)
static bool button_modal_state(HandleButtonState state)
static bool multibut_states_tag(Button *but_active, HandleButtonData *data, const wmEvent *event)
static void apply_but_TAB(bContext *C, Button *but, HandleButtonData *data)
static bool but_copypaste_curve_alive
static void but_paste_menu(bContext *C, Button *but, const StringRef value)
static eCurveProfilePoint_Flag profile_select_to_active(eCurveProfilePoint_Flag selection_type)
static bool numedit_but_COLORBAND(Button *but, HandleButtonData *data, int mx)
void button_string_get_ex(Button *but, char *str, const size_t str_maxncpy, const int float_precision, const bool use_exp_float, bool *r_use_exp_float)
void popup_handlers_add(bContext *C, ListBaseT< wmEventHandler > *handlers, PopupBlockHandle *popup, char flag)
static int do_but_text_value_cycle(bContext *C, Button *but, HandleButtonData *data, const int inc_value)
Button * button_find_mouse_over_ex(const ARegion *region, const int xy[2], bool labeledit, bool for_tooltip, const ButtonFindPollFn find_poll, const void *find_custom_data) ATTR_NONNULL(1
void(*)(bContext *C, void *arg, int event) BlockHandleFunc
static void textedit_begin(bContext *C, Button *but, HandleButtonData *data)
std::optional< StringRef > button_edit_unit_hint_get(const Button &but)
static int do_but_WAVEFORM(bContext *C, Block *block, Button *but, HandleButtonData *data, const wmEvent *event)
void handle_afterfunc_add_operator(wmOperatorType *ot, wm::OpCallContext opcontext)
static int do_but_COLORBAND(bContext *C, Block *block, Button *but, HandleButtonData *data, const wmEvent *event)
bool button_string_eval_number(bContext *C, const Button *but, const char *str, double *r_value)
static void block_open_end(bContext *C, Button *but, HandleButtonData *data)
static void multibut_add(HandleButtonData *data, Button *but)
static void apply_but_BUT(bContext *C, Button *but, HandleButtonData *data)
void button_v3_get(Button *but, float vec[3])
void block_to_window_rctf(const ARegion *region, const Block *block, rctf *rct_dst, const rctf *rct_src)
static int handle_view_item_event(bContext *C, const wmEvent *event, Button *active_but, ARegion *region)
ARegion ARegion * screen_region_find_mouse_over(bScreen *screen, const wmEvent *event)
Block *(*)(bContext *C, ARegion *region, void *arg1) BlockCreateFunc
void button_set_string_interactive(bContext *C, Button *but, const char *value)
void popup_handlers_remove(ListBaseT< wmEventHandler > *handlers, PopupBlockHandle *popup)
static void block_interaction_end(bContext *C, BlockInteraction_CallbackData *callbacks, BlockInteraction_Handle *interaction)
static constexpr double menu_keep_open_duration
static void but_paste_color(bContext *C, Button *but, char *buf_paste)
static int do_but_NUM(bContext *C, Block *block, Button *but, HandleButtonData *data, const wmEvent *event)
static void apply_but_HISTOGRAM(bContext *C, Button *but, HandleButtonData *data)
static void apply_but_CURVE(bContext *C, Button *but, HandleButtonData *data)
static bool numedit_but_UNITVEC(Button *but, HandleButtonData *data, int mx, int my, const eSnapType snap)
static int get_but_property_array_length(Button *but)
static int textedit_autocomplete(bContext *C, Button *but, HandleButtonData *data)
static int do_but_textedit(bContext *C, Block *block, Button *but, HandleButtonData *data, const wmEvent *event)
static void apply_but_undo(Button *but, bool use_undo_grouped=false)
static bool do_but_ANY_drag_toggle(bContext *C, Button *but, HandleButtonData *data, const wmEvent *event, int *r_retval)
Button * region_active_but_prop_get(const ARegion *region, PointerRNA *r_ptr, PropertyRNA **r_prop, int *r_index)
Block *(*)(bContext *C, PopupBlockHandle *handle, void *arg1) BlockHandleCreateFunc
static int do_button(bContext *C, Block *block, Button *but, const wmEvent *event)
static void but_copy_numeric_value(Button *but, char *output, int output_maxncpy)
static int do_but_BLOCK(bContext *C, Button *but, HandleButtonData *data, const wmEvent *event)
static void apply_but_TOG(bContext *C, Button *but, HandleButtonData *data)
static Button * block_pie_dir_activate(Block *block, const wmEvent *event, RadialDirection dir)
static void mouse_motion_towards_init_ex(PopupBlockHandle *menu, const int xy[2], const bool force)
static ColorBand but_copypaste_coba
constexpr int textbox_minimum_visible_lines
static void region_handler_remove(bContext *C, void *)
static int do_but_GRIP(bContext *C, Block *block, Button *but, HandleButtonData *data, const wmEvent *event)
int textbox_wrapped_line_index_from_char_offset(Span< StringRef > lines, int offset)
void popup_menu_retval_set(const Block *block, int retval, bool enable)
static void mouse_motion_towards_reinit(PopupBlockHandle *menu, const int xy[2])
static void but_extra_operator_icon_apply(bContext *C, Button *but, ButtonExtraOpIcon *op_icon)
bool button_active_only(const bContext *C, ARegion *region, Block *block, Button *but)
void but_ensure_in_view(const bContext *C, ARegion *region, const Button *but)
void button_tooltip_refresh(bContext *C, Button *but)
static int pie_handler(bContext *C, const wmEvent *event, PopupBlockHandle *menu)
static bool drag_toggle_but_pushed_state(Button *but)
int button_menu_step(Button *but, int direction)
static bool menu_scroll_step(ARegion *region, Block *block, const int scroll_dir)
static void selectcontext_end(Button *but, uiSelectContextStore *selctx_data)
double button_value_get(Button *but)
static void textedit_end(bContext *C, Button *but, HandleButtonData *data)
PopupBlockHandle * popup_block_create(bContext *C, ARegion *butregion, Button *but, BlockCreateFunc create_func, BlockHandleCreateFunc handle_create_func, void *arg, FreeArgFunc arg_free, bool can_refresh)
static bool parse_float_array(char *text, float *values, int values_len_expected)
void button_tooltip_timer_remove(bContext *C, Button *but)
static int handle_menu_mmb_event(bContext *C, const wmEvent *event, PopupBlockHandle *menu, int level, const bool is_parent_menu)
Button * listrow_find_mouse_over(const ARegion *region, const int xy[2]) ATTR_NONNULL(1
static void apply_but_ROW(bContext *C, Block *block, Button *but, HandleButtonData *data)
void context_active_but_prop_handle(bContext *C, bool handle_undo)
bool button_string_set(bContext *C, Button *but, const char *str)
static int do_but_SLI(bContext *C, Block *block, Button *but, HandleButtonData *data, const wmEvent *event)
static bool but_copy_popover(Button *but, char *output, int output_maxncpy)
int button_menu_direction(Button *but)
bool block_is_pie_menu(const Block *block) ATTR_WARN_UNUSED_RESULT
static char menu_scroll_test(Block *block, int2 xy)
bool button_is_editable(const Button *but) ATTR_WARN_UNUSED_RESULT
static int do_but_TEX(bContext *C, Block *block, Button *but, HandleButtonData *data, const wmEvent *event)
static void but_set_float_array(bContext *C, Button *but, HandleButtonData *data, const float *values, const int values_len)
void refresh_for_srna_unregister(Main *bmain, StructRNA *srna_to_unreg)
static int handle_menu_event(bContext *C, const wmEvent *event, PopupBlockHandle *menu, int level, const bool is_parent_inside, const bool is_parent_menu, const bool is_floating)
static void clamp_axis_max_v3(float v[3], const float max)
static void multibut_states_apply(bContext *C, HandleButtonData *data, Block *block)
static void color_snap_hue(const eSnapType snap, float *r_hue)
bool searchbox_inside(ARegion *region, const int xy[2]) ATTR_NONNULL(1
Button * button_first(Block *block) ATTR_WARN_UNUSED_RESULT
static void apply_but_NUM(bContext *C, Button *but, HandleButtonData *data)
static void but_paste_colorband(bContext *C, Button *but, HandleButtonData *data)
static void popup_check(bContext *C, wmOperator *op)
static int do_but_HSVCUBE(bContext *C, Block *block, Button *but, HandleButtonData *data, const wmEvent *event)
static bool menu_scroll_to_y(ARegion *region, Block *block, int y)
static void but_copy_color(Button *but, char *output, int output_maxncpy)
float block_calc_pie_segment(Block *block, const float event_xy[2])
bool view_item_popup_keep_open(const AbstractViewItem &item)
static void apply_but_func(bContext *C, Button *but)
static int but_pie_button_activate(bContext *C, Button *but, PopupBlockHandle *menu)
static ButtonExtraOpIcon * but_extra_operator_icon_mouse_over_get(Button *but, ARegion *region, const wmEvent *event)
void button_convert_to_unit_alt_name(Button *but, char *str, size_t str_maxncpy)
static bool but_drag_init(bContext *C, Button *but, HandleButtonData *data, const wmEvent *event)
static CurveMapping but_copypaste_curve
bool uilist_item_index_is_filtered_visible(const struct uiList *ui_list, int item_idx)
static int do_but_LISTROW(bContext *C, Button *but, HandleButtonData *data, const wmEvent *event)
void pan_to_scroll(const wmEvent *event, int *type, int *val)
bool searchbox_apply(Button *but, ARegion *region)
char * button_string_get_dynamic(Button *but, int *r_str_size)
int fontstyle_height_max(const uiFontStyle *fs)
static void but_copy_CurveProfile(Button *but)
bool button_has_array_value(const Button *but) ATTR_WARN_UNUSED_RESULT
bool button_is_interactive(const Button *but, bool labeledit) ATTR_WARN_UNUSED_RESULT
bool button_drag_is_draggable(const Button *but)
static void rgb_to_color_picker_HSVCUBE_v(const ButtonHSVCube *hsv_but, const float rgb[3], float hsv[3])
Button * button_last(Block *block) ATTR_WARN_UNUSED_RESULT
void hsvcircle_pos_from_vals(const ColorPicker *cpicker, const rcti *rect, const float *hsv, float *r_xpos, float *r_ypos)
static bool do_but_extra_operator_icon(bContext *C, Button *but, HandleButtonData *data, const wmEvent *event)
bool button_opens_link(const Button *button)
void color_picker_hsv_to_rgb(const float r_cp[3], float rgb[3])
static void textedit_set_cursor_pos(Button *but, const ARegion *region, const float2 xy)
Button * listbox_find_mouse_over(const ARegion *region, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
static void with_but_active_as_semi_modal(bContext *C, ARegion *region, Button *but, FunctionRef< void()> fn)
void context_update_anim_flag(const bContext *C)
static void handler_region_drag_toggle_remove(bContext *, void *userdata)
static void force_activate_view_item_but(bContext *C, ARegion *region, ButtonViewItem *but, const bool close_popup=true)
Button * button_find_rect_over(const ARegion *region, const rcti *rect_px) ATTR_WARN_UNUSED_RESULT
static void button_activate_init(bContext *C, ARegion *region, Button *but, ButtonActivateType type)
bool popup_context_menu_for_button(bContext *C, Button *but, const wmEvent *event)
bool button_contains_point_px(const Button *but, const ARegion *region, const int xy[2]) ATTR_NONNULL(1
bool button_is_editable_as_text(const Button *but) ATTR_WARN_UNUSED_RESULT
bool button_is_popover_once_compat(const Button *but) ATTR_WARN_UNUSED_RESULT
Button * region_active_but_get(const ARegion *region)
void button_activate_over(bContext *C, ARegion *region, Button *but)
static bool mouse_motion_towards_check(Block *block, PopupBlockHandle *menu, const int xy[2], const bool use_wiggle_room)
bool button_anim_decorate_pushed_state(ButtonDecorator *but)
static int do_but_VIEW_ITEM(bContext *C, Button *but, HandleButtonData *data, const wmEvent *event)
int button_text_padding(const Button *button)
static CurveProfile but_copypaste_profile
void button_override_flag(Main *bmain, Button *but)
static void but_update_preferences_dirty(Button *but)
static bool but_pie_menu_supported_apply(Button *but)
static bool point_draw_handles(CurveProfilePoint *point)
void but_handle_data_free(HandleButtonData **data)
void button_v3_set(Button *but, const float vec[3])
static bool numedit_but_CURVEPROFILE(Block *block, Button *but, HandleButtonData *data, int evtx, int evty, bool snap, const bool shift)
static int but_pie_menu_apply(bContext *C, PopupBlockHandle *menu, Button *but, bool force_close)
Button * context_active_but_prop_get(const bContext *C, PointerRNA *r_ptr, PropertyRNA **r_prop, int *r_index)
MenuType * button_menutype_get(const Button *but)
void window_to_block_fl(const ARegion *region, const Block *block, float *x, float *y)
static void but_paste_normalized_vector(bContext *C, Button *but, HandleButtonData *data, char *buf_paste)
float textbox_grip_height()
static void but_paste_numeric_value(bContext *C, Button *but, HandleButtonData *data, char *buf_paste)
static void numedit_apply(bContext *C, Block *block, Button *but, HandleButtonData *data)
Button * context_active_but_get(const bContext *C)
int searchbox_autocomplete(bContext *C, ARegion *region, Button *but, char *str)
static bool but_copypaste_profile_alive
static void button_activate_exit(bContext *C, Button *but, HandleButtonData *data, const bool mousemove, const bool onfree)
void popup_menu_memory_set(Block *block, Button *but)
static void block_open_begin(bContext *C, Button *but, HandleButtonData *data)
static int handle_menu_letter_press_search(PopupBlockHandle *menu, const wmEvent *event)
static bool numedit_but_SLI(Button *but, HandleButtonData *data, int mx, FunctionRef< int()> drag_threshold_fn, const bool is_horizontal, const bool is_motion, const bool snap, const bool shift)
int button_is_pushed(Button *but)
static bool textedit_insert_buf(Button *but, TextEdit &text_edit, const char *buf, int buf_len)
static void popup_handler_remove(bContext *C, void *userdata)
static void selectcontext_apply(bContext *C, Button *but, uiSelectContextStore *selctx_data, const double value, const double value_orig)
static void apply_but_VEC(bContext *C, Button *but, HandleButtonData *data)
void button_hsv_set(Button *but)
static void drag_toggle_set(bContext *C, uiDragToggleHandle *drag_info, const int xy_input[2])
static bool can_activate_other_menu(Button *but, Button *but_other, const wmEvent *event)
static void block_interaction_update(bContext *C, BlockInteraction_CallbackData *callbacks, BlockInteraction_Handle *interaction)
PopupBlockHandle * popover_panel_create(bContext *C, ARegion *butregion, Button *but, PopoverCreateFunc popover_func, const PanelType *panel_type)
void popup_translate(ARegion *region, const int mdiff[2])
static void color_picker_to_rgb_HSVCUBE_v(const ButtonHSVCube *hsv_but, const float hsv[3], float rgb[3])
static int do_but_textedit_select(bContext *C, Block *block, Button *but, HandleButtonData *data, const wmEvent *event)
bool int searchbox_find_index(ARegion *region, const char *name)
bool textbutton_activate_but(const bContext *C, Button *actbut)
static void textedit_string_ensure_max_length(Button *but, TextEdit &text_edit, int str_maxncpy)
void region_handlers_add(ListBaseT< wmEventHandler > *handlers)
void button_clipboard_free()
static float mouse_scale_warp_factor(const bool shift)
static void but_copy_curvemapping(Button *but)
static int handle_menu_return_submenu(bContext *C, const wmEvent *event, PopupBlockHandle *menu)
static bool drag_toggle_but_is_supported(const Button *but)
bool view_item_drag_start(bContext &C, AbstractViewItem &item)
static bool afterfunc_check(const Block *block, const Button *but)
bool button_is_editing(const Button *but)
std::string button_get_link(const Button *button, bContext *C)
static float numedit_apply_snapf(Button *but, float tempf, float softmin, float softmax, const eSnapType snap)
bool button_draw_as_link(const Button *button)
void(*)(void *argN) ButtonArgNFree
float textbox_vertical_padding()
static void textedit_next_but(Block *block, Button *actbut, HandleButtonData *data)
static int do_but_HSVCIRCLE(bContext *C, Block *block, Button *but, HandleButtonData *data, const wmEvent *event)
void textedit_undo_push(UndoStack_Text *stack, const char *text, int cursor_index)
static bool numedit_but_WAVEFORM(Button *but, HandleButtonData *data, int mx, int my)
static int region_handler(bContext *C, const wmEvent *event, void *)
static int handle_button_over(bContext *C, const wmEvent *event, ARegion *region)
static bool menu_scroll_to_but(ARegion *region, Block *block, Button *but_target)
bool block_is_popup_any(const Block *block) ATTR_WARN_UNUSED_RESULT
static bool button_references_srna(Button &button, const StructRNA *srna)
void popover_once_clear(Popover *pup)
static bool numedit_but_NUM(ButtonNumber *but, HandleButtonData *data, int mx, FunctionRef< int()> drag_threshold_fn, const bool is_motion, const eSnapType snap, float fac)
StringRef button_drawstr_without_sep_char(const Button *but) ATTR_NONNULL()
void button_update(Button *but)
static ARegion * but_tooltip_init(bContext *C, ARegion *region, int *pass, double *r_pass_delay, bool *r_exit_on_event)
static int do_but_TEXTBOX(bContext *C, Block *block, ButtonTextBox *textbox, HandleButtonData *data, const wmEvent *event)
void color_picker_rgb_to_hsv_compat(const float rgb[3], float r_cp[3])
static void foreach_semi_modal_but_as_active(bContext *C, ARegion *region, FunctionRef< void(Button *semi_modal_but)> fn)
bool context_copy_to_selected_check(PointerRNA *ptr, PointerRNA *ptr_link, PropertyRNA *prop, const char *path, bool use_path_from_id, PointerRNA *r_ptr, PropertyRNA **r_prop)
static bool but_copy_menu(bContext *C, Button *but, char *output, int output_maxncpy)
static bool numedit_but_TRACKPREVIEW(bContext *C, Button *but, HandleButtonData *data, int mx, int my, const bool shift)
static Button * block_find_rna_text_button(Block &block, const void *rna_poin_data, const char *rna_prop_id)
static ListBaseT< AfterFunc > UIAfterFuncs
static void block_interaction_begin_ensure(bContext *C, Block *block, HandleButtonData *data, const bool is_click)
static void button_activate_state(bContext *C, Button *but, HandleButtonState state)
static void button_edit_unit_hint_refresh(bContext *C, Button *but, HandleButtonData *data)
@ BUT_FORCE_SEMI_MODAL_ACTIVE
@ BUT_ACTIVATE_ON_INIT_NO_SELECT
@ BUT_TEXTEDIT_AUTOCOMPLETE_KEEP_ACTIVE
ButStore * butstore_create(Block *block)
void textbox_scroll_to_cursor(ButtonTextBox *textbox)
bool button_is_rna_valid(Button *but)
static bool rna_is_userdef(PointerRNA *ptr, PropertyRNA *prop)
Button * button_next(Button *but) ATTR_WARN_UNUSED_RESULT
void button_execute(const bContext *C, ARegion *region, Button *but)
void textbox_jump_line(ButtonTextBox *textbox, eStrCursorJumpDirection direction, const bool select)
static Button * but_list_row_text_activate(bContext *C, Button *but, HandleButtonData *data, const wmEvent *event, ButtonActivateType activate_type)
static void apply_but_TRACKPREVIEW(bContext *C, Button *but, HandleButtonData *data)
void context_active_but_clear(bContext *C, wmWindow *win, ARegion *region)
static Button * but_find_open_event(ARegion *region, const wmEvent *event)
Block * block_find_mouse_over_ex(const ARegion *region, const int xy[2], bool only_clip) ATTR_NONNULL(1
static bool textedit_copypaste(Button *but, TextEdit &text_edit, const int mode)
void popup_menu_close_from_but(const Button *but, bool is_cancel=false)
static bool mouse_motion_keynav_test(KeyNavLock *keynav, const wmEvent *event)
bool button_is_unit(const Button *but)
static void apply_but_BUTM(bContext *C, Button *but, HandleButtonData *data)
MINLINE float min_ff(float a, float b)
void WM_main_add_notifier(uint type, void *reference)
int RNA_property_array_length(PointerRNA *ptr, PropertyRNA *prop)
MINLINE int round_fl_to_int_clamp(float a)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
size_t size_t size_t BLI_snprintf_utf8(char *__restrict dst, size_t dst_maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
void WM_global_reportf(eReportType type, const char *format,...)
PointerRNA RNA_property_pointer_get(PointerRNA *ptr, PropertyRNA *prop)
ScrArea * CTX_wm_area(const bContext *C)
void WM_report_banner_show(wmWindowManager *wm, wmWindow *win)
MINLINE void copy_v2_v2_int(int r[2], const int a[2])
double WM_tooltip_time_closed()
void ED_screen_set_active_region(bContext *C, wmWindow *win, const int xy[2])
void linearrgb_to_srgb_v3_v3(float srgb[3], const float linear[3])
void RNA_property_float_get_array(PointerRNA *ptr, PropertyRNA *prop, float *values)
void RNA_property_float_get_array_at_most(PointerRNA *ptr, PropertyRNA *prop, float *values, int values_num)
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
MINLINE void copy_v2_fl(float r[2], float f)
void ED_undo_grouped_push(bContext *C, const char *str, UndoEncodeHints hints=UndoEncodeHints(0))
float BLF_width(int fontid, const char *str, size_t str_len, ResultBLF *r_info=nullptr) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(2)
void RNA_property_update(bContext *C, PointerRNA *ptr, PropertyRNA *prop)
void WM_tooltip_timer_init_ex(bContext *C, wmWindow *win, ScrArea *area, ARegion *region, wmTooltipInitFn init, double delay)
void RNA_property_pointer_set(PointerRNA *ptr, PropertyRNA *prop, PointerRNA ptr_value, ReportList *reports)
bool RNA_struct_is_a(const StructRNA *type, const StructRNA *srna)
MINLINE void copy_v3_v3(float r[3], const float a[3])
void BLI_rctf_recenter(struct rctf *rect, float x, float y)
void * MEM_new_array_uninitialized(size_t len, size_t size, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1
@ UILST_SCROLL_TO_ACTIVE_ITEM
double BKE_unit_base_scalar(int system, int type)
void WM_event_start_drag(bContext *C, int icon, eWM_DragDataType type, void *poin, uint flags)
@ RGN_TYPE_ASSET_SHELF_HEADER
ATTR_WARN_UNUSED_RESULT const BMLoop * l
MINLINE int round_fl_to_int(float a)
wmEventHandler_UI * WM_event_add_ui_handler(const bContext *C, ListBaseT< wmEventHandler > *handlers, wmUIHandlerFunc handle_fn, wmUIHandlerRemoveFunc remove_fn, void *user_data, const eWM_EventHandlerFlag flag)
std::optional< std::string > WM_prop_pystring_assign(bContext *C, PointerRNA *ptr, PropertyRNA *prop, int index)
PointerRNA RNA_id_pointer_create(ID *id)
MINLINE void mul_v2_fl(float r[2], float f)
void WM_operator_properties_free(PointerRNA *ptr)
void RNA_property_float_set(PointerRNA *ptr, PropertyRNA *prop, float value)
Depsgraph * CTX_data_depsgraph_pointer(const bContext *C)
size_t size_t BLI_strnlen_utf8(const char *strc, size_t strc_maxlen) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
const char * RNA_property_identifier(const PropertyRNA *prop)
MINLINE void copy_v2_v2(float r[2], const float a[2])
void RNA_string_set(PointerRNA *ptr, const char *name, const char *value)
void srgb_to_linearrgb_v3_v3(float linear[3], const float srgb[3])
void rgb_to_hsl_v(const float rgb[3], float r_hsl[3])
int RNA_property_enum_get(PointerRNA *ptr, PropertyRNA *prop)
void CTX_wm_window_set(bContext *C, wmWindow *win)
float RNA_property_float_get_index(PointerRNA *ptr, PropertyRNA *prop, int index)
void WM_cursor_modal_set(wmWindow *win, int val)
void BLI_rcti_rctf_copy(struct rcti *dst, const struct rctf *src)
void rgb_to_hsv_v(const float rgb[3], float r_hsv[3])
MenuType * WM_menutype_find(const StringRef idname, bool quiet)
void BKE_curvemapping_copy_data(CurveMapping *target, const CurveMapping *cumap)
MINLINE float normalize_v2_length(float n[2], float unit_length)
char * BLI_strncpy_utf8(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
PointerRNA WM_operator_properties_create_ptr(wmOperatorType *ot)
void rgb_to_hsv_compat_v(const float rgb[3], float r_hsv[3])
std::string RNA_property_string_get(PointerRNA *ptr, PropertyRNA *prop)
bool RNA_property_enum_value(bContext *C, PointerRNA *ptr, PropertyRNA *prop, const char *identifier, int *r_value)
MINLINE void sub_v2_v2v2(float r[2], const float a[2], const float b[2])
float RNA_property_float_get_default_index(PointerRNA *ptr, PropertyRNA *prop, int index)
void BKE_curvemapping_copy_data_single(CurveMapping *target, const CurveMapping *cumap, int to_idx, int from_idx, bool make_copy)
MINLINE int len_manhattan_v2v2_int(const int a[2], const int b[2]) ATTR_WARN_UNUSED_RESULT
wmWindow * CTX_wm_window(const bContext *C)
bool WM_stereo3d_enabled(wmWindow *win, bool skip_stereo3d_check)
char * BLI_strdupn(const char *str, size_t len) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
int WM_event_drag_threshold(const wmEvent *event)
MINLINE int max_ii(int a, int b)
void RNA_property_boolean_set_array(PointerRNA *ptr, PropertyRNA *prop, const bool *values)
ATTR_WARN_UNUSED_RESULT const BMVert * v
void BKE_curveprofile_remove_by_flag(struct CurveProfile *profile, short flag)
void WM_tooltip_clear(bContext *C, wmWindow *win)
int isect_point_tri_v2(const float pt[2], const float v1[2], const float v2[2], const float v3[2])
void BKE_curveprofile_copy_data(struct CurveProfile *target, const struct CurveProfile *profile)
void ED_region_tag_redraw(ARegion *region)
MINLINE float cube_f(float a)
std::optional< UndoEncodeHints > ED_undo_is_legacy_compatible_for_property(bContext *C, ID *id, const PointerRNA &ptr, const PropertyRNA &prop)
void WM_event_free_ui_handler_all(bContext *C, ListBaseT< wmEventHandler > *handlers, wmUIHandlerFunc handle_fn, wmUIHandlerRemoveFunc remove_fn)
const char * BKE_unit_display_name_short_get(const void *usys_pt, int index)
MINLINE void mul_v3_fl(float r[3], float f)
MINLINE float pow2f(float x)
AnimationEvalContext BKE_animsys_eval_context_construct(Depsgraph *depsgraph, float eval_time) ATTR_WARN_UNUSED_RESULT
void void BLI_linklist_prepend(LinkNode **listp, void *ptr) ATTR_NONNULL(1)
void BKE_curvemap_activate_nearest_point(struct CurveMap *cuma, const int i_last)
void WM_tooltip_timer_clear(bContext *C, wmWindow *win)
float dist_squared_to_line_segment_v2(const float p[2], const float l1[2], const float l2[2])
const char * WM_key_event_string(const short type, const bool compact)
bool RNA_property_boolean_get(PointerRNA *ptr, PropertyRNA *prop)
bool RNA_property_array_check(PropertyRNA *prop)
void BKE_brush_tag_unsaved_changes(Brush *brush)
void RNA_property_int_set(PointerRNA *ptr, PropertyRNA *prop, int value)
bool BLI_rctf_isect_rect_x(const struct rctf *src1, const struct rctf *src2, float range_x[2])
PropertyType RNA_property_type(PropertyRNA *prop)
bool WM_event_is_tablet(const wmEvent *event)
int BLI_findindex(const ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
std::string WM_operator_pystring_ex(bContext *C, wmOperator *op, const bool all_args, const bool macro_args, wmOperatorType *ot, PointerRNA *opptr)
void BLI_linklist_freeN(LinkNode *list)
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
VecBase< int32_t, 2 > int2
void BKE_curvemapping_free_data_single(CurveMapping *cumap, int index)
VecBase< float, 2 > float2
void WM_tooltip_refresh(bContext *C, wmWindow *win)
void RNA_property_string_set(PointerRNA *ptr, PropertyRNA *prop, const char *value)
void * MEM_new_zeroed(size_t len, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1) ATTR_NONNULL(2)
int BKE_preffered_unit_of_type_or_base_get(const UnitSettings &settings, int type)
MINLINE void add_v2_v2(float r[2], const float a[2])
void ED_region_tag_refresh_ui(ARegion *region)
BLI_INLINE int BLI_rcti_cent_y(const struct rcti *rct)
bool BKE_curveprofile_move_handle(struct CurveProfilePoint *point, bool handle_1, bool snap, const float delta[2])
void WM_cursor_grab_enable(wmWindow *win, const eWM_CursorWrapAxis wrap, const rcti *wrap_region, const bool hide)
char * WM_clipboard_text_get_firstline(bool selection, bool ensure_utf8, int *r_len)
void BLI_remlink(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
float BKE_scene_frame_get(const Scene *scene)
void hsv_to_rgb_v(const float hsv[3], float r_rgb[3])
void BKE_report(ReportList *reports, eReportType type, const char *message)
MovieTrackingMarker * BKE_tracking_marker_ensure(MovieTrackingTrack *track, int framenr)
BMesh const char void * data
void hsv_clamp_v(float hsv[3], float v_max)
BLI_INLINE float BLI_rctf_size_y(const struct rctf *rct)
wmWindowManager * CTX_wm_manager(const bContext *C)
bool BLI_rctf_isect_pt(const struct rctf *rect, float x, float y)
bool RNA_property_boolean_get_index(PointerRNA *ptr, PropertyRNA *prop, int index)
void ED_undo_push(bContext *C, const char *str, UndoEncodeHints hints=UndoEncodeHints(0))
BLI_INLINE void IMB_colormanagement_srgb_to_scene_linear_v3(float scene_linear[3], const float srgb[3])
int BLI_str_rstrip_float_zero(char *str, char pad) ATTR_NONNULL(1)
void BKE_brush_color_set(Paint *paint, Brush *brush, const float3 &color)
int RNA_property_flag(PropertyRNA *prop)
void BKE_curvemapping_changed(CurveMapping *cumap, bool rem_doubles)
MINLINE size_t min_zz(size_t a, size_t b)
void WM_cursor_modal_restore(wmWindow *win)
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
void CTX_free(bContext *C)
constexpr size_t ARRAY_SIZE(const T(&arg)[N]) noexcept
MovieClip * CTX_data_edit_movieclip(const bContext *C)
bool BLI_str_cursor_step_prev_utf8(const char *str, int str_maxlen, int *pos)
PanelType * WM_paneltype_find(const StringRef idname, bool quiet)
@ PROF_UPDATE_REMOVE_DOUBLES
int BKE_curvemapping_num_channels(const CurveMapping *cumap)
void WM_global_report(eReportType type, const char *message)
MINLINE float sqrt3f(float f)
void RNA_property_float_set_array_at_most(PointerRNA *ptr, PropertyRNA *prop, const float *values, int values_num)
ATTR_WARN_UNUSED_RESULT const size_t num
void BKE_unit_system_get(int system, int type, const void **r_usys_pt, int *r_len)
void BKE_colorband_update_sort(ColorBand *coba)
const char int BLI_str_utf8_size_or_error(const char *p) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void rgb_to_hsl_compat_v(const float rgb[3], float r_hsl[3])
void WM_cursor_grab_disable(wmWindow *win, const int mouse_ungrab_xy[2])
void CTX_wm_region_popup_set(bContext *C, ARegion *region_popup)
bool BKE_unit_string_contains_unit(const char *str, int type)
bool BKE_unit_is_valid(int system, int type)
MINLINE void zero_v3(float r[3])
void dist_ensure_v2_v2fl(float v1[2], const float v2[2], float dist)
MINLINE float dot_v2v2(const float a[2], const float b[2]) ATTR_WARN_UNUSED_RESULT
BLI_INLINE int BLI_rcti_size_x(const struct rcti *rct)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
struct CurveProfilePoint * BKE_curveprofile_insert(struct CurveProfile *profile, float x, float y)
void BKE_palette_color_remove(Palette *palette, PaletteColor *color)
bool RNA_property_enum_item_from_value(bContext *C, PointerRNA *ptr, PropertyRNA *prop, const int value, EnumPropertyItem *r_item)
int BKE_curveprofile_table_size(const struct CurveProfile *profile)
void hsl_to_rgb_v(const float hsl[3], float r_rgb[3])
float BKE_movieclip_remap_scene_to_clip_frame(const MovieClip *clip, float framenr)
CBData * BKE_colorband_element_add(ColorBand *coba, float position)
float RNA_property_float_get(PointerRNA *ptr, PropertyRNA *prop)
MINLINE float normalize_v3(float n[3])
PropertySubType RNA_property_subtype(PropertyRNA *prop)
wmOperatorType * WM_operatortype_find(const char *idname, bool quiet)
MINLINE float len_squared_v2(const float v[2]) ATTR_WARN_UNUSED_RESULT
MINLINE float len_manhattan_v2v2(const float a[2], const float b[2]) ATTR_WARN_UNUSED_RESULT
bool hex_to_rgba(const char *hexcol, float *r_r, float *r_g, float *r_b, float *r_a)
MINLINE bool compare_v3v3(const float v1[3], const float v2[3], float limit) ATTR_WARN_UNUSED_RESULT
float RNA_property_float_get_default(PointerRNA *ptr, PropertyRNA *prop)
void BKE_curvemapping_free_data(CurveMapping *cumap)
void WM_operator_stack_clear(wmWindowManager *wm)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void BLI_rctf_transform_pt_v(const rctf *dst, const rctf *src, float xy_dst[2], const float xy_src[2])
Main * CTX_data_main(const bContext *C)
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)
char * WM_clipboard_text_get(bool selection, bool ensure_utf8, int *r_len)
StructRNA * RNA_struct_base(StructRNA *type)
bool BLI_rctf_clamp_pt_v(const struct rctf *rect, float xy[2])
void BLI_str_cursor_step_utf8(const char *str, int str_maxlen, int *pos, eStrCursorJumpDirection direction, eStrCursorJumpType jump, bool use_init_step)
Paint * BKE_paint_get_active_from_context(const bContext *C)
MINLINE float max_ff(float a, float b)
@ USER_FLAG_RECENT_SEARCHES_DISABLE
MINLINE float len_v2v2(const float v1[2], const float v2[2]) ATTR_WARN_UNUSED_RESULT
MINLINE float normalize_v3_length(float n[3], float unit_length)
void WM_clipboard_text_set(const char *buf, bool selection)
BLI_INLINE float BLI_rctf_cent_y(const struct rctf *rct)
void WM_event_remove_ui_handler(ListBaseT< wmEventHandler > *handlers, wmUIHandlerFunc handle_fn, wmUIHandlerRemoveFunc remove_fn, void *user_data, const bool postpone)
void WM_gestures_remove(wmWindow *win)
bool BPY_string_compile_check(const char *expr)
ARegion * CTX_wm_region_popup(const bContext *C)
CurveMapPoint * BKE_curvemap_insert(CurveMap *cuma, float x, float y)
int BLI_path_sequence_decode(const char *path, char *head, size_t head_maxncpy, char *tail, size_t tail_maxncpy, unsigned short *r_digits_len)
int RNA_property_int_get_default(PointerRNA *ptr, PropertyRNA *prop)
void RNA_property_enum_set(PointerRNA *ptr, PropertyRNA *prop, int value)
int WM_event_absolute_delta_y(const wmEvent *event)
MINLINE float square_f(float a)
void RNA_property_float_get_default_array(PointerRNA *ptr, PropertyRNA *prop, float *values)
size_t BLF_str_offset_from_cursor_position(int fontid, const char *str, size_t str_len, int location_x) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(2)
void BLI_path_sequence_encode(char *path, size_t path_maxncpy, const char *head, const char *tail, unsigned short numlen, int pic)
void CTX_wm_manager_set(bContext *C, wmWindowManager *wm)
void BLI_rctf_translate(struct rctf *rect, float x, float y)
Brush * BKE_paint_brush(Paint *paint)
double BLI_time_now_seconds()
bool BKE_curveprofile_move_point(struct CurveProfile *profile, struct CurveProfilePoint *point, bool snap, const float delta[2])
void RNA_property_boolean_set(PointerRNA *ptr, PropertyRNA *prop, bool value)
Scene * CTX_data_scene(const bContext *C)
int BLI_sortutil_cmp_int(const void *a_, const void *b_)
bScreen * CTX_wm_screen(const bContext *C)
void CTX_wm_region_set(bContext *C, ARegion *region)
bool BLI_rctf_isect_rect_y(const struct rctf *src1, const struct rctf *src2, float range_y[2])
void CTX_data_main_set(bContext *C, Main *bmain)
void WM_cursor_set(wmWindow *win, int curs)
void WM_event_timer_remove(wmWindowManager *wm, wmWindow *, wmTimer *timer)
MINLINE void copy_v4_v4(float r[4], const float a[4])
void RNA_property_int_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, int value)
void RNA_property_float_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, float value)
wmTimer * WM_event_timer_add(wmWindowManager *wm, wmWindow *win, const wmEventType event_type, const double time_step)
MINLINE float len_v2(const float v[2]) ATTR_WARN_UNUSED_RESULT
bool WM_cursor_modal_is_set_ok(const wmWindow *win)
BLI_INLINE int BLI_rcti_cent_x(const struct rcti *rct)
size_t BLI_strlen_utf8(const char *strc) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
int BLI_str_rstrip_digits(char *str) ATTR_NONNULL()
void RNA_property_boolean_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, bool value)
void CTX_store_set(bContext *C, const bContextStore *store)
ReportList * CTX_wm_reports(const bContext *C)
void WM_event_add_mousemove(wmWindow *win)
void WM_cursor_warp(wmWindow *win, int x, int y)
MINLINE float len_squared_v2v2(const float a[2], const float b[2]) ATTR_WARN_UNUSED_RESULT
int RNA_property_int_get(PointerRNA *ptr, PropertyRNA *prop)
bool BLI_rctf_isect_y(const rctf *rect, float y)
void RNA_property_int_range(PointerRNA *ptr, PropertyRNA *prop, int *hardmin, int *hardmax)
int RNA_property_int_get_default_index(PointerRNA *ptr, PropertyRNA *prop, int index)
bScreen * WM_window_get_active_screen(const wmWindow *win)
size_t BLI_snprintf_utf8_rlen(char *__restrict dst, size_t dst_maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
void BKE_curveprofile_update(struct CurveProfile *profile, int update_flags)
MINLINE int min_ii(int a, int b)
MINLINE float normalize_v2_v2(float r[2], const float a[2])
void WM_tooltip_immediate_init(bContext *C, wmWindow *win, ScrArea *area, ARegion *region, wmTooltipInitFn init)
ARegion * CTX_wm_region(const bContext *C)
void ED_workspace_status_text(bContext *C, const char *str)
PaintMode BKE_paintmode_get_active_from_context(const bContext *C)
bool BLI_rctf_isect_segment(const struct rctf *rect, const float s1[2], const float s2[2])
void ED_region_tag_redraw_no_rebuild(ARegion *region)
BLI_INLINE float BLI_rctf_cent_x(const struct rctf *rct)
void BKE_curveprofile_free_data(struct CurveProfile *profile)
MINLINE bool is_zero_v3(const float v[3]) ATTR_WARN_UNUSED_RESULT
int BLI_str_utf8_invalid_strip(char *str, size_t str_len) ATTR_NONNULL(1)
void BKE_curveprofile_activate_nearest_point(struct CurveProfile *profile, const int i_last)
int RNA_property_int_get_index(PointerRNA *ptr, PropertyRNA *prop, int index)
void BLI_rctf_pad(struct rctf *rect, float pad_x, float pad_y)
void wm_event_init_from_window(wmWindow *win, wmEvent *event)
void wm_event_free_handler(wmEventHandler *handler)
size_t BLI_strnlen_utf8_ex(const char *strc, size_t strc_maxlen, size_t *r_len_bytes) ATTR_NONNULL(1
void RNA_property_float_range(PointerRNA *ptr, PropertyRNA *prop, float *hardmin, float *hardmax)
void * MEM_new_array_zeroed(size_t len, size_t size, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1
MINLINE float clamp_f(float value, float min, float max)
void wm_event_handler_ui_cancel_ex(bContext *C, wmWindow *win, ARegion *region, bool reactivate_button)
void CTX_wm_area_set(bContext *C, ScrArea *area)
void BLI_str_cursor_step_bounds_utf8(const char *str, int str_maxlen, int pos, int *r_start, int *r_end)
void WM_operator_name_call_ptr_with_depends_on_cursor(bContext *C, wmOperatorType *ot, wm::OpCallContext opcontext, PointerRNA *properties, const wmEvent *event, const StringRef drawstr)
vector snap(vector a, vector b)
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
ListBaseT< uiList > ui_lists
bke::ARegionRuntime * runtime
eCurveProfilePoint_Flag flag
CurveProfilePoint * table
ListBaseT< wmWindowManager > wm
struct MovieTrackingTrack * track
struct MovieTrackingMarker * marker
ListBaseT< PaletteColor > colors
char idname[BKE_ST_MAXNAME]
Vector< AncestorPointerRNA, ANCESTOR_POINTERRNA_DEFAULT_SIZE > ancestors
ListBaseT< ARegion > regionbase
std::variant< PointerRNA, std::string, int64_t > value
Vector< bContextStoreEntry > entries
struct ARegion * active_region
ListBaseT< struct ScrArea > areabase
ListBaseT< ARegion > regionbase
struct wmTooltipState * tool_tip
ListBaseT< ui::Block > uiblocks
ListBaseT< wmEventHandler > handlers
bool ime_data_is_composing
ListBaseT< wmEventHandler > modalhandlers
int * items_filter_neworder
BlockInteraction_Handle * custom_interaction_handle
wm::OpCallContext opcontext
std::optional< bContextStore > context
ButtonArgNFree func_argN_free_fn
std::function< void(bContext &, StringRefNull)> rename_func
std::function< void(bContext &)> apply_func
BlockInteraction_CallbackData custom_interaction_callbacks
UndoEncodeHints undo_hints
std::function< void(StringRefNull)> rename_full_func
char undostr[BKE_UNDO_STR_MAX]
std::shared_ptr< void > search_arg
BlockHandleFunc handle_func
std::string rename_full_new
BlockInteractionBeginFn begin_fn
BlockInteractionEndFn end_fn
BlockInteractionUpdateFn update_fn
BlockInteraction_Params params
uint unique_retval_ids_len
ListBaseT< ViewLink > views
int but_index(const Button *but) const
ListBaseT< SafetyRect > saferct
int(*) block_event_func(const bContext *C, Block *, const wmEvent *)
Vector< std::unique_ptr< Button > > buttons_ptrs
Button * prev_but(const Button *but) const
std::ranges::transform_view< std::ranges::ref_view< const Vector< std::unique_ptr< Button > > >, Button &(*)(const std::unique_ptr< Button > &)> buttons() const
BlockHandleFunc handle_func
const UnitSettings * unit
Button * next_but(const Button *but) const
std::unique_ptr< PieMenuData > pie_data
PopupBlockHandle * handle
BlockInteraction_CallbackData custom_interaction_callbacks
int visible_lines() const
void line_scroll_set(int line_scroll)
std::unique_ptr< TextWrapCache > wrap_cache
float luminosity_lock_value
wmTimer * keep_open_timer
void(*) cancel_func(bContext *C, void *arg)
void(*) popup_func(bContext *C, void *arg, int event)
PopupBlockCreate popup_create_vars
ARegion * ctx_region_popup
UndoStack_Text * undo_stack_text
Vector< uiSelectContextElem > elems
wmUIHandlerRemoveFunc remove_fn
wmUIHandlerFunc handle_fn
eWM_EventHandlerFlag flag
eWM_EventHandlerType type
wmEventType prev_press_type
wmEventModifierFlag modifier
wm::OpCallContext opcontext
bool(*) check(bContext *C, wmOperator *op)
struct wmOperatorType * type
bke::WindowRuntime * runtime
short pie_event_type_lock
short pie_event_type_last
#define ISMOUSE_BUTTON(event_type)
#define ISMOUSE_MOTION(event_type)
#define ISTIMER(event_type)
#define ISKEYBOARD(event_type)
#define ISHOTKEY(event_type)