NEW:Dye materials above grade 10 with shortcut keys

JIRA:STUDIO-5827
Change-Id: I002ecdd19167fb36772e4b4e9e2f7760e21079db
This commit is contained in:
hu.wang 2024-01-29 20:11:38 +08:00 committed by Lane.Wei
parent 233645e745
commit 7c9ab11bb5
2 changed files with 23 additions and 3 deletions

View File

@ -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)
{

View File

@ -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);