Added SETTINGS_SELECTED_ON_SIDEBAR flag to undo/redo
This commit is contained in:
parent
b34252bf0f
commit
4245b61afc
4 changed files with 42 additions and 8 deletions
src/slic3r/GUI
|
@ -2638,7 +2638,8 @@ void ObjectList::update_selections()
|
|||
const Selection& selection = wxGetApp().plater()->canvas3D()->get_selection();
|
||||
wxDataViewItemArray sels;
|
||||
|
||||
m_selection_mode = smInstance;
|
||||
if (m_selection_mode & smSettings == 0)
|
||||
m_selection_mode = smInstance;
|
||||
|
||||
// We doesn't update selection if SettingsItem for the current object/part is selected
|
||||
// if (GetSelectedItemsCount() == 1 && m_objects_model->GetItemType(GetSelection()) == itSettings )
|
||||
|
@ -2664,6 +2665,12 @@ void ObjectList::update_selections()
|
|||
else if (selection.is_single_full_object() || selection.is_multiple_full_object())
|
||||
{
|
||||
const Selection::ObjectIdxsToInstanceIdxsMap& objects_content = selection.get_content();
|
||||
if (m_selection_mode & smSettings)
|
||||
{
|
||||
wxDataViewItem obj_item = m_objects_model->GetItemById(objects_content.begin()->first);
|
||||
sels.Add(m_objects_model->GetSettingsItem(obj_item));
|
||||
}
|
||||
else {
|
||||
for (const auto& object : objects_content) {
|
||||
if (object.second.size() == 1) // object with 1 instance
|
||||
sels.Add(m_objects_model->GetItemById(object.first));
|
||||
|
@ -2688,10 +2695,23 @@ void ObjectList::update_selections()
|
|||
for (const auto& inst : instances)
|
||||
sels.Add(m_objects_model->GetItemByInstanceId(object.first, inst));
|
||||
}
|
||||
}
|
||||
} }
|
||||
}
|
||||
else if (selection.is_any_volume() || selection.is_any_modifier())
|
||||
{
|
||||
if (m_selection_mode & smSettings)
|
||||
{
|
||||
const auto idx = *selection.get_volume_idxs().begin();
|
||||
const auto gl_vol = selection.get_volume(idx);
|
||||
if (gl_vol->volume_idx() >= 0) {
|
||||
// Only add GLVolumes with non-negative volume_ids. GLVolumes with negative volume ids
|
||||
// are not associated with ModelVolumes, but they are temporarily generated by the backend
|
||||
// (for example, SLA supports or SLA pad).
|
||||
wxDataViewItem vol_item = m_objects_model->GetItemByVolumeId(gl_vol->object_idx(), gl_vol->volume_idx());
|
||||
sels.Add(m_objects_model->GetSettingsItem(vol_item));
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (auto idx : selection.get_volume_idxs()) {
|
||||
const auto gl_vol = selection.get_volume(idx);
|
||||
if (gl_vol->volume_idx() >= 0)
|
||||
|
@ -2700,7 +2720,7 @@ void ObjectList::update_selections()
|
|||
// (for example, SLA supports or SLA pad).
|
||||
sels.Add(m_objects_model->GetItemByVolumeId(gl_vol->object_idx(), gl_vol->volume_idx()));
|
||||
}
|
||||
m_selection_mode = smVolume;
|
||||
m_selection_mode = smVolume; }
|
||||
}
|
||||
else if (selection.is_single_full_instance() || selection.is_multiple_full_instance())
|
||||
{
|
||||
|
@ -2744,7 +2764,7 @@ void ObjectList::update_selections()
|
|||
}
|
||||
}
|
||||
|
||||
if (sels.size() == 0)
|
||||
if (sels.size() == 0 || m_selection_mode & smSettings)
|
||||
m_selection_mode = smUndef;
|
||||
|
||||
select_items(sels);
|
||||
|
@ -3522,15 +3542,16 @@ void ObjectList::set_extruder_for_selected_items(const int extruder) const
|
|||
|
||||
void ObjectList::update_after_undo_redo()
|
||||
{
|
||||
m_prevent_list_events = true;
|
||||
m_prevent_canvas_selection_update = true;
|
||||
|
||||
Plater::SuppressSnapshots suppress(wxGetApp().plater());
|
||||
|
||||
// Unselect all objects before deleting them, so that no change of selection is emitted during deletion.
|
||||
this->UnselectAll();
|
||||
unselect_objects();//this->UnselectAll();
|
||||
m_objects_model->DeleteAll();
|
||||
|
||||
// m_prevent_list_events = true;
|
||||
|
||||
size_t obj_idx = 0;
|
||||
while (obj_idx < m_objects->size()) {
|
||||
add_object_to_list(obj_idx, false);
|
||||
|
@ -3544,7 +3565,7 @@ void ObjectList::update_after_undo_redo()
|
|||
update_selections();
|
||||
|
||||
m_prevent_canvas_selection_update = false;
|
||||
m_prevent_list_events = false;
|
||||
// m_prevent_list_events = false;
|
||||
}
|
||||
|
||||
ModelObject* ObjectList::object(const int obj_idx) const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue