[Bf-blender-cvs] [00018bfaa2a] master: Tracking: Fix incorrect angle calculation on marker slide
Sergey Sharybin
noreply at git.blender.org
Thu Mar 24 16:57:34 CET 2022
Commit: 00018bfaa2af7e1f4ee07d4f999193d9b02a53aa
Author: Sergey Sharybin
Date: Thu Mar 24 16:55:57 2022 +0100
Branches: master
https://developer.blender.org/rB00018bfaa2af7e1f4ee07d4f999193d9b02a53aa
Tracking: Fix incorrect angle calculation on marker slide
Now the mouse cursor will exactly follow the tilt/scale sliding area.
===================================================================
M source/blender/editors/space_clip/tracking_ops.c
===================================================================
diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c
index 1a497a35b6f..e7bdbfe7c68 100644
--- a/source/blender/editors/space_clip/tracking_ops.c
+++ b/source/blender/editors/space_clip/tracking_ops.c
@@ -877,14 +877,23 @@ static int slide_marker_modal(bContext *C, wmOperator *op, const wmEvent *event)
}
else if (data->action == SLIDE_ACTION_TILT_SIZE) {
const float mouse_delta[2] = {dx, dy};
- float start[2], end[2];
- float scale = 1.0f, angle = 0.0f;
+ /* Vector which connects marker position with tilt/scale sliding area before sliding
+ * began. */
+ float start[2];
sub_v2_v2v2(start, data->spos, data->old_pos);
+ start[0] *= data->width;
+ start[1] *= data->height;
+ /* Vector which connects marker position with tilt/scale sliding area with the sliding
+ * delta applied. */
+ float end[2];
add_v2_v2v2(end, data->spos, mouse_delta);
sub_v2_v2(end, data->old_pos);
+ end[0] *= data->width;
+ end[1] *= data->height;
+ float scale = 1.0f;
if (len_squared_v2(start) != 0.0f) {
scale = len_v2(end) / len_v2(start);
@@ -893,7 +902,7 @@ static int slide_marker_modal(bContext *C, wmOperator *op, const wmEvent *event)
}
}
- angle = -angle_signed_v2v2(start, end);
+ const float angle = -angle_signed_v2v2(start, end);
for (int a = 0; a < 4; a++) {
float vec[2];
More information about the Bf-blender-cvs
mailing list