diff options
author | Sergey Sharybin <sergey@blender.org> | 2022-03-24 18:55:57 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey@blender.org> | 2022-03-24 18:56:31 +0300 |
commit | 00018bfaa2af7e1f4ee07d4f999193d9b02a53aa (patch) | |
tree | 862bcfb1448612d91d1ac3f28ca6b0e7989b75ea /source/blender/editors/space_clip/tracking_ops.c | |
parent | dd7250efb1a54cc80acd1091139e4358ca83993e (diff) |
Tracking: Fix incorrect angle calculation on marker slide
Now the mouse cursor will exactly follow the tilt/scale sliding area.
Diffstat (limited to 'source/blender/editors/space_clip/tracking_ops.c')
-rw-r--r-- | source/blender/editors/space_clip/tracking_ops.c | 15 |
1 files changed, 12 insertions, 3 deletions
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]; |