Revert Object warning notification to SimplifySuggestion
followup of commit 0d0c092880
.
This commit is contained in:
parent
5048dbf8b4
commit
213add1b2b
@ -1518,7 +1518,7 @@ void NotificationManager::push_slicing_warning_notification(const std::string& t
|
||||
{
|
||||
NotificationData data { NotificationType::SlicingWarning, NotificationLevel::WarningNotificationLevel, 0, _u8L("WARNING:") + "\n" + text };
|
||||
|
||||
auto notification = std::make_unique<NotificationManager::SlicingWarningNotification>(data, m_id_provider, m_evt_handler);
|
||||
auto notification = std::make_unique<NotificationManager::ObjectIDNotification>(data, m_id_provider, m_evt_handler);
|
||||
notification->object_id = oid;
|
||||
notification->warning_step = warning_step;
|
||||
if (push_notification_data(std::move(notification), 0)) {
|
||||
@ -1609,12 +1609,11 @@ void NotificationManager::close_slicing_error_notification(const std::string& te
|
||||
}
|
||||
}
|
||||
}
|
||||
void NotificationManager::push_object_warning_notification(const std::string& text, ObjectID object_id, const std::string& hypertext/* = ""*/, std::function<bool(wxEvtHandler*)> callback/* = std::function<bool(wxEvtHandler*)>()*/)
|
||||
void NotificationManager::push_simplify_suggestion_notification(const std::string& text, ObjectID object_id, const std::string& hypertext/* = ""*/, std::function<bool(wxEvtHandler*)> callback/* = std::function<bool(wxEvtHandler*)>()*/)
|
||||
{
|
||||
NotificationData data{ NotificationType::ObjectWarning, NotificationLevel::WarningNotificationLevel, 0, text, hypertext, callback };
|
||||
auto notification = std::make_unique<NotificationManager::SlicingWarningNotification>(data, m_id_provider, m_evt_handler);
|
||||
NotificationData data{ NotificationType::SimplifySuggestion, NotificationLevel::RegularNotificationLevel, 10, text, hypertext, callback };
|
||||
auto notification = std::make_unique<NotificationManager::ObjectIDNotification>(data, m_id_provider, m_evt_handler);
|
||||
notification->object_id = object_id;
|
||||
notification->warning_step = 0;
|
||||
push_notification_data(std::move(notification), 0);
|
||||
}
|
||||
void NotificationManager::close_notification_of_type(const NotificationType type)
|
||||
@ -1630,19 +1629,20 @@ void NotificationManager::remove_slicing_warnings_of_released_objects(const std:
|
||||
for (std::unique_ptr<PopNotification> ¬ification : m_pop_notifications)
|
||||
if (notification->get_type() == NotificationType::SlicingWarning) {
|
||||
if (! std::binary_search(living_oids.begin(), living_oids.end(),
|
||||
static_cast<SlicingWarningNotification*>(notification.get())->object_id))
|
||||
static_cast<ObjectIDNotification*>(notification.get())->object_id))
|
||||
notification->close();
|
||||
}
|
||||
}
|
||||
void NotificationManager::remove_object_warnings_of_released_objects(const std::vector<ObjectID>& living_oids)
|
||||
void NotificationManager::remove_simplify_suggestion_of_released_objects(const std::vector<ObjectID>& living_oids)
|
||||
{
|
||||
for (std::unique_ptr<PopNotification>& notification : m_pop_notifications)
|
||||
if (notification->get_type() == NotificationType::ObjectWarning) {
|
||||
if (notification->get_type() == NotificationType::SimplifySuggestion) {
|
||||
if (!std::binary_search(living_oids.begin(), living_oids.end(),
|
||||
static_cast<SlicingWarningNotification*>(notification.get())->object_id))
|
||||
static_cast<ObjectIDNotification*>(notification.get())->object_id))
|
||||
notification->close();
|
||||
}
|
||||
}
|
||||
|
||||
void NotificationManager::push_exporting_finished_notification(const std::string& path, const std::string& dir_path, bool on_removable)
|
||||
{
|
||||
close_notification_of_type(NotificationType::ExportFinished);
|
||||
@ -2084,8 +2084,8 @@ bool NotificationManager::activate_existing(const NotificationManager::PopNotifi
|
||||
continue;
|
||||
}
|
||||
} else if (new_type == NotificationType::SlicingWarning) {
|
||||
auto w1 = dynamic_cast<const SlicingWarningNotification*>(notification);
|
||||
auto w2 = dynamic_cast<const SlicingWarningNotification*>(it->get());
|
||||
auto w1 = dynamic_cast<const ObjectIDNotification*>(notification);
|
||||
auto w2 = dynamic_cast<const ObjectIDNotification*>(it->get());
|
||||
if (w1 != nullptr && w2 != nullptr) {
|
||||
if (!(*it)->compare_text(new_text) || w1->object_id != w2->object_id) {
|
||||
continue;
|
||||
|
@ -71,9 +71,6 @@ enum class NotificationType
|
||||
PlaterError,
|
||||
// Object fully outside the print volume, or extrusion outside the print volume. Slicing is not disabled.
|
||||
PlaterWarning,
|
||||
// Warning connected to single object id, appears at loading object, disapears at deletition.
|
||||
// Example: advice to simplify object with big amount of triangles.
|
||||
ObjectWarning,
|
||||
// Progress bar instead of text.
|
||||
ProgressBar,
|
||||
// Progress bar with info from Print Host Upload Queue dialog.
|
||||
@ -105,7 +102,10 @@ enum class NotificationType
|
||||
// Might contain logo taken from gizmos
|
||||
UpdatedItemsInfo,
|
||||
// Progress bar notification with methods to replace ProgressIndicator class.
|
||||
ProgressIndicator
|
||||
ProgressIndicator,
|
||||
// Give user advice to simplify object with big amount of triangles
|
||||
// Contains ObjectID for closing when object is deleted
|
||||
SimplifySuggestion
|
||||
};
|
||||
|
||||
class NotificationManager
|
||||
@ -167,11 +167,11 @@ public:
|
||||
void close_plater_error_notification(const std::string& text);
|
||||
void close_plater_warning_notification(const std::string& text);
|
||||
// Object warning with ObjectID, closes when object is deleted. ID used is of object not print like in slicing warning.
|
||||
void push_object_warning_notification(const std::string& text, ObjectID object_id, const std::string& hypertext = "",
|
||||
void push_simplify_suggestion_notification(const std::string& text, ObjectID object_id, const std::string& hypertext = "",
|
||||
std::function<bool(wxEvtHandler*)> callback = std::function<bool(wxEvtHandler*)>());
|
||||
// Close object warnings, whose ObjectID is not in the list.
|
||||
// living_oids is expected to be sorted.
|
||||
void remove_object_warnings_of_released_objects(const std::vector<ObjectID>& living_oids);
|
||||
void remove_simplify_suggestion_of_released_objects(const std::vector<ObjectID>& living_oids);
|
||||
// Called when the side bar changes its visibility, as the "slicing complete" notification supplements
|
||||
// the "slicing info" normally shown at the side bar.
|
||||
void set_sidebar_collapsed(bool collapsed);
|
||||
@ -394,12 +394,14 @@ private:
|
||||
|
||||
|
||||
|
||||
class SlicingWarningNotification : public PopNotification
|
||||
class ObjectIDNotification : public PopNotification
|
||||
{
|
||||
public:
|
||||
SlicingWarningNotification(const NotificationData& n, NotificationIDProvider& id_provider, wxEvtHandler* evt_handler) : PopNotification(n, id_provider, evt_handler) {}
|
||||
ObjectIDNotification(const NotificationData& n, NotificationIDProvider& id_provider, wxEvtHandler* evt_handler)
|
||||
: PopNotification(n, id_provider, evt_handler)
|
||||
{}
|
||||
ObjectID object_id;
|
||||
int warning_step;
|
||||
int warning_step { 0 };
|
||||
};
|
||||
|
||||
class PlaterWarningNotification : public PopNotification
|
||||
@ -691,7 +693,7 @@ private:
|
||||
void sort_notifications();
|
||||
// If there is some error notification active, then the "Export G-code" notification after the slicing is finished is suppressed.
|
||||
bool has_slicing_error_notification();
|
||||
|
||||
|
||||
// set by init(), until false notifications are only added not updated and frame is not requested after push
|
||||
bool m_initialized{ false };
|
||||
// Target for wxWidgets events sent by clicking on the hyperlink available at some notifications.
|
||||
@ -715,7 +717,7 @@ private:
|
||||
NotificationType::PlaterWarning,
|
||||
NotificationType::ProgressBar,
|
||||
NotificationType::PrintHostUpload,
|
||||
NotificationType::ObjectWarning
|
||||
NotificationType::SimplifySuggestion
|
||||
};
|
||||
//prepared (basic) notifications
|
||||
static const NotificationData basic_notifications[];
|
||||
|
@ -3711,8 +3711,8 @@ void Plater::priv::create_simplify_notification(const std::vector<size_t>& obj_i
|
||||
"amount of triangles.");
|
||||
t.replace(t.find("@object_name"), sizeof("@object_name") - 1,
|
||||
model.objects[object_id]->name);
|
||||
std::stringstream text;
|
||||
text << _u8L("WARNING:") << "\n" << t << "\n";
|
||||
//std::stringstream text;
|
||||
//text << t << "\n";
|
||||
std::string hypertext = _u8L("Simplify model");
|
||||
|
||||
std::function<bool(wxEvtHandler *)> open_simplify = [object_id](wxEvtHandler *) {
|
||||
@ -3727,7 +3727,10 @@ void Plater::priv::create_simplify_notification(const std::vector<size_t>& obj_i
|
||||
manager.open_gizmo(GLGizmosManager::EType::Simplify);
|
||||
return true;
|
||||
};
|
||||
notification_manager->push_object_warning_notification(text.str(), model.objects[object_id]->id(), hypertext, open_simplify);
|
||||
notification_manager->push_simplify_suggestion_notification(t,
|
||||
model.objects[object_id]->id(),
|
||||
hypertext,
|
||||
open_simplify);
|
||||
}
|
||||
}
|
||||
|
||||
@ -4000,7 +4003,7 @@ void Plater::priv::actualize_object_warnings(const PrintBase& print)
|
||||
ids.push_back(object->id());
|
||||
}
|
||||
std::sort(ids.begin(), ids.end());
|
||||
notification_manager->remove_object_warnings_of_released_objects(ids);
|
||||
notification_manager->remove_simplify_suggestion_of_released_objects(ids);
|
||||
}
|
||||
void Plater::priv::clear_warnings()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user