Manipulators/Tools: always draw a cursor while interacting
Cursor can be a system one or drawn with OpenGL. Before, dragging the transform manipulator would hide the cursor and reset it to the initial positon.
This commit is contained in:
parent
93adbf8195
commit
574c0fe38f
Notes:
blender-bot
2023-02-14 08:25:14 +01:00
Referenced by commit 39aea50155
, Fix T55178: Cursor fails to restore on cancel
Referenced by issue #54765, Build is broken on 2.8 on darwin platform
|
@ -483,7 +483,7 @@ typedef struct TransInfo {
|
|||
short persp;
|
||||
short around;
|
||||
char spacetype; /* spacetype where transforming is */
|
||||
char helpline; /* helpline modes (not to be confused with hotline) */
|
||||
char helpline; /* choice of custom cursor with or without a help line from the gizmo to the mouse pos */
|
||||
short obedit_type; /* Avoid looking inside TransDataContainer obedit. */
|
||||
|
||||
float vec[3]; /* translation, to show for widget */
|
||||
|
|
|
@ -30,10 +30,13 @@
|
|||
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
|
||||
#include "BLI_math.h"
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "WM_types.h"
|
||||
#include "WM_api.h"
|
||||
|
||||
#include "transform.h"
|
||||
|
||||
|
@ -341,6 +344,25 @@ void initMouseInputMode(TransInfo *t, MouseInput *mi, MouseInputMode mode)
|
|||
break;
|
||||
}
|
||||
|
||||
/* setup for the mouse cursor: either set a custom one,
|
||||
* or hide it if it will be drawn with the helpline */
|
||||
wmWindow *win = CTX_wm_window(t->context);
|
||||
switch(t->helpline) {
|
||||
case HLP_NONE:
|
||||
/* INPUT_VECTOR, INPUT_CUSTOM_RATIO, INPUT_CUSTOM_RATIO_FLIP */
|
||||
WM_cursor_set(win, BC_HANDCURSOR);
|
||||
break;
|
||||
case HLP_SPRING:
|
||||
case HLP_ANGLE:
|
||||
case HLP_TRACKBALL:
|
||||
case HLP_HARROW:
|
||||
case HLP_VARROW:
|
||||
WM_cursor_set(win, CURSOR_NONE);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
/* if we've allocated new data, free the old data
|
||||
* less hassle then checking before every alloc above */
|
||||
if (mi_data_prev && (mi_data_prev != mi->data)) {
|
||||
|
|
|
@ -1191,17 +1191,14 @@ static ManipulatorGroup *manipulatorgroup_init(wmManipulatorGroup *mgroup)
|
|||
#define MANIPULATOR_NEW_ARROW(v, draw_style) { \
|
||||
man->manipulators[v] = WM_manipulator_new_ptr(wt_arrow, mgroup, NULL); \
|
||||
RNA_enum_set(man->manipulators[v]->ptr, "draw_style", draw_style); \
|
||||
WM_manipulator_set_flag(man->manipulators[v], WM_MANIPULATOR_GRAB_CURSOR, true); \
|
||||
} ((void)0)
|
||||
#define MANIPULATOR_NEW_DIAL(v, draw_options) { \
|
||||
man->manipulators[v] = WM_manipulator_new_ptr(wt_dial, mgroup, NULL); \
|
||||
RNA_enum_set(man->manipulators[v]->ptr, "draw_options", draw_options); \
|
||||
WM_manipulator_set_flag(man->manipulators[v], WM_MANIPULATOR_GRAB_CURSOR, true); \
|
||||
} ((void)0)
|
||||
#define MANIPULATOR_NEW_PRIM(v, draw_style) { \
|
||||
man->manipulators[v] = WM_manipulator_new_ptr(wt_prim, mgroup, NULL); \
|
||||
RNA_enum_set(man->manipulators[v]->ptr, "draw_style", draw_style); \
|
||||
WM_manipulator_set_flag(man->manipulators[v], WM_MANIPULATOR_GRAB_CURSOR, true); \
|
||||
} ((void)0)
|
||||
|
||||
/* add/init widgets - order matters! */
|
||||
|
|
|
@ -1903,7 +1903,10 @@ static int wm_handler_operator_call(bContext *C, ListBase *handlers, wmEventHand
|
|||
|
||||
/* remove modal handler, operator itself should have been canceled and freed */
|
||||
if (retval & (OPERATOR_CANCELLED | OPERATOR_FINISHED)) {
|
||||
WM_cursor_grab_disable(CTX_wm_window(C), NULL);
|
||||
/* set cursor back to the default for the region */
|
||||
wmWindow *win = CTX_wm_window(C);
|
||||
WM_cursor_grab_disable(win, NULL);
|
||||
ED_region_cursor_set(win, CTX_wm_area(C), CTX_wm_region(C));
|
||||
|
||||
BLI_remlink(handlers, handler);
|
||||
wm_event_free_handler(handler);
|
||||
|
|
Loading…
Reference in New Issue