Select newly added parts/volumes from current selected instance when adding from 3D scene's context menu

This commit is contained in:
Enrico Turri 2019-04-04 09:35:13 +02:00
parent c29f7bc147
commit 936f7a3b84

View File

@ -2051,12 +2051,15 @@ void ObjectList::update_selections_on_canvas()
} }
}; };
// stores current instance idx before to clear the selection
int instance_idx = selection.get_instance_idx();
if (sel_cnt == 1) { if (sel_cnt == 1) {
wxDataViewItem item = GetSelection(); wxDataViewItem item = GetSelection();
if (m_objects_model->GetItemType(item) & (itSettings|itInstanceRoot)) if (m_objects_model->GetItemType(item) & (itSettings|itInstanceRoot))
add_to_selection(m_objects_model->GetParent(item), selection, -1, true); add_to_selection(m_objects_model->GetParent(item), selection, -1, true);
else else
add_to_selection(item, selection, -1, true); add_to_selection(item, selection, instance_idx, true);
wxGetApp().plater()->canvas3D()->update_gizmos_on_off_state(); wxGetApp().plater()->canvas3D()->update_gizmos_on_off_state();
return; return;
@ -2065,8 +2068,6 @@ void ObjectList::update_selections_on_canvas()
wxDataViewItemArray sels; wxDataViewItemArray sels;
GetSelections(sels); GetSelections(sels);
// stores current instance idx before to clear the selection
int instance_idx = selection.get_instance_idx();
selection.clear(); selection.clear();
for (auto item: sels) for (auto item: sels)
add_to_selection(item, selection, instance_idx, false); add_to_selection(item, selection, instance_idx, false);