Fix crash when returning to the Design tab after committing a body to the plate

The Design view drew sinking outlines by looking up its bodies in the
plate's model, reading past the end of an object's volumes once a body
was committed. The Design canvas no longer draws sinking outlines.
This commit is contained in:
SoftFever
2026-10-05 16:22:52 +08:00
parent e7545f0bc0
commit fa56a9cfeb
3 changed files with 6 additions and 1 deletions
+1
View File
@@ -85,6 +85,7 @@ DesignCanvas::DesignCanvas(wxWindow* parent)
m_canvas->enable_collapse_toolbar(false);
m_canvas->enable_plate_chrome(false);
m_canvas->enable_labels(false);
m_canvas->enable_sinking_contours(false); // they would be sliced from the plater's meshes
m_canvas->set_axes_at_bed_center(true); // triad at bed centre = modeling origin
m_canvas->set_design_sketch_tool(&m_sketch_tool);
+1 -1
View File
@@ -8753,7 +8753,7 @@ void GLCanvas3D::_render_objects(GLVolumeCollection::ERenderType type, bool with
else {
m_volumes.set_clipping_plane(m_camera_clipping_plane.get_data());
}
if (m_canvas_type == CanvasAssembleView)
if (m_canvas_type == CanvasAssembleView || !m_sinking_contours_enabled)
m_volumes.set_show_sinking_contours(false);
else
m_volumes.set_show_sinking_contours(!m_gizmos.is_hiding_instances());
+4
View File
@@ -606,6 +606,9 @@ private:
// Design tab: draw the printer bed and its plate grid at all. Default true, so the
// main editor is untouched; the Design tab lets the user hide it to model without a bed.
bool m_show_bed{true};
// Design tab: draw the outline where a volume crosses the bed. GLVolume::SinkingContours slices
// the plater model's mesh by the volume's ids, so a canvas over its own Model must turn it off.
bool m_sinking_contours_enabled{true};
// Design tab: CAD grid drawn on the bed plane in place of the plate's corner-origin grid.
// Two GLModels (10 mm minor / 50 mm major) generated from the bed centre so a line passes
// exactly through the modeling origin; built once and rebuilt only when the bed shape changes.
@@ -1021,6 +1024,7 @@ public:
void set_axes_at_bed_center(bool b) { m_axes_at_bed_center = b; }
void set_show_bed(bool b) { m_show_bed = b; }
bool get_show_bed() const { return m_show_bed; }
void enable_sinking_contours(bool enable) { m_sinking_contours_enabled = enable; }
#ifdef SLIC3R_CAD
void set_design_sketch_tool(DesignSketchTool* tool) { m_design_sketch_tool = tool; }
DesignSketchTool* get_design_sketch_tool() const { return m_design_sketch_tool; }