|
Blender V4.3
|
#include <cstdlib>#include <cstring>#include "DNA_listBase.h"#include "DNA_screen_types.h"#include "DNA_userdef_types.h"#include "DNA_windowmanager_types.h"#include "BLI_blenlib.h"#include "BLI_math_rotation.h"#include "BLI_math_vector.h"#include "BLI_utildefines.h"#include "RNA_access.hh"#include "WM_api.hh"#include "WM_types.hh"#include "wm_event_system.hh"#include "wm_event_types.hh"#include "RNA_enum_types.hh"Go to the source code of this file.
Classes | |
| struct | FlagIdentifierPair |
Functions | |
Event Printing | |
| static void | event_ids_from_flag (char *str, const int str_maxncpy, const FlagIdentifierPair *flag_data, const int flag_data_len, const uint flag) |
| static void | event_ids_from_type_and_value (const short type, const short val, const char **r_type_id, const char **r_val_id) |
| void | WM_event_print (const wmEvent *event) |
Event Modifier/Type Queries | |
| bool | WM_event_type_mask_test (const int event_type, const enum eEventType_Mask mask) |
Event Motion Queries | |
| bool | WM_event_is_modal_drag_exit (const wmEvent *event, const short init_event_type, const short init_event_val) |
| bool | WM_event_is_mouse_drag (const wmEvent *event) |
| bool | WM_event_is_mouse_drag_or_press (const wmEvent *event) |
| int | WM_event_drag_direction (const wmEvent *event) |
| bool | WM_cursor_test_motion_and_update (const int mval[2]) |
Event Consecutive Checks | |
| bool | WM_event_consecutive_gesture_test (const wmEvent *event) |
| bool | WM_event_consecutive_gesture_test_break (const wmWindow *win, const wmEvent *event) |
Event Click/Drag Checks | |
Values under this limit are detected as clicks. | |
| int | WM_event_drag_threshold (const wmEvent *event) |
| bool | WM_event_drag_test_with_delta (const wmEvent *event, const int drag_delta[2]) |
| bool | WM_event_drag_test (const wmEvent *event, const int prev_xy[2]) |
| void | WM_event_drag_start_mval (const wmEvent *event, const ARegion *region, int r_mval[2]) |
| void | WM_event_drag_start_mval_fl (const wmEvent *event, const ARegion *region, float r_mval[2]) |
| void | WM_event_drag_start_xy (const wmEvent *event, int r_xy[2]) |
Event Text Queries | |
| char | WM_event_utf8_to_ascii (const wmEvent *event) |
Event Preference Mapping | |
| int | WM_userdef_event_map (int kmitype) |
| int | WM_userdef_event_type_from_keymap_type (int kmitype) |
Event Tablet Input Access | |
| float | wm_pressure_curve (float raw_pressure) |
| float | WM_event_tablet_data (const wmEvent *event, bool *r_pen_flip, float r_tilt[2]) |
| bool | WM_event_is_tablet (const wmEvent *event) |
Event Scroll's Absolute Deltas | |
User may change the scroll behavior, and the deltas are automatically inverted. These functions return the absolute direction, swipe up/right gives positive values. | |
| int | WM_event_absolute_delta_x (const wmEvent *event) |
| int | WM_event_absolute_delta_y (const wmEvent *event) |
Read-only queries utility functions for the event system.
Definition in file wm_event_query.cc.
|
static |
Definition at line 43 of file wm_event_query.cc.
References BLI_strncpy_rlen(), flag, str, and UNUSED_VARS.
Referenced by WM_event_print().
|
static |
Definition at line 63 of file wm_event_query.cc.
References rna_enum_event_type_items, rna_enum_event_value_items, and RNA_enum_identifier().
Referenced by WM_event_print().
| bool WM_cursor_test_motion_and_update | ( | const int | mval[2] | ) |
Detect motion between selection (callers should only use this for selection picking), typically mouse press/click events.
| mval | Region relative coordinates, call with (-1, -1) resets the last cursor location. |
NOTE(@ideasman42): The logic used here isn't foolproof. It's possible that users move the cursor past WM_EVENT_CURSOR_MOTION_THRESHOLD then back to a position within the threshold (between mouse clicks). In practice users never reported this since the threshold is very small (a few pixels). To prevent the unlikely case of values matching from another region, changing regions resets this value to (-1, -1).
Definition at line 328 of file wm_event_query.cc.
References copy_v2_v2_int(), len_manhattan_v2v2_int(), and WM_EVENT_CURSOR_MOTION_THRESHOLD.
Referenced by ED_screen_set_active_region(), get_nearest_editbonepoint(), mixed_bones_object_selectbuffer_extended(), seq_select_seq_from_preview(), and unified_findnearest().
Definition at line 588 of file wm_event_query.cc.
References wmEvent::flag, and WM_EVENT_SCROLL_INVERT.
Referenced by view_zoomdrag_invoke().
Definition at line 599 of file wm_event_query.cc.
References wmEvent::flag, and WM_EVENT_SCROLL_INVERT.
Referenced by ui_pan_to_scroll(), and view_zoomdrag_invoke().
| bool WM_event_consecutive_gesture_test | ( | const wmEvent * | event | ) |
Return true if this event type is a candidate for being flagged as consecutive.
See: WM_EVENT_IS_CONSECUTIVE doc-string.
Definition at line 342 of file wm_event_query.cc.
References ISMOUSE_GESTURE, NDOF_MOTION, and wmEvent::type.
Referenced by ED_view3d_autodist_last_set(), and wm_event_do_handlers().
Return true if this event should break the chain of consecutive gestures. Practically all intentional user input should, key presses or button clicks.
Definition at line 347 of file wm_event_query.cc.
References wmWindow::event_queue_consecutive_gesture_xy, ISKEYBOARD_OR_BUTTON, ISKEYMODIFIER, ISMOUSE_MOTION, len_manhattan_v2v2_int(), wmEvent::type, WINDEACTIVATE, WM_EVENT_CURSOR_MOTION_THRESHOLD, and wmEvent::xy.
Referenced by wm_event_do_handlers().
Definition at line 266 of file wm_event_query.cc.
References atan2f, KM_DIRECTION_E, KM_DIRECTION_N, KM_DIRECTION_NE, KM_DIRECTION_NW, KM_DIRECTION_S, KM_DIRECTION_SE, KM_DIRECTION_SW, KM_DIRECTION_W, M_PI, printf, and round_fl_to_int().
Referenced by wm_handlers_do().
Definition at line 417 of file wm_event_query.cc.
References KM_CLICK_DRAG, wmEvent::prev_press_xy, and xy.
Referenced by actkeys_box_select_invoke(), graphkeys_box_select_invoke(), blender::ed::space_node::is_event_over_node_or_socket(), blender::ed::space_node::node_link_invoke(), blender::ed::space_node::node_resize_invoke(), blender::ed::space_node::node_resize_modal(), blender::ed::outliner::outliner_box_select_invoke(), blender::ed::outliner::outliner_item_activate_invoke(), blender::ed::outliner::outliner_item_drag_drop_invoke(), blender::ed::outliner::outliner_item_drag_element_find(), blender::ed::outliner::outliner_item_openclose_invoke(), sequencer_box_select_invoke(), sequencer_select_handle_invoke(), view3d_interactive_add_begin(), view3d_ruler_add_invoke(), WM_generic_select_invoke(), and wm_gizmomap_highlight_find().
Definition at line 424 of file wm_event_query.cc.
References KM_CLICK_DRAG, wmEvent::prev_press_xy, and xy.
Referenced by annotation_draw_apply_event(), gizmo_ruler_invoke(), initTransInfo(), and view3d_interactive_add_modal().
Definition at line 431 of file wm_event_query.cc.
References copy_v2_v2_int(), KM_CLICK_DRAG, wmEvent::prev_press_xy, and wmEvent::val.
Referenced by ui_list_activate_hovered_row(), ui_list_is_hovering_draggable_but(), and WM_gesture_new().
Definition at line 410 of file wm_event_query.cc.
References sub_v2_v2v2_int(), WM_event_drag_test_with_delta(), and wmEvent::xy.
Referenced by curve_pen_modal(), wm_event_is_double_click(), and wm_handlers_do().
Definition at line 404 of file wm_event_query.cc.
References abs(), and WM_event_drag_threshold().
Referenced by WM_event_drag_test(), and WM_generic_select_modal().
Definition at line 382 of file wm_event_query.cc.
References BLI_assert, ISMOUSE_BUTTON, MOUSEMOVE, wmEvent::prev_press_type, UI_SCALE_FAC, and WM_event_is_tablet().
Referenced by ui_but_drag_init(), and WM_event_drag_test_with_delta().
| bool WM_event_is_modal_drag_exit | ( | const wmEvent * | event, |
| short | init_event_type, | ||
| short | init_event_val ) |
For modal callbacks, check configuration for how to interpret exit when dragging.
Definition at line 223 of file wm_event_query.cc.
References KM_CLICK_DRAG, KM_RELEASE, wmEvent::type, USER_RELEASECONFIRM, and wmEvent::val.
Referenced by ed_marker_move_modal().
| bool WM_event_is_mouse_drag | ( | const wmEvent * | event | ) |
Definition at line 255 of file wm_event_query.cc.
References ISMOUSE_BUTTON, KM_CLICK_DRAG, wmEvent::type, and wmEvent::val.
Referenced by gizmo_tweak_invoke(), and WM_event_is_mouse_drag_or_press().
| bool WM_event_is_mouse_drag_or_press | ( | const wmEvent * | event | ) |
Definition at line 260 of file wm_event_query.cc.
References ISMOUSE_BUTTON, KM_PRESS, wmEvent::type, and WM_event_is_mouse_drag().
Referenced by WM_gesture_box_invoke(), WM_gesture_circle_invoke(), and WM_gesture_straightline_invoke().
| bool WM_event_is_tablet | ( | const wmEvent * | event | ) |
Definition at line 573 of file wm_event_query.cc.
References wmTabletData::active, EVT_TABLET_NONE, and wmEvent::tablet.
Referenced by blender::ed::sculpt_paint::paint_stroke_modal(), and WM_event_drag_threshold().
| void WM_event_print | ( | const wmEvent * | event | ) |
For debugging only, getting inspecting events manually is tedious.
Definition at line 75 of file wm_event_query.cc.
References wmTabletData::active, ARRAY_SIZE, BLI_str_utf8_size_or_error(), event_ids_from_flag(), event_ids_from_type_and_value(), EVT_TABLET_NONE, wmEvent::flag, ISNDOF, wmEvent::keymodifier, KM_ALT, KM_CTRL, KM_OSKEY, KM_SHIFT, wmEvent::modifier, NDOF_MOTION, wmTabletData::pressure, wmEvent::prev_type, wmEvent::prev_val, printf, wmEvent::type, UNPACK3, wmEvent::utf8_buf, wmEvent::val, WM_EVENT_FORCE_DRAG_THRESHOLD, WM_EVENT_IS_CONSECUTIVE, WM_EVENT_IS_REPEAT, WM_EVENT_SCROLL_INVERT, wmTabletData::x_tilt, wmEvent::xy, and wmTabletData::y_tilt.
Referenced by wm_event_add_ghostevent(), wm_event_do_handlers(), and wm_event_free().
If this is a tablet event, return tablet pressure and set *pen_flip to 1 if the eraser tool is being used, 0 otherwise.
Definition at line 559 of file wm_event_query.cc.
References EVT_TABLET_ERASER.
Referenced by blender::ed::sculpt_paint::paint_stroke_modal(), and blender::ed::sculpt_paint::filter::sculpt_mesh_filter_modal().
| bool WM_event_type_mask_test | ( | const int | event_type, |
| const enum eEventType_Mask | mask ) |
Definition at line 169 of file wm_event_query.cc.
References EVT_TYPE_MASK_ACTIONZONE, EVT_TYPE_MASK_KEYBOARD, EVT_TYPE_MASK_KEYBOARD_MODIFIER, EVT_TYPE_MASK_MOUSE, EVT_TYPE_MASK_MOUSE_GESTURE, EVT_TYPE_MASK_MOUSE_WHEEL, EVT_TYPE_MASK_NDOF, IS_EVENT_ACTIONZONE, ISKEYBOARD, ISKEYMODIFIER, ISMOUSE, ISMOUSE_GESTURE, ISMOUSE_WHEEL, and ISNDOF.
Referenced by kmi_filter_is_visible_type_mask().
| char WM_event_utf8_to_ascii | ( | const wmEvent * | event | ) |
Definition at line 442 of file wm_event_query.cc.
References BLI_str_utf8_size_or_error(), and wmEvent::utf8_buf.
Referenced by handleNumInput(), and text_line_number_invoke().
Applies the global tablet pressure correction curve.
Definition at line 544 of file wm_event_query.cc.
Referenced by wm_tablet_data_from_ghost().
Event map that takes preferences into account.
Definition at line 456 of file wm_event_query.cc.
References USER_WHEELZOOMDIR, WHEELDOWNMOUSE, WHEELINMOUSE, WHEELOUTMOUSE, and WHEELUPMOUSE.
Referenced by wm_eventmatch(), and WM_keymap_item_compare().
Use so we can check if 'wmEvent.type' is released in modal operators.
An alternative would be to add a 'wmEvent.type_nokeymap'... or similar.
Definition at line 468 of file wm_event_query.cc.
References USER_WHEELZOOMDIR, WHEELDOWNMOUSE, WHEELINMOUSE, WHEELOUTMOUSE, and WHEELUPMOUSE.
Referenced by edbm_bevel_invoke(), edbm_inset_invoke(), gizmo_tweak_invoke(), image_view_pan_init(), image_view_zoom_init(), initTransform(), blender::ed::object::object_transform_axis_target_invoke(), op_generic_value_invoke(), poselib_blend_init_data(), radial_control_invoke(), sample_color_invoke(), slide_plane_marker_customdata(), stencil_control_invoke(), view3d_interactive_add_begin(), view_pan_init(), and view_zoom_init().