diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index b005fe06b..88bac4efb 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -1167,7 +1167,7 @@ GLCanvas3D::GLCanvas3D(wxGLCanvas* canvas, Bed3D &bed) m_retina_helper.reset(new RetinaHelper(canvas)); #endif // ENABLE_RETINA_GL } - + m_timer_set_color.Bind(wxEVT_TIMER, &GLCanvas3D::on_set_color_timer, this); load_arrange_settings(); m_selection.set_volumes(&m_volumes.volumes); @@ -3165,15 +3165,25 @@ void GLCanvas3D::on_char(wxKeyEvent& evt) //} // BBS: use keypad to change extruder - case '1': + case '1': { + if (!m_timer_set_color.IsRunning()) { + m_timer_set_color.StartOnce(500); + break; + } + } + case '0': //Color logic for material 10 case '2': case '3': case '4': case '5': - case '6': + case '6': case '7': case '8': case '9': { + if (m_timer_set_color.IsRunning()) { + if (keyCode < '7') keyCode += 10; + m_timer_set_color.Stop(); + } if (m_gizmos.get_current_type() != GLGizmosManager::MmuSegmentation) obj_list->set_extruder_for_selected_items(keyCode - '0'); break; @@ -3726,6 +3736,14 @@ void GLCanvas3D::on_render_timer(wxTimerEvent& evt) // wxWakeUpIdle(); } +void GLCanvas3D::on_set_color_timer(wxTimerEvent& evt) +{ + auto obj_list = wxGetApp().obj_list(); + if (m_gizmos.get_current_type() != GLGizmosManager::MmuSegmentation) + obj_list->set_extruder_for_selected_items(1); + m_timer_set_color.Stop(); +} + void GLCanvas3D::schedule_extra_frame(int miliseconds) { diff --git a/src/slic3r/GUI/GLCanvas3D.hpp b/src/slic3r/GUI/GLCanvas3D.hpp index 081630449..3b147d8ff 100644 --- a/src/slic3r/GUI/GLCanvas3D.hpp +++ b/src/slic3r/GUI/GLCanvas3D.hpp @@ -512,6 +512,7 @@ private: unsigned int m_last_w, m_last_h; bool m_in_render; wxTimer m_timer; + wxTimer m_timer_set_color; LayersEditing m_layers_editing; Mouse m_mouse; GLGizmosManager m_gizmos; @@ -910,6 +911,7 @@ public: void on_mouse_wheel(wxMouseEvent& evt); void on_timer(wxTimerEvent& evt); void on_render_timer(wxTimerEvent& evt); + void on_set_color_timer(wxTimerEvent& evt); void on_mouse(wxMouseEvent& evt); void on_gesture(wxGestureEvent& evt); void on_paint(wxPaintEvent& evt);