mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-07-19 17:04:31 +08:00
Cut bug fixing:
Model: fixed looks_like_imperial_units(). This function respects to cut status now. To be detected as looks_like_imperial_units, all parts of cat object have to be looks_like_imperial_units(). ObjectList: Fixed update after adding/deleting of the modifiers for cut object GUI_Factories: Fixed a place of the "Invalidate cut info" item in object menu
This commit is contained in:
parent
64c57faf8f
commit
13e4e85e3d
@ -464,12 +464,25 @@ static constexpr const double volume_threshold_inches = 9.0; // 9 = 3*3*3;
|
|||||||
|
|
||||||
bool Model::looks_like_imperial_units() const
|
bool Model::looks_like_imperial_units() const
|
||||||
{
|
{
|
||||||
if (this->objects.size() == 0)
|
if (this->objects.empty())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
for (ModelObject* obj : this->objects)
|
for (ModelObject* obj : this->objects)
|
||||||
if (obj->get_object_stl_stats().volume < volume_threshold_inches)
|
if (obj->get_object_stl_stats().volume < volume_threshold_inches) {
|
||||||
return true;
|
if (!obj->is_cut())
|
||||||
|
return true;
|
||||||
|
bool all_cut_parts_look_like_imperial_units = true;
|
||||||
|
for (ModelObject* obj_other : this->objects) {
|
||||||
|
if (obj_other == obj)
|
||||||
|
continue;
|
||||||
|
if (obj_other->cut_id.is_equal(obj->cut_id) && obj_other->get_object_stl_stats().volume >= volume_threshold_inches) {
|
||||||
|
all_cut_parts_look_like_imperial_units = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (all_cut_parts_look_like_imperial_units)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -689,15 +689,12 @@ void MenuFactory::append_menu_item_invalidate_cut_info(wxMenu* menu)
|
|||||||
{
|
{
|
||||||
const wxString menu_name = _L("Invalidate cut info");
|
const wxString menu_name = _L("Invalidate cut info");
|
||||||
|
|
||||||
bool is_cut = obj_list()->has_selected_cut_object();
|
|
||||||
|
|
||||||
auto menu_item_id = menu->FindItem(menu_name);
|
auto menu_item_id = menu->FindItem(menu_name);
|
||||||
if (menu_item_id != wxNOT_FOUND) {
|
if (menu_item_id != wxNOT_FOUND)
|
||||||
// Delete old menu item if selected object isn't cut
|
// Delete old menu item if selected object isn't cut
|
||||||
if (!is_cut)
|
menu->Destroy(menu_item_id);
|
||||||
menu->Destroy(menu_item_id);
|
|
||||||
}
|
if (obj_list()->has_selected_cut_object())
|
||||||
else if (is_cut)
|
|
||||||
append_menu_item(menu, wxID_ANY, menu_name, "",
|
append_menu_item(menu, wxID_ANY, menu_name, "",
|
||||||
[](wxCommandEvent&) { obj_list()->invalidate_cut_info_for_selection(); }, "", menu,
|
[](wxCommandEvent&) { obj_list()->invalidate_cut_info_for_selection(); }, "", menu,
|
||||||
[]() { return true; }, m_parent);
|
[]() { return true; }, m_parent);
|
||||||
|
@ -1728,6 +1728,9 @@ void ObjectList::load_generic_subobject(const std::string& type_name, const Mode
|
|||||||
// update printable state on canvas
|
// update printable state on canvas
|
||||||
wxGetApp().plater()->canvas3D()->update_instance_printable_state_for_object((size_t)obj_idx);
|
wxGetApp().plater()->canvas3D()->update_instance_printable_state_for_object((size_t)obj_idx);
|
||||||
|
|
||||||
|
if (model_object.is_cut())
|
||||||
|
update_info_items(obj_idx);
|
||||||
|
|
||||||
selection_changed();
|
selection_changed();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1858,11 +1861,13 @@ bool ObjectList::del_subobject_item(wxDataViewItem& item)
|
|||||||
|
|
||||||
// If last volume item with warning was deleted, unmark object item
|
// If last volume item with warning was deleted, unmark object item
|
||||||
if (type & itVolume) {
|
if (type & itVolume) {
|
||||||
|
add_volumes_to_object_in_list(obj_idx);
|
||||||
const std::string& icon_name = get_warning_icon_name(object(obj_idx)->get_object_stl_stats());
|
const std::string& icon_name = get_warning_icon_name(object(obj_idx)->get_object_stl_stats());
|
||||||
m_objects_model->UpdateWarningIcon(parent, icon_name);
|
m_objects_model->UpdateWarningIcon(parent, icon_name);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
m_objects_model->Delete(item);
|
||||||
|
|
||||||
m_objects_model->Delete(item);
|
|
||||||
update_info_items(obj_idx);
|
update_info_items(obj_idx);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -2677,7 +2682,8 @@ void ObjectList::part_selection_changed()
|
|||||||
volume_id = m_objects_model->GetVolumeIdByItem(item);
|
volume_id = m_objects_model->GetVolumeIdByItem(item);
|
||||||
m_config = &object->volumes[volume_id]->config;
|
m_config = &object->volumes[volume_id]->config;
|
||||||
update_and_show_manipulations = true;
|
update_and_show_manipulations = true;
|
||||||
enable_manipulation = !(object->is_cut() && object->volumes[volume_id]->is_cut_connector());
|
const ModelVolume* volume = object->volumes[volume_id];
|
||||||
|
enable_manipulation = !(object->is_cut() && (volume->is_cut_connector() || volume->is_model_part()));
|
||||||
}
|
}
|
||||||
else if (type & itInstance) {
|
else if (type & itInstance) {
|
||||||
og_name = _L("Instance manipulation");
|
og_name = _L("Instance manipulation");
|
||||||
@ -2874,8 +2880,11 @@ static bool can_add_volumes_to_object(const ModelObject* object)
|
|||||||
if (can && object->is_cut()) {
|
if (can && object->is_cut()) {
|
||||||
int no_connectors_cnt = 0;
|
int no_connectors_cnt = 0;
|
||||||
for (const ModelVolume* v : object->volumes)
|
for (const ModelVolume* v : object->volumes)
|
||||||
if (!v->is_cut_connector())
|
if (!v->is_cut_connector()) {
|
||||||
|
if (!v->is_model_part())
|
||||||
|
return true;
|
||||||
no_connectors_cnt++;
|
no_connectors_cnt++;
|
||||||
|
}
|
||||||
can = no_connectors_cnt > 1;
|
can = no_connectors_cnt > 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3031,7 +3040,7 @@ bool ObjectList::delete_from_model_and_list(const std::vector<ItemForDelete>& it
|
|||||||
if (!del_subobject_from_object(item->obj_idx, item->sub_obj_idx, item->type))
|
if (!del_subobject_from_object(item->obj_idx, item->sub_obj_idx, item->type))
|
||||||
continue;
|
continue;
|
||||||
if (item->type&itVolume) {
|
if (item->type&itVolume) {
|
||||||
m_objects_model->Delete(m_objects_model->GetItemByVolumeId(item->obj_idx, item->sub_obj_idx));
|
add_volumes_to_object_in_list(item->obj_idx);
|
||||||
ModelObject* obj = object(item->obj_idx);
|
ModelObject* obj = object(item->obj_idx);
|
||||||
if (obj->volumes.size() == 1) {
|
if (obj->volumes.size() == 1) {
|
||||||
wxDataViewItem parent = m_objects_model->GetItemById(item->obj_idx);
|
wxDataViewItem parent = m_objects_model->GetItemById(item->obj_idx);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user