Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGermano Cavalcante <germano.costa@ig.com.br>2021-04-03 19:32:42 +0300
committerGermano Cavalcante <germano.costa@ig.com.br>2021-04-03 19:32:42 +0300
commit8681504f06127cf72ad67c4d056d04013d218ad5 (patch)
tree7b9bac6b02a864fc779ea1e81dc58e0e2974e159 /source/blender/editors/gizmo_library
parent62f8d9e478b7d6c61a4a8bbd0594e29495938e61 (diff)
Fix inversion of snapping failing in measure tool
Comparison of event change has to be more specific and compare the x and y values of the mouse as well.
Diffstat (limited to 'source/blender/editors/gizmo_library')
-rw-r--r--source/blender/editors/gizmo_library/gizmo_types/snap3d_gizmo.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/source/blender/editors/gizmo_library/gizmo_types/snap3d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/snap3d_gizmo.c
index 2561de3aca9..f13b7d832bd 100644
--- a/source/blender/editors/gizmo_library/gizmo_types/snap3d_gizmo.c
+++ b/source/blender/editors/gizmo_library/gizmo_types/snap3d_gizmo.c
@@ -93,19 +93,24 @@ typedef struct SnapGizmo3D {
bool is_enabled;
} SnapGizmo3D;
+static bool eventstate_cmp(SnapGizmo3D *snap_gizmo, const wmEvent *event)
+{
+ if ((event->x == snap_gizmo->last_eventstate.x) && (event->y == snap_gizmo->last_eventstate.y) &&
+ (event->ctrl == snap_gizmo->last_eventstate.ctrl) &&
+ (event->shift == snap_gizmo->last_eventstate.shift) &&
+ (event->alt == snap_gizmo->last_eventstate.alt) &&
+ (event->oskey == snap_gizmo->last_eventstate.oskey)) {
+ return true;
+ }
+ return false;
+}
+
/* Checks if the current event is different from the one captured in the last update. */
static bool eventstate_has_changed(SnapGizmo3D *snap_gizmo, const wmWindowManager *wm)
{
if (wm && wm->winactive) {
const wmEvent *event = wm->winactive->eventstate;
- if ((event->x != snap_gizmo->last_eventstate.x) ||
- (event->y != snap_gizmo->last_eventstate.y) ||
- (event->ctrl != snap_gizmo->last_eventstate.ctrl) ||
- (event->shift != snap_gizmo->last_eventstate.shift) ||
- (event->alt != snap_gizmo->last_eventstate.alt) ||
- (event->oskey != snap_gizmo->last_eventstate.oskey)) {
- return true;
- }
+ return eventstate_cmp(snap_gizmo, event) == false;
}
return false;
}
@@ -132,10 +137,7 @@ static bool invert_snap(SnapGizmo3D *snap_gizmo, const wmWindowManager *wm)
}
const wmEvent *event = wm->winactive->eventstate;
- if ((event->ctrl == snap_gizmo->last_eventstate.ctrl) &&
- (event->shift == snap_gizmo->last_eventstate.shift) &&
- (event->alt == snap_gizmo->last_eventstate.alt) &&
- (event->oskey == snap_gizmo->last_eventstate.oskey)) {
+ if (eventstate_cmp(snap_gizmo, event)) {
/* Nothing has changed. */
return snap_gizmo->invert_snap;
}