FIX: all plates stats crash
Change-Id: Iad42b9777e4f3fab4a432b73865d4bd7dd530fd3
This commit is contained in:
parent
2fc699be6a
commit
0576e3e4fd
|
@ -4122,6 +4122,10 @@ void GCodeViewer::render_shells()
|
||||||
void GCodeViewer::render_all_plates_stats(const std::vector<const GCodeProcessorResult*>& gcode_result_list, bool show /*= true*/) const {
|
void GCodeViewer::render_all_plates_stats(const std::vector<const GCodeProcessorResult*>& gcode_result_list, bool show /*= true*/) const {
|
||||||
if (!show)
|
if (!show)
|
||||||
return;
|
return;
|
||||||
|
for (auto gcode_result : gcode_result_list) {
|
||||||
|
if (gcode_result->moves.size() == 0)
|
||||||
|
return;
|
||||||
|
}
|
||||||
ImGuiWrapper& imgui = *wxGetApp().imgui();
|
ImGuiWrapper& imgui = *wxGetApp().imgui();
|
||||||
|
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0.0f);
|
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0.0f);
|
||||||
|
|
|
@ -7162,7 +7162,14 @@ void GLCanvas3D::_render_imgui_select_plate_toolbar()
|
||||||
if (slice_failed)
|
if (slice_failed)
|
||||||
all_plates_stats_item->slice_state = IMToolbarItem::SliceState::SLICE_FAILED;
|
all_plates_stats_item->slice_state = IMToolbarItem::SliceState::SLICE_FAILED;
|
||||||
|
|
||||||
if (all_plates_stats_item->selected && all_plates_stats_item->slice_state == IMToolbarItem::SliceState::SLICED) {
|
// Changing parameters does not invalid all plates, need extra logic to validate
|
||||||
|
bool gcode_result_valid = true;
|
||||||
|
for (auto gcode_result : plate_list.get_nonempty_plates_slice_results()) {
|
||||||
|
if (gcode_result->moves.size() == 0) {
|
||||||
|
gcode_result_valid = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (all_plates_stats_item->selected && all_plates_stats_item->slice_state == IMToolbarItem::SliceState::SLICED && gcode_result_valid) {
|
||||||
m_gcode_viewer.render_all_plates_stats(plate_list.get_nonempty_plates_slice_results());
|
m_gcode_viewer.render_all_plates_stats(plate_list.get_nonempty_plates_slice_results());
|
||||||
m_render_preview = false;
|
m_render_preview = false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue