Fixed update of objects list in sidebar after deleting a part from a sinking object

This commit is contained in:
enricoturri1966 2021-08-26 08:06:37 +02:00
parent ca098d5763
commit 08b91d33e9

View File

@ -2730,8 +2730,9 @@ void ObjectList::delete_from_model_and_list(const std::vector<ItemForDelete>& it
return; return;
m_prevent_list_events = true; m_prevent_list_events = true;
for (std::vector<ItemForDelete>::const_reverse_iterator item = items_for_delete.rbegin(); item != items_for_delete.rend(); ++item)
{ std::set<size_t> modified_objects_ids;
for (std::vector<ItemForDelete>::const_reverse_iterator item = items_for_delete.rbegin(); item != items_for_delete.rend(); ++item) {
if (!(item->type&(itObject | itVolume | itInstance))) if (!(item->type&(itObject | itVolume | itInstance)))
continue; continue;
if (item->type&itObject) { if (item->type&itObject) {
@ -2741,8 +2742,7 @@ void ObjectList::delete_from_model_and_list(const std::vector<ItemForDelete>& it
else { else {
if (!del_subobject_from_object(item->obj_idx, item->sub_obj_idx, item->type)) if (!del_subobject_from_object(item->obj_idx, item->sub_obj_idx, item->type))
continue; continue;
if (item->type&itVolume) if (item->type&itVolume) {
{
m_objects_model->Delete(m_objects_model->GetItemByVolumeId(item->obj_idx, item->sub_obj_idx)); m_objects_model->Delete(m_objects_model->GetItemByVolumeId(item->obj_idx, item->sub_obj_idx));
ModelObject* obj = object(item->obj_idx); ModelObject* obj = object(item->obj_idx);
if (obj->volumes.size() == 1) { if (obj->volumes.size() == 1) {
@ -2760,7 +2760,14 @@ void ObjectList::delete_from_model_and_list(const std::vector<ItemForDelete>& it
else else
m_objects_model->Delete(m_objects_model->GetItemByInstanceId(item->obj_idx, item->sub_obj_idx)); m_objects_model->Delete(m_objects_model->GetItemByInstanceId(item->obj_idx, item->sub_obj_idx));
} }
modified_objects_ids.insert(static_cast<size_t>(item->obj_idx));
} }
for (size_t id : modified_objects_ids) {
update_info_items(id);
}
m_prevent_list_events = true; m_prevent_list_events = true;
part_selection_changed(); part_selection_changed();
} }