Fixed ObjectList::last_volume_is_deleted() to avoid clearing volume[0].config after undo/redo

This commit is contained in:
YuSanka 2019-07-23 17:09:19 +02:00
parent a121253520
commit 804e1b1939
2 changed files with 3 additions and 3 deletions

View File

@ -1741,7 +1741,7 @@ void ObjectList::del_subobject_item(wxDataViewItem& item)
ItemType type;
m_objects_model->GetItemInfo(item, type, obj_idx, idx);
if (type & itUndef)
if (type == itUndef)
return;
if (type & itSettings)
@ -3101,7 +3101,7 @@ void ObjectList::change_part_type()
void ObjectList::last_volume_is_deleted(const int obj_idx)
{
if (obj_idx < 0 || obj_idx >= m_objects->size() || (*m_objects)[obj_idx]->volumes.empty())
if (obj_idx < 0 || obj_idx >= m_objects->size() || (*m_objects)[obj_idx]->volumes.size() != 1)
return;
auto volume = (*m_objects)[obj_idx]->volumes.front();

View File

@ -1508,7 +1508,7 @@ ItemType ObjectDataViewModel::GetItemType(const wxDataViewItem &item) const
if (!item.IsOk())
return itUndef;
ObjectDataViewModelNode *node = (ObjectDataViewModelNode*)item.GetID();
return node->m_type;
return node->m_type < 0 ? itUndef : node->m_type;
}
wxDataViewItem ObjectDataViewModel::GetItemByType(const wxDataViewItem &parent_item, ItemType type) const