diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-12-09 10:32:29 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-12-09 11:45:15 +0300 |
commit | 3d5775b69adac8a52f3971baf988e6ead7ba4603 (patch) | |
tree | cbe622c08db3733f0604ea7ecde74eb37ca42af9 /source/blender/editors/transform/transform.c | |
parent | 761111efb8e40fa030cb48761df8c066d0e43ae5 (diff) |
Gizmo: add view aligned gizmo for shear
Diffstat (limited to 'source/blender/editors/transform/transform.c')
-rw-r--r-- | source/blender/editors/transform/transform.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 74fc1406795..42adf1ee456 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -3524,10 +3524,29 @@ static void Bend(TransInfo *t, const int UNUSED(mval[2])) static void initShear_mouseInputMode(TransInfo *t) { float dir[3]; + bool dir_flip = false; copy_v3_v3(dir, t->orient_matrix[t->orient_axis_ortho]); + /* Needed for axis aligned view gizmo. */ + if (t->orientation.user == V3D_ORIENT_VIEW) { + if (t->orient_axis_ortho == 0) { + if (t->center2d[1] > t->mouse.imval[1]) { + dir_flip = !dir_flip; + } + } + else if (t->orient_axis_ortho == 1) { + if (t->center2d[0] > t->mouse.imval[0]) { + dir_flip = !dir_flip; + } + } + } + /* Without this, half the gizmo handles move in the opposite direction. */ if ((t->orient_axis_ortho + 1) % 3 != t->orient_axis) { + dir_flip = !dir_flip; + } + + if (dir_flip) { negate_v3(dir); } |