ENH: model with a volume but multi-mesh should can be mesh union

As title

Signed-off-by: salt.wei <salt.wei@bambulab.com>
Change-Id: I4cf12198980a9a5a7d8dbbfc49fd5d807ca97902
This commit is contained in:
salt.wei 2023-07-07 14:36:38 +08:00 committed by Lane.Wei
parent f1ef4476dd
commit 89a7cc4ab0
3 changed files with 12 additions and 1 deletions

View File

@ -927,7 +927,7 @@ void MenuFactory::append_menu_item_merge_parts_to_single_part(wxMenu* menu)
menu->AppendSeparator();
append_menu_item(menu, wxID_ANY, _L("Mesh boolean"), _L("Mesh boolean operations including union and subtraction"),
[](wxCommandEvent&) { obj_list()->boolean/*merge_volumes*/(); }, "", menu,
[]() { return obj_list()->can_merge_to_single_object(); }, m_parent);
[]() { return obj_list()->can_mesh_boolean(); }, m_parent);
}
void MenuFactory::append_menu_items_mirror(wxMenu* menu)

View File

@ -3076,6 +3076,16 @@ bool ObjectList::can_merge_to_single_object() const
return (*m_objects)[obj_idx]->volumes.size() > 1;
}
bool ObjectList::can_mesh_boolean() const
{
int obj_idx = get_selected_obj_idx();
if (obj_idx < 0)
return false;
// selected object should be multi mesh
return (*m_objects)[obj_idx]->volumes.size() > 1 || ((*m_objects)[obj_idx]->volumes.size() == 1 && (*m_objects)[obj_idx]->volumes[0]->is_splittable());
}
bool ObjectList::has_selected_cut_object() const
{
wxDataViewItemArray sels;

View File

@ -311,6 +311,7 @@ public:
bool can_split_instances();
bool can_merge_to_multipart_object() const;
bool can_merge_to_single_object() const;
bool can_mesh_boolean() const;
bool has_selected_cut_object() const;
void invalidate_cut_info_for_selection();