From 096d23f9712496146bbdfd01229ffc16c290df8c Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Wed, 10 Apr 2019 15:25:20 +0200 Subject: [PATCH] SLA gizmo fix: Discarding manual edits on autogenerated points removed all the points from the gizmo cache --- src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp b/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp index 8c8f24ba0..74c6faa85 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp @@ -820,11 +820,19 @@ void GLGizmoSlaSupports::unselect_point(int i) void GLGizmoSlaSupports::editing_mode_discard_changes() { - m_editing_mode_cache.clear(); - for (const sla::SupportPoint& point : m_model_object->sla_support_points) - m_editing_mode_cache.emplace_back(point, false); - m_editing_mode = false; - m_unsaved_changes = false; + // If the points were autogenerated, they may not be on the ModelObject yet. + // Because the user probably messed with the cache, we will get the data + // from the backend again. + + if (m_model_object->sla_points_status == sla::PointsStatus::AutoGenerated) + get_data_from_backend(); + else { + m_editing_mode_cache.clear(); + for (const sla::SupportPoint& point : m_model_object->sla_support_points) + m_editing_mode_cache.emplace_back(point, false); + } + m_editing_mode = false; + m_unsaved_changes = false; }