FIX:not consider export stl from file menu

Jira: STUDIO-5946
Change-Id: Ie28b7ac0262d209736522a6c87803b1837fc618a
This commit is contained in:
zhou.xu 2024-01-15 14:52:40 +08:00 committed by Lane.Wei
parent 91f5bc4b52
commit 4207c8b3d0

View File

@ -10901,22 +10901,35 @@ void Plater::export_stl(bool extended, bool selection_only, bool multi_stls)
wxBusyCursor wait;
const auto& selection = p->get_selection();
// BBS support selecting multiple objects
if (selection_only && selection.is_wipe_tower())
return;
const auto obj_idx = selection.get_object_idx();
if (obj_idx == -1)
return;
//confirm export_with_boolean
bool exist_negive_volume = false;
bool export_with_boolean = false;
const ModelObject *cur_model_object = p->model.objects[obj_idx];
for (auto v : cur_model_object->volumes) {
if (v->type() == ModelVolumeType::NEGATIVE_VOLUME) {
exist_negive_volume=true;
break;
if (selection_only) {
const auto obj_idx = selection.get_object_idx();
if (obj_idx == -1 ||selection.is_wipe_tower())
return;
// only support selection single full object and mulitiple full object
if (!selection.is_single_full_object() && !selection.is_multiple_full_object())
return;
const ModelObject *cur_model_object = p->model.objects[obj_idx];
for (auto v : cur_model_object->volumes) {
if (v->type() == ModelVolumeType::NEGATIVE_VOLUME) {
exist_negive_volume = true;
break;
}
}
} else {
for (auto cur_model_object : p->model.objects) {
for (auto v : cur_model_object->volumes) {
if (v->type() == ModelVolumeType::NEGATIVE_VOLUME) {
exist_negive_volume = true;
break;
}
}
}
}
if (exist_negive_volume) {
MessageDialog dlg(this, _L("Negative parts detected. Would you like to perform mesh boolean before exporting?"), _L("Message"),
wxICON_QUESTION | wxYES_NO);
@ -10925,15 +10938,6 @@ void Plater::export_stl(bool extended, bool selection_only, bool multi_stls)
export_with_boolean = true;
}
}
if (!export_with_boolean) {
// BBS
if (selection_only) {
// only support selection single full object and mulitiple full object
if (!selection.is_single_full_object() && !selection.is_multiple_full_object())
return;
}
}
// Following lambda generates a combined mesh for export with normals pointing outwards.
auto mesh_to_export_fff_no_boolean = [](const ModelObject &mo, int instance_id) {
TriangleMesh mesh;