44 const int str_maxncpy,
46 const int flag_data_len,
51 for (
int i = 0; i < flag_data_len; i++) {
65 const char **r_type_id,
66 const char **r_val_id)
78 const char *unknown =
"UNKNOWN";
79 const char *type_id = unknown;
80 const char *val_id = unknown;
81 const char *prev_type_id = unknown;
82 const char *prev_val_id = unknown;
87 char modifier_id[128];
111 "wmEvent type:%d/%s, val:%d/%s, "
112 "prev_type:%d/%s, prev_val:%d/%s, "
113 "modifier=%s, keymodifier:%d, flag:%s, "
114 "mouse:(%d,%d), utf8:'%.*s', pointer:%p",
130 (
const void *)event);
132#ifdef WITH_INPUT_NDOF
133 if (
ISNDOF(event->type)) {
134 const wmNDOFMotionData *ndof =
static_cast<const wmNDOFMotionData *
>(
event->customdata);
136 printf(
", ndof: rot: (%.4f %.4f %.4f), tx: (%.4f %.4f %.4f), dt: %.4f, progress: %d",
150 printf(
", tablet: active: %d, pressure %.4f, tilt: (%.4f %.4f)",
159 printf(
"wmEvent - nullptr\n");
224 const short init_event_type,
225 const short init_event_val)
268 const int delta[2] = {
269 event->xy[0] -
event->prev_press_xy[0],
270 event->xy[1] -
event->prev_press_xy[1],
279 else if (theta == 1) {
282 else if (theta == 2) {
285 else if (theta == 3) {
288 else if (theta == -1) {
291 else if (theta == -2) {
294 else if (theta == -3) {
304 printf(
"tweak north-east\n");
310 printf(
"tweak south-east\n");
316 printf(
"tweak south-west\n");
322 printf(
"tweak north-west\n");
330 static int mval_prev[2] = {-1, -1};
391 drag_threshold =
U.drag_threshold_tablet;
394 drag_threshold =
U.drag_threshold_mouse;
399 drag_threshold =
U.drag_threshold;
407 return abs(drag_delta[0]) > drag_threshold ||
abs(drag_delta[1]) > drag_threshold;
420 r_mval[0] =
xy[0] - region->winrct.xmin;
421 r_mval[1] =
xy[1] - region->winrct.ymin;
427 r_mval[0] =
xy[0] - region->winrct.xmin;
428 r_mval[1] =
xy[1] - region->winrct.ymin;
445 return event->utf8_buf[0];
486#ifdef WITH_INPUT_NDOF
488void WM_event_ndof_pan_get(
const wmNDOFMotionData *ndof,
float r_pan[3],
const bool use_zoom)
493 r_pan[2] = ndof->tvec[2] * ((
U.ndof_flag & z_flag) ? -1.0f : 1.0f);
496void WM_event_ndof_rotate_get(
const wmNDOFMotionData *ndof,
float r_rot[3])
503float WM_event_ndof_to_axis_angle(
const wmNDOFMotionData *ndof,
float axis[3])
512 return ndof->dt *
angle;
515void WM_event_ndof_to_quat(
const wmNDOFMotionData *ndof,
float q[4])
520 angle = WM_event_ndof_to_axis_angle(ndof, axis);
532bool WM_event_is_xr(
const wmEvent *event)
546 if (
U.pressure_threshold_max != 0.0f) {
547 raw_pressure /=
U.pressure_threshold_max;
550 CLAMP(raw_pressure, 0.0f, 1.0f);
552 if (
U.pressure_softness != 0.0f) {
553 raw_pressure =
powf(raw_pressure,
powf(4.0f, -
U.pressure_softness));
562 r_tilt[0] =
event->tablet.x_tilt;
563 r_tilt[1] =
event->tablet.y_tilt;
570 return event->tablet.pressure;
590 int dx =
event->xy[0] -
event->prev_xy[0];
601 int dy =
event->xy[1] -
event->prev_xy[1];
617bool WM_event_is_ime_switch(
const wmEvent *event)
MINLINE int round_fl_to_int(float a)
void axis_angle_to_quat(float r[4], const float axis[3], float angle)
MINLINE void sub_v2_v2v2_int(int r[2], const int a[2], const int b[2])
MINLINE void copy_v2_v2_int(int r[2], const int a[2])
MINLINE int len_manhattan_v2v2_int(const int a[2], const int b[2]) ATTR_WARN_UNUSED_RESULT
MINLINE float normalize_v3_v3(float r[3], const float a[3])
char char size_t BLI_strncpy_rlen(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
int BLI_str_utf8_size_or_error(const char *p) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
These structs are the foundation for all linked lists in the library system.
static double angle(const Eigen::Vector3d &v1, const Eigen::Vector3d &v2)
@ WM_EVENT_FORCE_DRAG_THRESHOLD
@ WM_EVENT_IS_CONSECUTIVE
#define WM_EVENT_CURSOR_MOTION_THRESHOLD
bool RNA_enum_identifier(const EnumPropertyItem *item, const int value, const char **r_identifier)
const EnumPropertyItem rna_enum_event_value_items[]
const EnumPropertyItem rna_enum_event_type_items[]
int event_queue_consecutive_gesture_xy[2]
ccl_device_inline int abs(int x)
float WM_event_tablet_data(const wmEvent *event, bool *r_pen_flip, float r_tilt[2])
float wm_pressure_curve(float raw_pressure)
bool WM_event_consecutive_gesture_test_break(const wmWindow *win, const wmEvent *event)
bool WM_event_drag_test_with_delta(const wmEvent *event, const int drag_delta[2])
static void event_ids_from_flag(char *str, const int str_maxncpy, const FlagIdentifierPair *flag_data, const int flag_data_len, const uint flag)
int WM_event_drag_direction(const wmEvent *event)
int WM_event_absolute_delta_y(const wmEvent *event)
void WM_event_print(const wmEvent *event)
bool WM_event_drag_test(const wmEvent *event, const int prev_xy[2])
int WM_userdef_event_map(int kmitype)
void WM_event_drag_start_mval_fl(const wmEvent *event, const ARegion *region, float r_mval[2])
bool WM_event_is_mouse_drag(const wmEvent *event)
bool WM_event_consecutive_gesture_test(const wmEvent *event)
bool WM_event_type_mask_test(const int event_type, const enum eEventType_Mask mask)
void WM_event_drag_start_mval(const wmEvent *event, const ARegion *region, int r_mval[2])
void WM_event_drag_start_xy(const wmEvent *event, int r_xy[2])
char WM_event_utf8_to_ascii(const wmEvent *event)
bool WM_event_is_mouse_drag_or_press(const wmEvent *event)
bool WM_event_is_modal_drag_exit(const wmEvent *event, const short init_event_type, const short init_event_val)
int WM_event_absolute_delta_x(const wmEvent *event)
static void event_ids_from_type_and_value(const short type, const short val, const char **r_type_id, const char **r_val_id)
int WM_userdef_event_type_from_keymap_type(int kmitype)
bool WM_event_is_tablet(const wmEvent *event)
bool WM_cursor_test_motion_and_update(const int mval[2])
int WM_event_drag_threshold(const wmEvent *event)
#define ISMOUSE_BUTTON(event_type)
#define ISKEYBOARD_OR_BUTTON(event_type)
#define ISMOUSE_MOTION(event_type)
#define ISMOUSE_WHEEL(event_type)
@ EVT_TYPE_MASK_ACTIONZONE
@ EVT_TYPE_MASK_KEYBOARD_MODIFIER
@ EVT_TYPE_MASK_MOUSE_WHEEL
@ EVT_TYPE_MASK_MOUSE_GESTURE
#define ISKEYMODIFIER(event_type)
#define IS_EVENT_ACTIONZONE(event_type)
#define ISMOUSE_GESTURE(event_type)
#define ISKEYBOARD(event_type)
#define ISNDOF(event_type)
#define ISMOUSE(event_type)