|
Blender
V2.93
|
#include <stdio.h>#include <string.h>#include "GHOST_C-api.h"#include "BLI_utildefines.h"#include "BLI_sys_types.h"#include "DNA_listBase.h"#include "DNA_userdef_types.h"#include "DNA_workspace_types.h"#include "BKE_context.h"#include "BKE_global.h"#include "BKE_main.h"#include "WM_api.h"#include "WM_types.h"#include "wm_cursors.h"#include "wm_window.h"Go to the source code of this file.
Classes | |
| struct | BCursor |
Macros | |
| #define | BEGIN_CURSOR_BLOCK |
| #define | END_CURSOR_BLOCK |
Typedefs | |
| typedef struct BCursor | BCursor |
Functions | |
| static GHOST_TStandardCursor | convert_to_ghost_standard_cursor (WMCursorType curs) |
| static void | window_set_custom_cursor (wmWindow *win, const uchar mask[16][2], const uchar bitmap[16][2], int hotx, int hoty) |
| static void | window_set_custom_cursor_ex (wmWindow *win, BCursor *cursor) |
| void | WM_cursor_set (wmWindow *win, int curs) |
| bool | WM_cursor_set_from_tool (struct wmWindow *win, const ScrArea *area, const ARegion *region) |
| void | WM_cursor_modal_set (wmWindow *win, int val) |
| void | WM_cursor_modal_restore (wmWindow *win) |
| void | WM_cursor_wait (bool val) |
| void | WM_cursor_grab_enable (wmWindow *win, int wrap, bool hide, int bounds[4]) |
| void | WM_cursor_grab_disable (wmWindow *win, const int mouse_ungrab_xy[2]) |
| static void | wm_cursor_warp_relative (wmWindow *win, int x, int y) |
| bool | wm_cursor_arrow_move (wmWindow *win, const wmEvent *event) |
| void | WM_cursor_time (wmWindow *win, int nr) |
| void | wm_init_cursor_data (void) |
Variables | |
| static BCursor * | BlenderCursor [WM_CURSOR_NUM] = {0} |
Cursor pixmap and cursor utility functions to change the cursor.
Definition in file wm_cursors.c.
| #define BEGIN_CURSOR_BLOCK |
Each bit represents a pixel, so 1 byte = 8 pixels, the bytes go Left to Right. Top to bottom the bits in a byte go right to left (ie; 0x01, 0x80 represents a line of 16 pix with the first and last pix set.)
This type of cursor is 16x16 pixels only.
There is a nice Python GUI utility that can be used for drawing cursors in this format in the Blender source distribution, in ./source/tools/utils/make_cursor_gui.py .
Start it with the command python3 make_cursor_gui.py It will copy its output to the console when you press 'Do it'. Because defining a cursor mixes declarations and executable code each cursor needs its own scoping block or it would be split up over several hundred lines of code. To enforce/document this better I define 2 pretty brain-dead macros so it's obvious what the extra "[]" are for
Definition at line 410 of file wm_cursors.c.
| #define END_CURSOR_BLOCK |
Definition at line 413 of file wm_cursors.c.
|
static |
Definition at line 60 of file wm_cursors.c.
References GHOST_kStandardCursorCopy, GHOST_kStandardCursorCrosshair, GHOST_kStandardCursorCrosshairA, GHOST_kStandardCursorCrosshairB, GHOST_kStandardCursorCrosshairC, GHOST_kStandardCursorCustom, GHOST_kStandardCursorDefault, GHOST_kStandardCursorDownArrow, GHOST_kStandardCursorEraser, GHOST_kStandardCursorEWScroll, GHOST_kStandardCursorEyedropper, GHOST_kStandardCursorHorizontalSplit, GHOST_kStandardCursorKnife, GHOST_kStandardCursorLeftArrow, GHOST_kStandardCursorLeftRight, GHOST_kStandardCursorMove, GHOST_kStandardCursorNSEWScroll, GHOST_kStandardCursorNSScroll, GHOST_kStandardCursorPencil, GHOST_kStandardCursorRightArrow, GHOST_kStandardCursorStop, GHOST_kStandardCursorText, GHOST_kStandardCursorUpArrow, GHOST_kStandardCursorUpDown, GHOST_kStandardCursorVerticalSplit, GHOST_kStandardCursorWait, GHOST_kStandardCursorZoomIn, GHOST_kStandardCursorZoomOut, WM_CURSOR_COPY, WM_CURSOR_CROSS, WM_CURSOR_CROSSC, WM_CURSOR_DEFAULT, WM_CURSOR_DOT, WM_CURSOR_E_ARROW, WM_CURSOR_EDIT, WM_CURSOR_ERASER, WM_CURSOR_EW_SCROLL, WM_CURSOR_EYEDROPPER, WM_CURSOR_H_SPLIT, WM_CURSOR_HAND, WM_CURSOR_KNIFE, WM_CURSOR_N_ARROW, WM_CURSOR_NS_SCROLL, WM_CURSOR_NSEW_SCROLL, WM_CURSOR_PAINT, WM_CURSOR_PAINT_BRUSH, WM_CURSOR_S_ARROW, WM_CURSOR_STOP, WM_CURSOR_TEXT_EDIT, WM_CURSOR_V_SPLIT, WM_CURSOR_W_ARROW, WM_CURSOR_WAIT, WM_CURSOR_X_MOVE, WM_CURSOR_Y_MOVE, WM_CURSOR_ZOOM_IN, and WM_CURSOR_ZOOM_OUT.
Referenced by WM_cursor_set().
|
static |
Definition at line 123 of file wm_cursors.c.
References GHOST_SetCustomCursorShape(), wmWindow::ghostwin, and mask().
Referenced by WM_cursor_time().
Definition at line 130 of file wm_cursors.c.
References BCursor::bitmap, BCursor::can_invert_color, GHOST_SetCustomCursorShape(), wmWindow::ghostwin, BCursor::hotx, BCursor::hoty, and BCursor::mask.
Referenced by WM_cursor_set().
Definition at line 311 of file wm_cursors.c.
References EVT_DOWNARROWKEY, EVT_LEFTARROWKEY, EVT_RIGHTARROWKEY, EVT_UPARROWKEY, GHOST_GetNativePixelSize(), wmWindow::ghostwin, KM_PRESS, wmEvent::type, wmEvent::val, and wm_cursor_warp_relative().
Referenced by wm_handlers_do_intern().
| void WM_cursor_grab_disable | ( | wmWindow * | win, |
| const int | mouse_ungrab_xy[2] | ||
| ) |
Definition at line 283 of file wm_cursors.c.
References G, G_DEBUG, GHOST_kGrabAxisNone, GHOST_kGrabDisable, GHOST_SetCursorGrab(), wmWindow::ghostwin, wmWindow::grabcursor, NULL, and wm_cursor_position_to_ghost().
Referenced by button_activate_state(), WM_event_remove_handlers(), wm_gizmomap_modal_set(), and wm_handler_operator_call().
| void WM_cursor_grab_enable | ( | wmWindow * | win, |
| int | wrap, | ||
| bool | hide, | ||
| int | bounds[4] | ||
| ) |
| bounds | can be NULL |
Definition at line 246 of file wm_cursors.c.
References bounds(), wmWindow::eventstate, G, G_DEBUG, GHOST_kAxisX, GHOST_kGrabAxisY, GHOST_kGrabHide, GHOST_kGrabNormal, GHOST_kGrabWrap, GHOST_SetCursorGrab(), wmWindow::ghostwin, wmWindow::grabcursor, wmTabletData::is_motion_absolute, NULL, wmEvent::tablet, wm_cursor_position_to_ghost(), WM_CURSOR_WRAP_X, WM_CURSOR_WRAP_Y, and blender::gpu::wrap().
Referenced by button_activate_state(), wm_gizmomap_modal_set(), wm_macro_modal(), and wm_operator_invoke().
| void WM_cursor_modal_restore | ( | wmWindow * | win | ) |
Definition at line 216 of file wm_cursors.c.
References wmWindow::lastcursor, wmWindow::modalcursor, and WM_cursor_set().
Referenced by annotation_draw_exit(), area_split_exit(), area_swap_exit(), button_activate_exit(), curve_draw_exit(), datadropper_exit(), decimate_exit(), depthdropper_exit(), driverdropper_exit(), eyedropper_colorband_exit(), eyedropper_exit(), face_set_extract_modal(), gesture_modal_end(), gpencil_draw_exit(), gpencil_draw_modal(), gpencil_fill_exit(), gpencil_fill_modal(), gpencil_interpolate_modal(), gpencil_primitive_interaction_end(), gpencil_primitive_modal(), image_view_pan_exit(), image_view_zoom_exit(), knifetool_exit_ex(), node_resize_exit(), object_transfer_mode_modal(), pose_slide_modal(), postTrans(), sample_color_modal(), screen_opengl_render_end(), sculpt_sample_detail_size_modal(), ui_numedit_set_active(), ui_textedit_end(), view_pan_exit(), view_pan_modal(), view_zoom_exit(), view_zoomdrag_modal(), walkEnd(), and WM_cursor_wait().
| void WM_cursor_modal_set | ( | wmWindow * | win, |
| int | val | ||
| ) |
Definition at line 207 of file wm_cursors.c.
References wmWindow::cursor, wmWindow::lastcursor, wmWindow::modalcursor, and WM_cursor_set().
Referenced by annotation_draw_cursor_set(), area_swap_invoke(), button_activate_init(), curve_draw_invoke(), datadropper_invoke(), depthdropper_invoke(), driverdropper_invoke(), eyedropper_colorband_invoke(), eyedropper_invoke(), face_set_extract_invoke(), gpencil_draw_modal(), gpencil_fill_invoke(), gpencil_interpolate_invoke(), gpencil_primitive_edit_event_handling(), gpencil_primitive_invoke(), gpencil_primitive_modal(), graphkeys_decimate_invoke(), image_view_pan_init(), image_view_zoom_init(), initMouseInputMode(), initWalkInfo(), knifetool_invoke(), node_resize_init(), object_transfer_mode_invoke(), pose_slide_invoke_common(), sample_color_invoke(), sculpt_sample_detail_size_invoke(), ui_numedit_set_active(), ui_textedit_begin(), view_pan_init(), view_pan_invoke(), view_zoom_init(), view_zoomdrag_invoke(), WM_cursor_wait(), WM_gesture_lasso_invoke(), WM_gesture_lines_invoke(), and WM_gesture_straightline_invoke().
| void WM_cursor_set | ( | wmWindow * | win, |
| int | curs | ||
| ) |
Definition at line 142 of file wm_cursors.c.
References BlenderCursor, BLI_assert, convert_to_ghost_standard_cursor(), wmWindow::cursor, G, GHOST_HasCursorShape(), GHOST_kStandardCursorCustom, GHOST_kStandardCursorDefault, GHOST_SetCursorShape(), GHOST_SetCursorVisibility(), wmWindow::ghostwin, wmWindow::modalcursor, NULL, window_set_custom_cursor_ex(), WM_CURSOR_DEFAULT, WM_CURSOR_NONE, and WM_CURSOR_NUM.
Referenced by actionzone_modal(), area_join_modal(), area_split_preview_update_cursor(), clip_tracking_hide_cursor(), clip_tracking_show_cursor(), console_cursor(), ED_region_cursor_set(), gpencil_transform_fill_invoke(), gpencil_uv_transform_exit(), node_set_cursor(), paint_update_mouse_cursor(), screen_cursor_set(), text_cursor(), ui_popup_block_create(), view3d_main_region_cursor(), WM_cursor_modal_restore(), WM_cursor_modal_set(), WM_cursor_set_from_tool(), WM_gizmomap_cursor_set(), and wm_gizmomap_highlight_set().
| bool WM_cursor_set_from_tool | ( | struct wmWindow * | win, |
| const ScrArea * | area, | ||
| const ARegion * | region | ||
| ) |
Definition at line 190 of file wm_cursors.c.
References blender::compositor::area(), wmWindow::cursor, bToolRef_Runtime::cursor, if(), wmWindow::modalcursor, NULL, ARegion::regiontype, RGN_TYPE_WINDOW, WM_CURSOR_DEFAULT, and WM_cursor_set().
Referenced by ED_region_cursor_set(), and view3d_main_region_cursor().
| void WM_cursor_time | ( | wmWindow * | win, |
| int | nr | ||
| ) |
Definition at line 338 of file wm_cursors.c.
References wmWindow::cursor, wmWindow::lastcursor, mask(), window_set_custom_cursor(), x, and y.
Referenced by gpencil_do_frame_fill(), gpencil_fill_modal(), and screen_opengl_render_anim_step().
| void WM_cursor_wait | ( | bool | val | ) |
Definition at line 226 of file wm_cursors.c.
References ListBase::first, G, G_MAIN, wmWindow::next, NULL, wmWindowManager::windows, WM_cursor_modal_restore(), WM_cursor_modal_set(), and WM_CURSOR_WAIT.
Referenced by bake_invoke(), ED_object_parent_set(), edbm_duplicate_invoke(), light_cache_bake_invoke(), multiresbake_image_exec(), redraw_timer_exec(), save_image_op(), screen_render_invoke(), script_reload_exec(), sculpt_dynamic_topology_toggle_exec(), separate_armature_exec(), separate_exec(), solve_camera_invoke(), track_markers(), WM_file_read(), wm_file_write(), wm_gpencil_import_svg_exec(), and wm_read_exotic().
|
static |
Definition at line 302 of file wm_cursors.c.
References wm_cursor_position_get(), WM_cursor_warp(), x, and y.
Referenced by wm_cursor_arrow_move().
| void wm_init_cursor_data | ( | void | ) |
Definition at line 417 of file wm_cursors.c.
References BEGIN_CURSOR_BLOCK, BlenderCursor, END_CURSOR_BLOCK, WM_CURSOR_COPY, WM_CURSOR_CROSS, WM_CURSOR_CROSSC, WM_CURSOR_DEFAULT, WM_CURSOR_DOT, WM_CURSOR_E_ARROW, WM_CURSOR_EDIT, WM_CURSOR_ERASER, WM_CURSOR_EW_ARROW, WM_CURSOR_EW_SCROLL, WM_CURSOR_EYEDROPPER, WM_CURSOR_H_SPLIT, WM_CURSOR_HAND, WM_CURSOR_KNIFE, WM_CURSOR_MUTE, WM_CURSOR_N_ARROW, WM_CURSOR_NS_ARROW, WM_CURSOR_NS_SCROLL, WM_CURSOR_NSEW_SCROLL, WM_CURSOR_NW_ARROW, WM_CURSOR_PAINT, WM_CURSOR_PAINT_BRUSH, WM_CURSOR_S_ARROW, WM_CURSOR_STOP, WM_CURSOR_SWAP_AREA, WM_CURSOR_TEXT_EDIT, WM_CURSOR_V_SPLIT, WM_CURSOR_VERTEX_LOOP, WM_CURSOR_W_ARROW, WM_CURSOR_WAIT, WM_CURSOR_X_MOVE, WM_CURSOR_Y_MOVE, WM_CURSOR_ZOOM_IN, and WM_CURSOR_ZOOM_OUT.
Referenced by WM_init().
|
static |
Definition at line 57 of file wm_cursors.c.
Referenced by WM_cursor_set(), and wm_init_cursor_data().