ObjectList Improvements: Show object manipulation panel, when all object's parts are selected

This commit is contained in:
YuSanka 2022-12-20 14:41:50 +01:00
parent 5f75d61d49
commit b11e651649

View File

@ -2660,47 +2660,59 @@ void ObjectList::part_selection_changed()
disable_ununiform_scale = true; disable_ununiform_scale = true;
} }
else if ( multiple_selection() || (item && m_objects_model->GetItemType(item) == itInstanceRoot )) { else if ( multiple_selection() || (item && m_objects_model->GetItemType(item) == itInstanceRoot )) {
og_name = _L("Group manipulation");
const Selection& selection = scene_selection(); 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_single_full_object()) {
if (selection.is_any_volume() || selection.is_any_modifier()) og_name = _L("Object manipulation");
enable_manipulation = !(*m_objects)[obj_idx]->is_cut(); update_and_show_manipulations = true;
else// if (item && m_objects_model->GetItemType(item) == itInstanceRoot)
disable_ss_manipulation = (*m_objects)[obj_idx]->is_cut(); obj_idx = selection.get_object_idx();
ModelObject* object = (*m_objects)[obj_idx];
m_config = &object->config;
disable_ss_manipulation = object->is_cut();
} }
else { else {
wxDataViewItemArray sels; og_name = _L("Group manipulation");
GetSelections(sels);
if (selection.is_single_full_object() || selection.is_multiple_full_instance() ) { // don't show manipulation panel for case of all Object's parts selection
int obj_idx = m_objects_model->GetObjectIdByItem(sels.front()); update_and_show_manipulations = !selection.is_single_full_instance();
disable_ss_manipulation = (*m_objects)[obj_idx]->is_cut();
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()) { else {
std::map<CutObjectBase, std::set<int>> cut_objects; wxDataViewItemArray sels;
GetSelections(sels);
// find cut objects if (selection.is_single_full_object() || selection.is_multiple_full_instance() ) {
for (auto item : sels) { int obj_idx = m_objects_model->GetObjectIdByItem(sels.front());
int obj_idx = m_objects_model->GetObjectIdByItem(item); disable_ss_manipulation = (*m_objects)[obj_idx]->is_cut();
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<int>{ obj_idx };
else
cut_objects.at(obj->cut_id).insert(obj_idx);
}
} }
else if (selection.is_mixed() || selection.is_multiple_full_object()) {
std::map<CutObjectBase, std::set<int>> cut_objects;
// check if selected cut objects are "full selected" // find cut objects
for (auto cut_object : cut_objects) for (auto item : sels) {
if (cut_object.first.check_sum() != cut_object.second.size()) { int obj_idx = m_objects_model->GetObjectIdByItem(item);
disable_ss_manipulation = true; const ModelObject* obj = object(obj_idx);
break; if (obj->is_cut()) {
if (cut_objects.find(obj->cut_id) == cut_objects.end())
cut_objects[obj->cut_id] = std::set<int>{ 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();
}
} }
} }
} }