diff --git a/src/slic3r/GUI/FilamentGroupPopup.cpp b/src/slic3r/GUI/FilamentGroupPopup.cpp index 749ddae81e..0ddda146c8 100644 --- a/src/slic3r/GUI/FilamentGroupPopup.cpp +++ b/src/slic3r/GUI/FilamentGroupPopup.cpp @@ -281,7 +281,7 @@ void FilamentGroupPopup::OnRadioBtn(int idx) if (m_mode != mode_list.at(idx)) { m_mode = mode_list.at(idx); SetFilamentMapMode(m_mode); - plater_ref->schedule_background_process(); + plater_ref->update(); UpdateButtonStatus(m_mode); } } diff --git a/src/slic3r/GUI/FilamentMapDialog.cpp b/src/slic3r/GUI/FilamentMapDialog.cpp index fb851a9c60..f2cfa82478 100644 --- a/src/slic3r/GUI/FilamentMapDialog.cpp +++ b/src/slic3r/GUI/FilamentMapDialog.cpp @@ -34,6 +34,9 @@ static std::vector get_applied_map(DynamicConfig& proj_config, const Plater return plater_ref->get_global_filament_map(); } +extern std::string& get_left_extruder_unprintable_text(); +extern std::string& get_right_extruder_unprintable_text(); + bool try_pop_up_before_slice(bool skip_plate_sync, Plater* plater_ref, PartPlate* partplate_ref) { @@ -86,6 +89,11 @@ bool try_pop_up_before_slice(bool skip_plate_sync, Plater* plater_ref, PartPlate if (new_mode == fmmManual) plater_ref->set_global_filament_map(new_maps); } + plater_ref->update(); + // check whether able to slice, if not, return false + if (!get_left_extruder_unprintable_text().empty() || !get_right_extruder_unprintable_text().empty()){ + return false; + } return true; } return false; diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 85ebd0c1ac..5659f392de 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -1404,7 +1404,7 @@ static std::pair construct_extruder_unprintable_error(ObjectFilament if (object_result.filaments.empty()) return {false,false}; - static const std::vector nozzle_name_list = { _u8L("left nozzle"), _u8L("right nozzle") }; + const std::vector nozzle_name_list = { _u8L("left nozzle"), _u8L("right nozzle") }; std::vector left_unprintable_objects; std::vector right_unprintable_objects; @@ -2962,6 +2962,8 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re if (m_canvas_type != ECanvasType::CanvasAssembleView) { _set_warning_notification_if_needed(EWarning::GCodeConflict); _set_warning_notification(EWarning::FilamentUnPrintableOnFirstLayer, false); + _set_warning_notification_if_needed(EWarning::MultiExtruderPrintableError); + _set_warning_notification_if_needed(EWarning::MultiExtruderHeightOutside); // checks for geometry outside the print volume to render it accordingly if (!m_volumes.empty()) { ModelInstanceEPrintVolumeState state; @@ -3007,6 +3009,8 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re _set_warning_notification(EWarning::TPUPrintableError, false); _set_warning_notification(EWarning::FilamentPrintableError, false); _set_warning_notification(EWarning::MixUsePLAAndPETG, false); + _set_warning_notification(EWarning::MultiExtruderPrintableError,false); + _set_warning_notification(EWarning::MultiExtruderHeightOutside,false); post_event(Event(EVT_GLCANVAS_ENABLE_ACTION_BUTTONS, false)); } } @@ -9966,10 +9970,6 @@ void GLCanvas3D::_set_warning_notification(EWarning warning, bool state) text += (boost::format(_u8L("Filaments %d is placed in the %s, but the generated G-code path exceeds the printable range of the %s.")) %filaments %extruder_name %extruder_name).str(); } } - if (!text.empty()) { - text += "\n"; - text += _u8L("Open wiki for more information."); - } error = ErrorType::SLICING_LIMIT_ERROR; break; } @@ -10071,20 +10071,20 @@ void GLCanvas3D::_set_warning_notification(EWarning warning, bool state) case PLATER_ERROR: if (warning == EWarning::LeftExtruderPrintableError) { if (state) { - if (auto left_str = get_left_extruder_unprintable_text();!left_str.empty()) - notification_manager.push_slicing_customize_error_notification(NotificationType::LeftExtruderUnprintableError, NotificationLevel::ErrorNotificationLevel, left_str); + if (auto left_str = get_left_extruder_unprintable_text(); !left_str.empty()) + notification_manager.bbl_show_filament_map_invalid_notification_before_slice(NotificationType::LeftExtruderUnprintableError, left_str); } else { - notification_manager.close_slicing_customize_error_notification(NotificationType::LeftExtruderUnprintableError, NotificationLevel::ErrorNotificationLevel); + notification_manager.bbl_close_filament_map_invalid_notification_before_slice(NotificationType::LeftExtruderUnprintableError); } } else if (warning == EWarning::RightExtruderPrintableError) { if (state) { if (auto right_str = get_right_extruder_unprintable_text(); !right_str.empty()) - notification_manager.push_slicing_customize_error_notification(NotificationType::RightExtruderUnprintableError, NotificationLevel::ErrorNotificationLevel, right_str); + notification_manager.bbl_show_filament_map_invalid_notification_before_slice(NotificationType::RightExtruderUnprintableError, right_str); } else { - notification_manager.close_slicing_customize_error_notification(NotificationType::RightExtruderUnprintableError, NotificationLevel::ErrorNotificationLevel); + notification_manager.bbl_close_filament_map_invalid_notification_before_slice(NotificationType::RightExtruderUnprintableError); } } else if (warning == EWarning::ObjectClashed) { @@ -10134,9 +10134,9 @@ void GLCanvas3D::_set_warning_notification(EWarning warning, bool state) break; case SLICING_LIMIT_ERROR: if (state) - notification_manager.push_slicing_customize_error_notification(NotificationType::BBLSliceLimitError, NotificationLevel::ErrorNotificationLevel, text); + notification_manager.bbl_show_filament_map_invalid_notification_after_slice(NotificationType::BBLSliceLimitError, text); else - notification_manager.close_slicing_customize_error_notification(NotificationType::BBLSliceLimitError, NotificationLevel::ErrorNotificationLevel); + notification_manager.bbl_close_filament_map_invalid_notification_after_slice(NotificationType::BBLSliceLimitError); break; case SLICING_HEIGHT_OUTSIDE: if (state) diff --git a/src/slic3r/GUI/NotificationManager.cpp b/src/slic3r/GUI/NotificationManager.cpp index 5988779432..8afe2ea1b9 100644 --- a/src/slic3r/GUI/NotificationManager.cpp +++ b/src/slic3r/GUI/NotificationManager.cpp @@ -22,6 +22,7 @@ #include #include "GUI_App.hpp" +#include "FilamentMapDialog.hpp" #ifndef IMGUI_DEFINE_MATH_OPERATORS #define IMGUI_DEFINE_MATH_OPERATORS @@ -3092,6 +3093,46 @@ void NotificationManager::bbl_close_bed_filament_incompatible_notification() close_notification_of_type(NotificationType::BBLBedFilamentIncompatible); } +void NotificationManager::bbl_show_filament_map_invalid_notification_before_slice(const NotificationType type,const std::string& text) +{ + auto callback = [](wxEvtHandler*) { + auto plater = wxGetApp().plater(); + auto partplate = plater->get_partplate_list().get_curr_plate(); + try_pop_up_before_slice(false, plater, partplate); // ignore the return value + return false; + }; + + push_notification_data({ type,NotificationLevel::ErrorNotificationLevel,0,_u8L("Error:") + "\n" + text,_u8L("Click here to regroup"),callback }, 0); +} + +void NotificationManager::bbl_close_filament_map_invalid_notification_before_slice(const NotificationType type) +{ + close_notification_of_type(type); +} + +void NotificationManager::bbl_show_filament_map_invalid_notification_after_slice(const NotificationType type, const std::string& text) +{ + auto callback = [](wxEvtHandler*) { + auto plater = wxGetApp().plater(); + wxCommandEvent evt(EVT_OPEN_FILAMENT_MAP_SETTINGS_DIALOG); + evt.SetEventObject(plater); + auto canvas_type = plater->canvas3D()->get_canvas_type(); + if (canvas_type == GLCanvas3D::ECanvasType::CanvasPreview) + evt.SetInt(1); // 1 means from gcode viewer, should do slice right now + else + evt.SetInt(0); + wxPostEvent(plater, evt); + return false; + }; + + push_notification_data({ type,NotificationLevel::ErrorNotificationLevel,0,_u8L("Error:") + "\n" + text,_u8L("Click here to regroup"),callback }, 0); +} + +void NotificationManager::bbl_close_filament_map_invalid_notification_after_slice(const NotificationType type) +{ + close_notification_of_type(type); +} + void NotificationManager::bbl_show_sole_text_notification(NotificationType sType, const std::string &text, bool bOverride, int level, bool autohide) { NotificationLevel nlevel; diff --git a/src/slic3r/GUI/NotificationManager.hpp b/src/slic3r/GUI/NotificationManager.hpp index 28db1cb0d9..2ada78afbc 100644 --- a/src/slic3r/GUI/NotificationManager.hpp +++ b/src/slic3r/GUI/NotificationManager.hpp @@ -365,6 +365,12 @@ public: void bbl_show_bed_filament_incompatible_notification(const std::string& text); void bbl_close_bed_filament_incompatible_notification(); + void bbl_show_filament_map_invalid_notification_before_slice(const NotificationType type, const std::string& text); + void bbl_close_filament_map_invalid_notification_before_slice(const NotificationType type); + + void bbl_show_filament_map_invalid_notification_after_slice(const NotificationType type, const std::string& text); + void bbl_close_filament_map_invalid_notification_after_slice(const NotificationType type); + //BBS--sole notification void bbl_show_sole_text_notification(NotificationType sType,const std::string &text, bool bOverride, int level, bool autohide); void bbl_chose_sole_text_notification(NotificationType sType); diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 4c00b18e9b..b47be85952 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -15690,22 +15690,18 @@ void Plater::validate_current_plate(bool& model_fits, bool& validate_error) std::string left_unprintable_text = get_left_extruder_unprintable_text(), right_unprintable_text = get_right_extruder_unprintable_text(); if (!left_unprintable_text.empty()) { - p->notification_manager->push_slicing_customize_error_notification(NotificationType::LeftExtruderUnprintableError, - NotificationManager::NotificationLevel::ErrorNotificationLevel, left_unprintable_text); + p->notification_manager->bbl_show_filament_map_invalid_notification_before_slice(NotificationType::LeftExtruderUnprintableError, left_unprintable_text); } else { - p->notification_manager->close_slicing_customize_error_notification(NotificationType::LeftExtruderUnprintableError, - NotificationManager::NotificationLevel::ErrorNotificationLevel); + p->notification_manager->bbl_close_filament_map_invalid_notification_before_slice(NotificationType::LeftExtruderUnprintableError); } if (!right_unprintable_text.empty()) { - p->notification_manager->push_slicing_customize_error_notification(NotificationType::RightExtruderUnprintableError, - NotificationManager::NotificationLevel::ErrorNotificationLevel, right_unprintable_text); + p->notification_manager->bbl_show_filament_map_invalid_notification_before_slice(NotificationType::RightExtruderUnprintableError,right_unprintable_text); } else { - p->notification_manager->close_slicing_customize_error_notification(NotificationType::RightExtruderUnprintableError, - NotificationManager::NotificationLevel::ErrorNotificationLevel); + p->notification_manager->bbl_close_filament_map_invalid_notification_before_slice(NotificationType::RightExtruderUnprintableError); } /*if (state == ModelInstancePVS_Limited) { @@ -15806,7 +15802,6 @@ void Plater::open_filament_map_setting_dialog(wxCommandEvent &evt) { PartPlate* curr_plate = p->partplate_list.get_curr_plate(); int value = evt.GetInt(); //1 means from gcode view - bool force_manual = value == 1; // If from gcode view, should display manual page bool need_slice = value ==1; // If from gcode view, should slice const auto& project_config = wxGetApp().preset_bundle->project_config;