Fixed splitting of the objects with instances

This commit is contained in:
YuSanka 2018-11-01 16:22:16 +01:00
parent 2200e42174
commit 618d0e4910
3 changed files with 6 additions and 2 deletions

View file

@ -1115,6 +1115,9 @@ void ObjectList::add_object_to_list(size_t obj_idx)
Expand(item); Expand(item);
} }
if (model_object->instances.size()>1)
increase_object_instances(obj_idx, model_object->instances.size());
#ifndef __WXOSX__ #ifndef __WXOSX__
selection_changed(); selection_changed();
#endif //__WXMSW__ #endif //__WXMSW__

View file

@ -270,7 +270,8 @@ void ObjectManipulation::update_settings_value(const GLCanvas3D::Selection& sele
{ {
if (selection.is_single_full_object()) if (selection.is_single_full_object())
{ {
if (!wxGetApp().model_objects()->empty() && (*wxGetApp().model_objects())[selection.get_object_idx()]->instances.size() == 1) auto obj_idx = selection.get_object_idx();
if (obj_idx >=0 && !wxGetApp().model_objects()->empty() && (*wxGetApp().model_objects())[obj_idx]->instances.size() == 1)
{ {
// all volumes in the selection belongs to the same instance, any of them contains the needed data, so we take the first // all volumes in the selection belongs to the same instance, any of them contains the needed data, so we take the first
const GLVolume* volume = selection.get_volume(*selection.get_volume_idxs().begin()); const GLVolume* volume = selection.get_volume(*selection.get_volume_idxs().begin());

View file

@ -528,7 +528,7 @@ wxDataViewItem PrusaObjectDataViewModel::AddInstanceChild(const wxDataViewItem &
parent_node->Insert(inst_root_node, insert_pos); parent_node->Insert(inst_root_node, insert_pos);
// notify control // notify control
ItemAdded(parent_item, inst_root_item); ItemAdded(parent_item, inst_root_item);
num++; if (num == 1) num++;
} }
// Add instance nodes // Add instance nodes