notifications: plater warning not visible in preview

This commit is contained in:
David Kocik 2020-08-25 09:55:29 +02:00
parent 2455df4017
commit 25fb569017
3 changed files with 16 additions and 1 deletions

View file

@ -909,6 +909,14 @@ bool NotificationManager::find_older(NotificationManager::PopNotification* notif
return false; return false;
} }
void NotificationManager::set_in_preview(bool preview)
{
m_in_preview = preview;
for (PopNotification* notification : m_pop_notifications) {
if (notification->get_type() == NotificationType::PlaterWarning)
notification->hide(preview);
}
}
void NotificationManager::dpi_changed() void NotificationManager::dpi_changed()
{ {

View file

@ -94,6 +94,7 @@ public:
void set_gray(bool g) { m_is_gray = g; } void set_gray(bool g) { m_is_gray = g; }
void set_paused(bool p) { m_paused = p; } void set_paused(bool p) { m_paused = p; }
bool compare_text(const std::string& text); bool compare_text(const std::string& text);
void hide(bool h) { m_hidden = h; }
protected: protected:
// Call after every size change // Call after every size change
void init(); void init();
@ -230,6 +231,7 @@ public:
// finds and closes all notifications of given type // finds and closes all notifications of given type
void close_notification_of_type(const NotificationType type); void close_notification_of_type(const NotificationType type);
void dpi_changed(); void dpi_changed();
void set_in_preview(bool preview);
private: private:
//pushes notification into the queue of notifications that are rendered //pushes notification into the queue of notifications that are rendered
//can be used to create custom notification //can be used to create custom notification
@ -246,6 +248,7 @@ private:
bool m_hovered { false }; bool m_hovered { false };
//timestamps used for slining finished - notification could be gone so it needs to be stored here //timestamps used for slining finished - notification could be gone so it needs to be stored here
std::unordered_set<int> m_used_timestamps; std::unordered_set<int> m_used_timestamps;
bool m_in_preview;
//prepared (basic) notifications //prepared (basic) notifications
const std::vector<NotificationData> basic_notifications = { const std::vector<NotificationData> basic_notifications = {

View file

@ -1512,7 +1512,7 @@ struct Plater::priv
GLToolbar view_toolbar; GLToolbar view_toolbar;
GLToolbar collapse_toolbar; GLToolbar collapse_toolbar;
Preview *preview; Preview *preview;
NotificationManager* notification_manager; NotificationManager* notification_manager { nullptr };
BackgroundSlicingProcess background_process; BackgroundSlicingProcess background_process;
bool suppressed_backround_processing_update { false }; bool suppressed_backround_processing_update { false };
@ -3304,6 +3304,8 @@ void Plater::priv::set_current_panel(wxPanel* panel)
// sets the canvas as dirty to force a render at the 1st idle event (wxWidgets IsShownOnScreen() is buggy and cannot be used reliably) // sets the canvas as dirty to force a render at the 1st idle event (wxWidgets IsShownOnScreen() is buggy and cannot be used reliably)
view3D->set_as_dirty(); view3D->set_as_dirty();
view_toolbar.select_item("3D"); view_toolbar.select_item("3D");
if(notification_manager != nullptr)
notification_manager->set_in_preview(false);
} }
else if (current_panel == preview) else if (current_panel == preview)
{ {
@ -3318,6 +3320,8 @@ void Plater::priv::set_current_panel(wxPanel* panel)
preview->set_as_dirty(); preview->set_as_dirty();
view_toolbar.select_item("Preview"); view_toolbar.select_item("Preview");
if (notification_manager != nullptr)
notification_manager->set_in_preview(true);
} }
current_panel->SetFocusFromKbd(); current_panel->SetFocusFromKbd();