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];
113 "wmEvent type:%d/%s, val:%d/%s, "
114 "prev_type:%d/%s, prev_val:%d/%s, "
115 "modifier=%s, keymodifier:%d, flag:%s, "
116 "mouse:(%d,%d), utf8:'%.*s', pointer:%p",
132 (
const void *)event);
134#ifdef WITH_INPUT_NDOF
135 if (
ISNDOF(event->type)) {
136 const wmNDOFMotionData &ndof = *
static_cast<const wmNDOFMotionData *
>(
event->customdata);
138 const char *ndof_progress = unknown;
140# define CASE_NDOF_PROGRESS(id) \
142 ndof_progress = STRINGIFY(id); \
145 switch (ndof.progress) {
146 CASE_NDOF_PROGRESS(NOT_STARTED);
147 CASE_NDOF_PROGRESS(STARTING);
148 CASE_NDOF_PROGRESS(IN_PROGRESS);
149 CASE_NDOF_PROGRESS(FINISHING);
150 CASE_NDOF_PROGRESS(FINISHED);
152# undef CASE_NDOF_PROGRESS
156 "rot: (%.4f %.4f %.4f), "
157 "tx: (%.4f %.4f %.4f), "
173 printf(
", tablet: active: %d, pressure %.4f, tilt: (%.4f %.4f)",
182 printf(
"wmEvent - nullptr\n");
247 const short init_event_type,
248 const short init_event_val)
291 const int delta[2] = {
292 event->xy[0] -
event->prev_press_xy[0],
293 event->xy[1] -
event->prev_press_xy[1],
302 else if (theta == 1) {
305 else if (theta == 2) {
308 else if (theta == 3) {
311 else if (theta == -1) {
314 else if (theta == -2) {
317 else if (theta == -3) {
327 printf(
"tweak north-east\n");
333 printf(
"tweak south-east\n");
339 printf(
"tweak south-west\n");
345 printf(
"tweak north-west\n");
353 static int mval_prev[2] = {-1, -1};
414 drag_threshold =
U.drag_threshold_tablet;
417 drag_threshold =
U.drag_threshold_mouse;
422 drag_threshold =
U.drag_threshold;
430 return abs(drag_delta[0]) > drag_threshold ||
abs(drag_delta[1]) > drag_threshold;
468 return event->utf8_buf[0];
509#ifdef WITH_INPUT_NDOF
511static blender::float3 event_ndof_translation_get_with_sign(
const wmNDOFMotionData &ndof,
514 int ndof_flag =
U.ndof_flag;
515 int x = 0,
y = 1,
z = 2;
528static blender::float3 event_ndof_rotation_get_with_sign(
const wmNDOFMotionData &ndof,
531 int ndof_flag =
U.ndof_flag;
532 int x = 0,
y = 1,
z = 2;
545blender::float3 WM_event_ndof_translation_get_for_navigation(
const wmNDOFMotionData &ndof)
548 return event_ndof_translation_get_with_sign(ndof,
sign);
551blender::float3 WM_event_ndof_rotation_get_for_navigation(
const wmNDOFMotionData &ndof)
554 return event_ndof_rotation_get_with_sign(ndof,
sign);
557blender::float3 WM_event_ndof_translation_get(
const wmNDOFMotionData &ndof)
559 return event_ndof_translation_get_with_sign(ndof, 1.0f);
562blender::float3 WM_event_ndof_rotation_get(
const wmNDOFMotionData &ndof)
564 return event_ndof_rotation_get_with_sign(ndof, 1.0f);
567float WM_event_ndof_rotation_get_axis_angle_for_navigation(
const wmNDOFMotionData &ndof,
570 const blender::float3 rvec = WM_event_ndof_rotation_get_for_navigation(ndof);
574float WM_event_ndof_rotation_get_axis_angle(
const wmNDOFMotionData &ndof,
float axis[3])
580bool WM_event_ndof_translation_has_pan(
const wmNDOFMotionData &ndof)
582 return (
U.ndof_flag &
NDOF_SWAP_YZ_AXIS) ? ((ndof.tvec[0] != 0.0f) || (ndof.tvec[2] != 0.0f)) :
583 ((ndof.tvec[0] != 0.0f) || (ndof.tvec[1] != 0.0f));
586bool WM_event_ndof_translation_has_zoom(
const wmNDOFMotionData &ndof)
600bool WM_event_is_xr(
const wmEvent *event)
614 if (
U.pressure_threshold_max != 0.0f) {
615 raw_pressure /=
U.pressure_threshold_max;
618 CLAMP(raw_pressure, 0.0f, 1.0f);
620 if (
U.pressure_softness != 0.0f) {
621 raw_pressure =
powf(raw_pressure,
powf(4.0f, -
U.pressure_softness));
637 return event->tablet.pressure;
657 int dx =
event->xy[0] -
event->prev_xy[0];
668 int dy =
event->xy[1] -
event->prev_xy[1];
684bool WM_event_is_ime_switch(
const wmEvent *event)
MINLINE int round_fl_to_int(float a)
MINLINE void sub_v2_v2v2_int(int r[2], const int a[2], const int b[2])
MINLINE void copy_v2_v2(float r[2], const float a[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
const char int BLI_str_utf8_size_or_error(const char *p) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
@ NDOF_NAVIGATION_MODE_OBJECT
@ WM_EVENT_FORCE_DRAG_THRESHOLD
@ WM_EVENT_IS_CONSECUTIVE
#define WM_EVENT_CURSOR_MOTION_THRESHOLD
SIMD_FORCE_INLINE const btScalar & z() const
Return the z value.
ccl_device_inline float2 mask(const MaskType mask, const float2 a)
VecBase< float, 3 > float3
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[]
wmEventModifierFlag modifier
wmEventType prev_press_type
int event_queue_consecutive_gesture_xy[2]
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)