Fixed crash when deleting sla support points
This commit is contained in:
parent
c108cc9045
commit
6997f7f5b5
@ -1378,11 +1378,24 @@ bool GLCanvas3D::Selection::is_single_full_instance() const
|
||||
if (m_type == SingleFullInstance)
|
||||
return true;
|
||||
|
||||
int object_idx = m_valid ? get_object_idx() : -1;
|
||||
if ((0 <= object_idx) && (object_idx < (int)m_model->objects.size()))
|
||||
return m_model->objects[object_idx]->volumes.size() == m_list.size();
|
||||
if (m_list.empty() || m_volumes->empty())
|
||||
return false;
|
||||
|
||||
return false;
|
||||
int object_idx = m_valid ? get_object_idx() : -1;
|
||||
if (object_idx == -1)
|
||||
return false;
|
||||
|
||||
int instance_idx = (*m_volumes)[*m_list.begin()]->instance_idx();
|
||||
|
||||
std::set<int> volumes_idxs;
|
||||
for (const GLVolume* v : *m_volumes)
|
||||
{
|
||||
int volume_idx = v->volume_idx();
|
||||
if ((v->object_idx() == object_idx) && (v->instance_idx() == instance_idx) && (volume_idx >= 0))
|
||||
volumes_idxs.insert(volume_idx);
|
||||
}
|
||||
|
||||
return m_model->objects[object_idx]->volumes.size() == volumes_idxs.size();
|
||||
}
|
||||
|
||||
bool GLCanvas3D::Selection::is_from_single_object() const
|
||||
|
@ -1768,6 +1768,8 @@ void GLGizmoSlaSupports::set_sla_support_data(ModelObject* model_object, const G
|
||||
m_starting_center = Vec3d::Zero();
|
||||
m_old_model_object = m_model_object;
|
||||
m_model_object = model_object;
|
||||
if (selection.is_empty())
|
||||
m_old_instance_id = -1;
|
||||
|
||||
if ((model_object != nullptr) && selection.is_from_single_instance())
|
||||
{
|
||||
@ -2048,8 +2050,10 @@ void GLGizmoSlaSupports::clicked_on_object(const Vec2d& mouse_position)
|
||||
int instance_id = m_parent.get_selection().get_instance_idx();
|
||||
if (m_old_instance_id != instance_id)
|
||||
{
|
||||
bool something_selected = (m_old_instance_id != -1);
|
||||
m_old_instance_id = instance_id;
|
||||
return;
|
||||
if (something_selected)
|
||||
return;
|
||||
}
|
||||
if (instance_id == -1)
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user