From b11e65164916532762911ca998351879478e7545 Mon Sep 17 00:00:00 2001 From: YuSanka Date: Tue, 20 Dec 2022 14:41:50 +0100 Subject: [PATCH] ObjectList Improvements: Show object manipulation panel, when all object's parts are selected --- src/slic3r/GUI/GUI_ObjectList.cpp | 78 ++++++++++++++++++------------- 1 file changed, 45 insertions(+), 33 deletions(-) diff --git a/src/slic3r/GUI/GUI_ObjectList.cpp b/src/slic3r/GUI/GUI_ObjectList.cpp index 3d55e2174..6de339a7f 100644 --- a/src/slic3r/GUI/GUI_ObjectList.cpp +++ b/src/slic3r/GUI/GUI_ObjectList.cpp @@ -2660,47 +2660,59 @@ void ObjectList::part_selection_changed() disable_ununiform_scale = true; } else if ( multiple_selection() || (item && m_objects_model->GetItemType(item) == itInstanceRoot )) { - og_name = _L("Group manipulation"); - const Selection& selection = scene_selection(); - // don't show manipulation panel for case of all Object's parts selection - update_and_show_manipulations = !selection.is_single_full_instance(); - if (int obj_idx = selection.get_object_idx(); obj_idx >= 0) { - if (selection.is_any_volume() || selection.is_any_modifier()) - enable_manipulation = !(*m_objects)[obj_idx]->is_cut(); - else// if (item && m_objects_model->GetItemType(item) == itInstanceRoot) - disable_ss_manipulation = (*m_objects)[obj_idx]->is_cut(); + if (selection.is_single_full_object()) { + og_name = _L("Object manipulation"); + update_and_show_manipulations = true; + + obj_idx = selection.get_object_idx(); + ModelObject* object = (*m_objects)[obj_idx]; + m_config = &object->config; + disable_ss_manipulation = object->is_cut(); } else { - wxDataViewItemArray sels; - GetSelections(sels); - if (selection.is_single_full_object() || selection.is_multiple_full_instance() ) { - int obj_idx = m_objects_model->GetObjectIdByItem(sels.front()); - disable_ss_manipulation = (*m_objects)[obj_idx]->is_cut(); + og_name = _L("Group manipulation"); + + // don't show manipulation panel for case of all Object's parts selection + update_and_show_manipulations = !selection.is_single_full_instance(); + + if (int obj_idx = selection.get_object_idx(); obj_idx >= 0) { + if (selection.is_any_volume() || selection.is_any_modifier()) + enable_manipulation = !(*m_objects)[obj_idx]->is_cut(); + else// if (item && m_objects_model->GetItemType(item) == itInstanceRoot) + disable_ss_manipulation = (*m_objects)[obj_idx]->is_cut(); } - else if (selection.is_mixed() || selection.is_multiple_full_object()) { - std::map> cut_objects; - - // find cut objects - for (auto item : sels) { - int obj_idx = m_objects_model->GetObjectIdByItem(item); - const ModelObject* obj = object(obj_idx); - if (obj->is_cut()) { - if (cut_objects.find(obj->cut_id) == cut_objects.end()) - cut_objects[obj->cut_id] = std::set{ obj_idx }; - else - cut_objects.at(obj->cut_id).insert(obj_idx); - } + else { + wxDataViewItemArray sels; + GetSelections(sels); + if (selection.is_single_full_object() || selection.is_multiple_full_instance() ) { + int obj_idx = m_objects_model->GetObjectIdByItem(sels.front()); + disable_ss_manipulation = (*m_objects)[obj_idx]->is_cut(); } + else if (selection.is_mixed() || selection.is_multiple_full_object()) { + std::map> cut_objects; - // check if selected cut objects are "full selected" - for (auto cut_object : cut_objects) - if (cut_object.first.check_sum() != cut_object.second.size()) { - disable_ss_manipulation = true; - break; + // find cut objects + for (auto item : sels) { + int obj_idx = m_objects_model->GetObjectIdByItem(item); + const ModelObject* obj = object(obj_idx); + if (obj->is_cut()) { + if (cut_objects.find(obj->cut_id) == cut_objects.end()) + cut_objects[obj->cut_id] = std::set{ obj_idx }; + else + cut_objects.at(obj->cut_id).insert(obj_idx); + } } - disable_ununiform_scale = !cut_objects.empty(); + + // check if selected cut objects are "full selected" + for (auto cut_object : cut_objects) + if (cut_object.first.check_sum() != cut_object.second.size()) { + disable_ss_manipulation = true; + break; + } + disable_ununiform_scale = !cut_objects.empty(); + } } } }