diff --git a/src/libslic3r/PrintBase.cpp b/src/libslic3r/PrintBase.cpp index 721741d4a..d129aaad2 100644 --- a/src/libslic3r/PrintBase.cpp +++ b/src/libslic3r/PrintBase.cpp @@ -94,12 +94,14 @@ std::string PrintBase::output_filepath(const std::string &path, const std::strin return path; } -void PrintBase::status_update_warnings(ObjectID object_id, int step, PrintStateBase::WarningLevel /* warning_level */, const std::string &message) +void PrintBase::status_update_warnings(int step, PrintStateBase::WarningLevel /* warning_level */, const std::string &message, const PrintObjectBase* print_object) { - if (this->m_status_callback) - m_status_callback(SlicingStatus(*this, step)); + if (this->m_status_callback) { + auto status = print_object ? SlicingStatus(*print_object, step) : SlicingStatus(*this, step); + m_status_callback(status); + } else if (! message.empty()) - printf("%s warning: %s\n", (object_id == this->id()) ? "print" : "print object", message.c_str()); + printf("%s warning: %s\n", print_object ? "print_object" : "print", message.c_str()); } tbb::mutex& PrintObjectBase::state_mutex(PrintBase *print) @@ -114,7 +116,7 @@ std::function PrintObjectBase::cancel_callback(PrintBase *print) void PrintObjectBase::status_update_warnings(PrintBase *print, int step, PrintStateBase::WarningLevel warning_level, const std::string &message) { - print->status_update_warnings(this->id(), step, warning_level, message); + print->status_update_warnings(step, warning_level, message, this); } } // namespace Slic3r diff --git a/src/libslic3r/PrintBase.hpp b/src/libslic3r/PrintBase.hpp index 8fca43319..2aff13ae9 100644 --- a/src/libslic3r/PrintBase.hpp +++ b/src/libslic3r/PrintBase.hpp @@ -481,7 +481,7 @@ protected: // Notify UI about a new warning of a milestone "step" on this PrintBase. // The UI will be notified by calling a status callback. // If no status callback is registered, the message is printed to console. - void status_update_warnings(ObjectID object_id, int step, PrintStateBase::WarningLevel warning_level, const std::string &message); + void status_update_warnings(int step, PrintStateBase::WarningLevel warning_level, const std::string &message, const PrintObjectBase* print_object = nullptr); // If the background processing stop was requested, throw CanceledException. // To be called by the worker thread and its sub-threads (mostly launched on the TBB thread pool) regularly. @@ -528,7 +528,7 @@ protected: PrintStateBase::TimeStamp set_done(PrintStepEnum step) { std::pair status = m_state.set_done(step, this->state_mutex(), [this](){ this->throw_if_canceled(); }); if (status.second) - this->status_update_warnings(this->id(), static_cast(step), PrintStateBase::WarningLevel::NON_CRITICAL, std::string()); + this->status_update_warnings(static_cast(step), PrintStateBase::WarningLevel::NON_CRITICAL, std::string()); return status.first; } bool invalidate_step(PrintStepEnum step) @@ -550,7 +550,7 @@ protected: std::pair active_step = m_state.active_step_add_warning(warning_level, message, message_id, this->state_mutex()); if (active_step.second) // Update UI. - this->status_update_warnings(this->id(), static_cast(active_step.first), warning_level, message); + this->status_update_warnings(static_cast(active_step.first), warning_level, message); } private: