SLA gizmo fix: Discarding manual edits on autogenerated points removed all the points from the gizmo cache

This commit is contained in:
Lukas Matena 2019-04-10 15:25:20 +02:00
parent 2dc88ab0be
commit 096d23f971

View file

@ -820,11 +820,19 @@ void GLGizmoSlaSupports::unselect_point(int i)
void GLGizmoSlaSupports::editing_mode_discard_changes() void GLGizmoSlaSupports::editing_mode_discard_changes()
{ {
m_editing_mode_cache.clear(); // If the points were autogenerated, they may not be on the ModelObject yet.
for (const sla::SupportPoint& point : m_model_object->sla_support_points) // Because the user probably messed with the cache, we will get the data
m_editing_mode_cache.emplace_back(point, false); // from the backend again.
m_editing_mode = false;
m_unsaved_changes = false; 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;
} }