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; wxBusyCursor wait;
const auto& selection = p->get_selection(); 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 //confirm export_with_boolean
bool exist_negive_volume = false; bool exist_negive_volume = false;
bool export_with_boolean = false; bool export_with_boolean = false;
const ModelObject *cur_model_object = p->model.objects[obj_idx]; if (selection_only) {
for (auto v : cur_model_object->volumes) { const auto obj_idx = selection.get_object_idx();
if (v->type() == ModelVolumeType::NEGATIVE_VOLUME) { if (obj_idx == -1 ||selection.is_wipe_tower())
exist_negive_volume=true; return;
break; // 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) { if (exist_negive_volume) {
MessageDialog dlg(this, _L("Negative parts detected. Would you like to perform mesh boolean before exporting?"), _L("Message"), MessageDialog dlg(this, _L("Negative parts detected. Would you like to perform mesh boolean before exporting?"), _L("Message"),
wxICON_QUESTION | wxYES_NO); wxICON_QUESTION | wxYES_NO);
@ -10925,15 +10938,6 @@ void Plater::export_stl(bool extended, bool selection_only, bool multi_stls)
export_with_boolean = true; 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. // 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) { auto mesh_to_export_fff_no_boolean = [](const ModelObject &mo, int instance_id) {
TriangleMesh mesh; TriangleMesh mesh;