diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index bb4b7edfd..351dc5108 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -3475,6 +3475,7 @@ void GLCanvas3D::on_key(wxKeyEvent& evt) } } } + else return; } if (keyCode != WXK_TAB diff --git a/src/slic3r/GUI/Gizmos/GLGizmoFdmSupports.cpp b/src/slic3r/GUI/Gizmos/GLGizmoFdmSupports.cpp index 1aaf877b3..b57ca0a9f 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoFdmSupports.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoFdmSupports.cpp @@ -128,6 +128,29 @@ void GLGizmoFdmSupports::render_painter_gizmo() const glsafe(::glDisable(GL_BLEND)); } +// BBS +bool GLGizmoFdmSupports::on_key_down_select_tool_type(int keyCode) { + switch (keyCode) + { + case 'F': + m_current_tool = ImGui::FillButtonIcon; + break; + case 'S': + m_current_tool = ImGui::SphereButtonIcon; + break; + case 'C': + m_current_tool = ImGui::CircleButtonIcon; + break; + case 'G': + m_current_tool = ImGui::GapFillIcon; + break; + default: + return false; + break; + } + return true; +} + // BBS void GLGizmoFdmSupports::render_triangles(const Selection& selection) const { diff --git a/src/slic3r/GUI/Gizmos/GLGizmoFdmSupports.hpp b/src/slic3r/GUI/Gizmos/GLGizmoFdmSupports.hpp index 3cf7184a7..6960a81dc 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoFdmSupports.hpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoFdmSupports.hpp @@ -24,6 +24,9 @@ public: state_ready }; + //BBS + bool on_key_down_select_tool_type(int keyCode); + protected: void on_render_input_window(float x, float y, float bottom_limit) override; std::string on_get_name() const override; diff --git a/src/slic3r/GUI/Gizmos/GLGizmoMmuSegmentation.cpp b/src/slic3r/GUI/Gizmos/GLGizmoMmuSegmentation.cpp index 6b5e0d82f..03ff70761 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoMmuSegmentation.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoMmuSegmentation.cpp @@ -241,6 +241,34 @@ bool GLGizmoMmuSegmentation::on_number_key_down(int number) return true; } +bool GLGizmoMmuSegmentation::on_key_down_select_tool_type(int keyCode) { + switch (keyCode) + { + case 'F': + m_current_tool = ImGui::FillButtonIcon; + break; + case 'T': + m_current_tool = ImGui::TriangleButtonIcon; + break; + case 'S': + m_current_tool = ImGui::SphereButtonIcon; + break; + case 'C': + m_current_tool = ImGui::CircleButtonIcon; + break; + case 'H': + m_current_tool = ImGui::HeightRangeIcon; + break; + case 'G': + m_current_tool = ImGui::GapFillIcon; + break; + default: + return false; + break; + } + return true; +} + static void render_extruders_combo(const std::string &label, const std::vector &extruders, const std::vector> &extruders_colors, diff --git a/src/slic3r/GUI/Gizmos/GLGizmoMmuSegmentation.hpp b/src/slic3r/GUI/Gizmos/GLGizmoMmuSegmentation.hpp index da9c5d9c6..6b5cde25c 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoMmuSegmentation.hpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoMmuSegmentation.hpp @@ -83,6 +83,7 @@ public: // BBS bool on_number_key_down(int number); + bool on_key_down_select_tool_type(int keyCode); protected: // BBS diff --git a/src/slic3r/GUI/Gizmos/GLGizmoSeam.cpp b/src/slic3r/GUI/Gizmos/GLGizmoSeam.cpp index 11991c248..6729de614 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoSeam.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoSeam.cpp @@ -78,6 +78,23 @@ void GLGizmoSeam::render_painter_gizmo() const glsafe(::glDisable(GL_BLEND)); } +// BBS +bool GLGizmoSeam::on_key_down_select_tool_type(int keyCode) { + switch (keyCode) + { + case 'S': + m_current_tool = ImGui::SphereButtonIcon; + break; + case 'C': + m_current_tool = ImGui::CircleButtonIcon; + break; + default: + return false; + break; + } + return true; +} + void GLGizmoSeam::render_triangles(const Selection& selection) const { ClippingPlaneDataWrapper clp_data = this->get_clipping_plane_data(); diff --git a/src/slic3r/GUI/Gizmos/GLGizmoSeam.hpp b/src/slic3r/GUI/Gizmos/GLGizmoSeam.hpp index 128a87cc5..3f724deaf 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoSeam.hpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoSeam.hpp @@ -12,6 +12,9 @@ public: void render_painter_gizmo() const override; + //BBS + bool on_key_down_select_tool_type(int keyCode); + protected: // BBS void on_set_state() override; diff --git a/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp b/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp index cc78f23de..438e062f8 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp @@ -1182,10 +1182,40 @@ bool GLGizmosManager::on_key(wxKeyEvent& evt) processed = simplify->on_esc_key_down(); } // BBS - else if (m_current == MmuSegmentation && keyCode > '0' && keyCode <= '9') { + else if (m_current == MmuSegmentation) { GLGizmoMmuSegmentation* mmu_seg = dynamic_cast(get_current()); - if (mmu_seg != nullptr) - processed = mmu_seg->on_number_key_down(keyCode - '0'); + if (mmu_seg != nullptr) { + if (keyCode > '0' && keyCode <= '9') { + processed = mmu_seg->on_number_key_down(keyCode - '0'); + } + else if (keyCode == 'F' || keyCode == 'T' || keyCode == 'S' || keyCode == 'C' || keyCode == 'H' || keyCode == 'G') { + processed = mmu_seg->on_key_down_select_tool_type(keyCode); + if (processed) { + // force extra frame to automatically update window size + wxGetApp().imgui()->set_requires_extra_frame(); + } + } + } + } + else if (m_current == FdmSupports) { + GLGizmoFdmSupports* fdm_support = dynamic_cast(get_current()); + if (fdm_support != nullptr && keyCode == 'F' || keyCode == 'S' || keyCode == 'C' || keyCode == 'G') { + processed = fdm_support->on_key_down_select_tool_type(keyCode); + } + if (processed) { + // force extra frame to automatically update window size + wxGetApp().imgui()->set_requires_extra_frame(); + } + } + else if (m_current == Seam) { + GLGizmoSeam* seam = dynamic_cast(get_current()); + if (seam != nullptr && keyCode == 'S' || keyCode == 'C') { + processed = seam->on_key_down_select_tool_type(keyCode); + } + if (processed) { + // force extra frame to automatically update window size + wxGetApp().imgui()->set_requires_extra_frame(); + } } }