FIX: [STUDIO-1369] backup object mesh when renaming

Change-Id: I17644b732a0a476ca3d5b4cf61c0f5b53b81eaa6
This commit is contained in:
chunmao.guo 2022-11-17 11:44:22 +08:00 committed by Lane.Wei
parent aac34a5411
commit 662cfb6f7b
1 changed files with 8 additions and 4 deletions

View File

@ -847,10 +847,14 @@ void ObjectList::update_name_in_model(const wxDataViewItem& item) const
ModelObject* obj = object(obj_idx); ModelObject* obj = object(obj_idx);
if (m_objects_model->GetItemType(item) & itObject) { if (m_objects_model->GetItemType(item) & itObject) {
obj->name = m_objects_model->GetName(item).ToUTF8().data(); std::string name = m_objects_model->GetName(item).ToUTF8().data();
// if object has just one volume, rename this volume too if (obj->name != name) {
if (obj->volumes.size() == 1) obj->name = name;
obj->volumes[0]->name = obj->name; // if object has just one volume, rename this volume too
if (obj->volumes.size() == 1)
obj->volumes[0]->name = obj->name;
Slic3r::save_object_mesh(*obj);
}
return; return;
} }