From c09091c40703bdfae84e4bee3094bf6db23d8487 Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Mon, 3 Feb 2020 14:51:25 +0100 Subject: [PATCH] Rotate Gizmo -> added rotations using arrow keys: Left arrow = 90 degrees around Z axis CCW Right arrow = 90 degrees around Z axis CW Up arrow = 45 degrees around Z axis CCW Down arrow = 45 degrees around Z axis CW --- src/slic3r/GUI/Gizmos/GLGizmosManager.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp b/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp index beca63798..d830e4f3a 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp @@ -794,6 +794,27 @@ bool GLGizmosManager::on_key(wxKeyEvent& evt) default: { break; } } } + else if (m_current == Rotate) + { + auto do_rotate = [this, &processed](const Vec3d& rotation) { + Selection& selection = m_parent.get_selection(); + selection.start_dragging(); + selection.rotate(rotation, TransformationType(TransformationType::World_Relative_Joint)); + wxGetApp().obj_manipul()->set_dirty(); + m_parent.do_rotate(L("Gizmo-Rotate")); + m_parent.set_as_dirty(); + processed = true; + }; + + switch (keyCode) + { + case WXK_NUMPAD_LEFT: case WXK_LEFT: { do_rotate(Vec3d(0.0, 0.0, 0.5 * M_PI)); break; } + case WXK_NUMPAD_RIGHT: case WXK_RIGHT: { do_rotate(-Vec3d(0.0, 0.0, 0.5 * M_PI)); break; } + case WXK_NUMPAD_UP: case WXK_UP: { do_rotate(Vec3d(0.0, 0.0, 0.25 * M_PI)); break; } + case WXK_NUMPAD_DOWN: case WXK_DOWN: { do_rotate(-Vec3d(0.0, 0.0, 0.25 * M_PI)); break; } + default: { break; } + } + } // if (processed) // m_parent.set_cursor(GLCanvas3D::Standard);