#7326 - Fixed crash when starting GCodeViewer

This commit is contained in:
enricoturri1966 2021-11-22 10:57:38 +01:00
parent 1b7975639e
commit a4baecb340
4 changed files with 21 additions and 13 deletions

View file

@ -3867,18 +3867,20 @@ void Plater::priv::set_current_panel(wxPanel* panel)
preview->get_canvas3d()->bind_event_handlers();
// see: Plater::priv::object_list_changed()
// FIXME: it may be better to have a single function making this check and let it be called wherever needed
bool export_in_progress = this->background_process.is_export_scheduled();
bool model_fits = view3D->get_canvas3d()->check_volumes_outside_state() != ModelInstancePVS_Partly_Outside;
if (!model.objects.empty() && !export_in_progress && model_fits) {
if (wxGetApp().is_editor()) {
// see: Plater::priv::object_list_changed()
// FIXME: it may be better to have a single function making this check and let it be called wherever needed
bool export_in_progress = this->background_process.is_export_scheduled();
bool model_fits = view3D->get_canvas3d()->check_volumes_outside_state() != ModelInstancePVS_Partly_Outside;
if (!model.objects.empty() && !export_in_progress && model_fits) {
#if ENABLE_SEAMS_USING_MODELS
preview->get_canvas3d()->init_gcode_viewer();
preview->get_canvas3d()->init_gcode_viewer();
#endif // ENABLE_SEAMS_USING_MODELS
q->reslice();
q->reslice();
}
// keeps current gcode preview, if any
preview->reload_print(true);
}
// keeps current gcode preview, if any
preview->reload_print(true);
preview->set_as_dirty();
// reset cached size to force a resize on next call to render() to keep imgui in synch with canvas size