FIX: auto-aranging can't restart with context button if canceled

jira: STUDIO-6027
Change-Id: Ie87caa205f98a40099c615d89a22000a378bef5c
(cherry picked from commit 03e48ec5d9ac4e93c533390247a6a4a6f4ae31e8)
This commit is contained in:
Arthur 2024-03-08 11:18:20 +08:00 committed by Lane.Wei
parent fc114bff4e
commit ceaf008dd4
2 changed files with 99 additions and 100 deletions

View File

@ -614,7 +614,7 @@ static std::string concat_strings(const std::set<std::string> &strings,
void ArrangeJob::finalize() { void ArrangeJob::finalize() {
// Ignore the arrange result if aborted. // Ignore the arrange result if aborted.
if (was_canceled()) return; if (!was_canceled()) {
// Unprintable items go to the last virtual bed // Unprintable items go to the last virtual bed
int beds = 0; int beds = 0;
@ -642,8 +642,7 @@ void ArrangeJob::finalize() {
} }
//BBS: adjust the bed_index, create new plates, get the max bed_index //BBS: adjust the bed_index, create new plates, get the max bed_index
for (ArrangePolygon& ap : m_unselected) for (ArrangePolygon& ap : m_unselected) {
{
if (ap.is_virt_object) if (ap.is_virt_object)
continue; continue;
@ -672,8 +671,7 @@ void ArrangeJob::finalize() {
} }
// Apply the arrange result to unselected objects(due to the sukodu-style column changes, the position of unselected may also be modified) // Apply the arrange result to unselected objects(due to the sukodu-style column changes, the position of unselected may also be modified)
for (ArrangePolygon& ap : m_unselected) for (ArrangePolygon& ap : m_unselected) {
{
if (ap.is_virt_object) if (ap.is_virt_object)
continue; continue;
@ -699,14 +697,13 @@ void ArrangeJob::finalize() {
if (!m_unarranged.empty()) { if (!m_unarranged.empty()) {
std::set<std::string> names; std::set<std::string> names;
for (ModelInstance *mi : m_unarranged) for (ModelInstance* mi : m_unarranged)
names.insert(mi->get_object()->name); names.insert(mi->get_object()->name);
m_plater->get_notification_manager()->push_notification(GUI::format( m_plater->get_notification_manager()->push_notification(GUI::format(
_L("Arrangement ignored the following objects which can't fit into a single bed:\n%s"), _L("Arrangement ignored the following objects which can't fit into a single bed:\n%s"),
concat_strings(names, "\n"))); concat_strings(names, "\n")));
} }
m_plater->get_notification_manager()->close_notification_of_type(NotificationType::ArrangeOngoing);
// unlock the plates we just locked // unlock the plates we just locked
for (int i : m_uncompatible_plates) { for (int i : m_uncompatible_plates) {
@ -728,7 +725,13 @@ void ArrangeJob::finalize() {
wxGetApp().obj_list()->reload_all_plates(); wxGetApp().obj_list()->reload_all_plates();
m_plater->update(); m_plater->update();
m_plater->get_notification_manager()->push_notification(NotificationType::ArrangeOngoing,
NotificationManager::NotificationLevel::RegularNotificationLevel, _u8L("Arranging done."));
}
else {
m_plater->get_notification_manager()->push_notification(NotificationType::ArrangeOngoing,
NotificationManager::NotificationLevel::RegularNotificationLevel, _u8L("Arranging canceled."));
}
Job::finalize(); Job::finalize();
m_plater->m_arrange_running.store(false); m_plater->m_arrange_running.store(false);
} }

View File

@ -202,19 +202,15 @@ void OrientJob::process()
void OrientJob::finalize() { void OrientJob::finalize() {
// Ignore the arrange result if aborted. // Ignore the arrange result if aborted.
if (was_canceled()) return; if (!was_canceled()) {
for (OrientMesh& mesh : m_selected) {
for (OrientMesh& mesh : m_selected)
{
mesh.apply(); mesh.apply();
} }
m_plater->update(); m_plater->update();
// BBS // BBS
//wxGetApp().obj_manipul()->set_dirty(); //wxGetApp().obj_manipul()->set_dirty();
}
Job::finalize(); Job::finalize();
} }