#7326 - Fixed crash when starting GCodeViewer
This commit is contained in:
parent
1b7975639e
commit
a4baecb340
4 changed files with 21 additions and 13 deletions
|
@ -252,12 +252,16 @@ void Bed3D::render_internal(GLCanvas3D& canvas, bool bottom, float scale_factor,
|
|||
BoundingBoxf3 Bed3D::calc_extended_bounding_box() const
|
||||
{
|
||||
BoundingBoxf3 out { m_build_volume.bounding_volume() };
|
||||
const Vec3d size = out.size();
|
||||
// ensures that the bounding box is set as defined or the following calls to merge() will not work as intented
|
||||
if (size.x() > 0.0 && size.y() > 0.0 && !out.defined)
|
||||
out.defined = true;
|
||||
// Reset the build volume Z, we don't want to zoom to the top of the build volume if it is empty.
|
||||
out.min.z() = 0;
|
||||
out.max.z() = 0;
|
||||
out.min.z() = 0.0;
|
||||
out.max.z() = 0.0;
|
||||
// extend to contain axes
|
||||
out.merge(m_axes.get_origin() + m_axes.get_total_length() * Vec3d::Ones());
|
||||
out.merge(out.min + Vec3d(-Axes::DefaultTipRadius, -Axes::DefaultTipRadius, out.max(2)));
|
||||
out.merge(out.min + Vec3d(-Axes::DefaultTipRadius, -Axes::DefaultTipRadius, out.max.z()));
|
||||
// extend to contain model, if any
|
||||
BoundingBoxf3 model_bb = m_model.get_bounding_box();
|
||||
if (model_bb.defined) {
|
||||
|
|
|
@ -1119,6 +1119,8 @@ void GLCanvas3D::reset_volumes()
|
|||
|
||||
ModelInstanceEPrintVolumeState GLCanvas3D::check_volumes_outside_state() const
|
||||
{
|
||||
assert(m_initialized);
|
||||
|
||||
ModelInstanceEPrintVolumeState state;
|
||||
m_volumes.check_outside_state(m_bed.build_volume(), &state);
|
||||
return state;
|
||||
|
|
|
@ -486,7 +486,7 @@ void MainFrame::update_layout()
|
|||
case ESettingsLayout::GCodeViewer:
|
||||
{
|
||||
m_main_sizer->Add(m_plater, 1, wxEXPAND);
|
||||
m_plater->set_bed_shape({ { 0.0, 0.0 }, { 200.0, 0.0 }, { 200.0, 200.0 }, { 0.0, 200.0 } }, 0, {}, {}, true);
|
||||
m_plater->set_bed_shape({ { 0.0, 0.0 }, { 200.0, 0.0 }, { 200.0, 200.0 }, { 0.0, 200.0 } }, 0.0, {}, {}, true);
|
||||
m_plater->get_collapse_toolbar().set_enabled(false);
|
||||
m_plater->collapse_sidebar(true);
|
||||
m_plater->Show();
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue