Fixed object/part splitting

If object has additional settings and we split it, add this settings for each of the new objects(parts)
This commit is contained in:
YuSanka 2018-11-06 09:06:26 +01:00
parent 95af5c7cc6
commit 4a8b738a6b
3 changed files with 79 additions and 41 deletions

View file

@ -714,6 +714,39 @@ void PrusaObjectDataViewModel::DeleteChildren(wxDataViewItem& parent)
#endif //__WXGTK__
}
void PrusaObjectDataViewModel::DeleteVolumeChildren(wxDataViewItem& parent)
{
PrusaObjectDataViewModelNode *root = (PrusaObjectDataViewModelNode*)parent.GetID();
if (!root) // happens if item.IsOk()==false
return;
// first remove the node from the parent's array of children;
// NOTE: MyObjectTreeModelNodePtrArray is only an array of _pointers_
// thus removing the node from it doesn't result in freeing it
auto& children = root->GetChildren();
for (int id = root->GetChildCount() - 1; id >= 0; --id)
{
auto node = children[id];
if (node->m_type != itVolume)
continue;
auto item = wxDataViewItem(node);
children.RemoveAt(id);
root->m_volumes_cnt--;
// free the node
delete node;
// notify control
ItemDeleted(parent, item);
}
// set m_containet to FALSE if parent has no child
#ifndef __WXGTK__
root->m_container = false;
#endif //__WXGTK__
}
wxDataViewItem PrusaObjectDataViewModel::GetItemById(int obj_idx)
{
if (obj_idx >= m_objects.size())