mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-11 16:57:53 -06:00
Volumes selected from the sidebar table taken from the currently selected instance
This commit is contained in:
parent
98c976dd9f
commit
49fe8a9f08
1 changed files with 8 additions and 6 deletions
|
@ -2033,7 +2033,7 @@ void ObjectList::update_selections_on_canvas()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto add_to_selection = [this](const wxDataViewItem& item, Selection& selection, bool as_single_selection)
|
auto add_to_selection = [this](const wxDataViewItem& item, Selection& selection, int instance_idx, bool as_single_selection)
|
||||||
{
|
{
|
||||||
if (m_objects_model->GetParent(item) == wxDataViewItem(0)) {
|
if (m_objects_model->GetParent(item) == wxDataViewItem(0)) {
|
||||||
selection.add_object(m_objects_model->GetIdByItem(item), as_single_selection);
|
selection.add_object(m_objects_model->GetIdByItem(item), as_single_selection);
|
||||||
|
@ -2043,7 +2043,7 @@ void ObjectList::update_selections_on_canvas()
|
||||||
if (m_objects_model->GetItemType(item) == itVolume) {
|
if (m_objects_model->GetItemType(item) == itVolume) {
|
||||||
const int obj_idx = m_objects_model->GetIdByItem(m_objects_model->GetParent(item));
|
const int obj_idx = m_objects_model->GetIdByItem(m_objects_model->GetParent(item));
|
||||||
const int vol_idx = m_objects_model->GetVolumeIdByItem(item);
|
const int vol_idx = m_objects_model->GetVolumeIdByItem(item);
|
||||||
selection.add_volume(obj_idx, vol_idx, 0, as_single_selection);
|
selection.add_volume(obj_idx, vol_idx, std::max(instance_idx, 0), as_single_selection);
|
||||||
}
|
}
|
||||||
else if (m_objects_model->GetItemType(item) == itInstance) {
|
else if (m_objects_model->GetItemType(item) == itInstance) {
|
||||||
const int obj_idx = m_objects_model->GetIdByItem(m_objects_model->GetTopParent(item));
|
const int obj_idx = m_objects_model->GetIdByItem(m_objects_model->GetTopParent(item));
|
||||||
|
@ -2055,10 +2055,10 @@ void ObjectList::update_selections_on_canvas()
|
||||||
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, true);
|
add_to_selection(m_objects_model->GetParent(item), selection, -1, true);
|
||||||
else
|
else
|
||||||
add_to_selection(item, selection, true);
|
add_to_selection(item, selection, -1, true);
|
||||||
|
|
||||||
wxGetApp().plater()->canvas3D()->update_gizmos_on_off_state();
|
wxGetApp().plater()->canvas3D()->update_gizmos_on_off_state();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -2066,9 +2066,11 @@ 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, false);
|
add_to_selection(item, selection, instance_idx, false);
|
||||||
|
|
||||||
wxGetApp().plater()->canvas3D()->update_gizmos_on_off_state();
|
wxGetApp().plater()->canvas3D()->update_gizmos_on_off_state();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue