diff --git a/src/libslic3r/Preset.cpp b/src/libslic3r/Preset.cpp index c36a97b06d..1d2b501d77 100644 --- a/src/libslic3r/Preset.cpp +++ b/src/libslic3r/Preset.cpp @@ -661,6 +661,31 @@ std::string Preset::get_printer_type(PresetBundle *preset_bundle) return ""; } +<<<<<<< HEAD (8eb681 FIX: fix use ams always checked) +======= +std::string Preset::get_current_printer_type(PresetBundle *preset_bundle) +{ + if (preset_bundle) { + auto config = &(this->config); + std::string vendor_name; + for (auto vendor_profile : preset_bundle->vendors) { + for (auto vendor_model : vendor_profile.second.models) + if (vendor_model.name == config->opt_string("printer_model")) { + vendor_name = vendor_profile.first; + return vendor_model.model_id; + } + } + } + return ""; +} + +bool Preset::is_custom_defined() +{ + if (custom_defined == "1") + return true; + return false; +} +>>>>>>> CHANGE (84edf0 FIX: the P1P printer is not support smooth timelapse) bool Preset::is_bbl_vendor_preset(PresetBundle *preset_bundle) { diff --git a/src/libslic3r/Preset.hpp b/src/libslic3r/Preset.hpp index 4f8cb22bac..2f315b3fa7 100644 --- a/src/libslic3r/Preset.hpp +++ b/src/libslic3r/Preset.hpp @@ -298,7 +298,8 @@ public: // special for upport G and Support W std::string get_filament_type(std::string &display_filament_type); - std::string get_printer_type(PresetBundle *preset_bundle); + std::string get_printer_type(PresetBundle *preset_bundle); // get edited preset type + std::string get_current_printer_type(PresetBundle *preset_bundle); // get current preset type bool is_bbl_vendor_preset(PresetBundle *preset_bundle); diff --git a/src/slic3r/GUI/ConfigManipulation.cpp b/src/slic3r/GUI/ConfigManipulation.cpp index 1054aebabe..d75e98808d 100644 --- a/src/slic3r/GUI/ConfigManipulation.cpp +++ b/src/slic3r/GUI/ConfigManipulation.cpp @@ -602,6 +602,11 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig *config, co bool has_fuzzy_skin = (config->opt_enum("fuzzy_skin") != FuzzySkinType::None); for (auto el : { "fuzzy_skin_thickness", "fuzzy_skin_point_distance"}) toggle_line(el, has_fuzzy_skin); + + // C11 printer is not support smooth timelapse + PresetBundle *preset_bundle = wxGetApp().preset_bundle; + std::string str_preset_type = preset_bundle->printers.get_edited_preset().get_printer_type(preset_bundle); + toggle_field("timelapse_type", str_preset_type != "C11"); } void ConfigManipulation::update_print_sla_config(DynamicPrintConfig* config, const bool is_global_config/* = false*/) diff --git a/src/slic3r/GUI/UnsavedChangesDialog.cpp b/src/slic3r/GUI/UnsavedChangesDialog.cpp index 2ac70dbd3c..0804253de2 100644 --- a/src/slic3r/GUI/UnsavedChangesDialog.cpp +++ b/src/slic3r/GUI/UnsavedChangesDialog.cpp @@ -802,7 +802,8 @@ UnsavedChangesDialog::UnsavedChangesDialog(const wxString &caption, const wxStri } UnsavedChangesDialog::UnsavedChangesDialog(Preset::Type type, PresetCollection *dependent_presets, const std::string &new_selected_preset, bool no_transfer) - : DPIDialog(static_cast(wxGetApp().mainframe), + : m_new_selected_preset_name(new_selected_preset) + , DPIDialog(static_cast(wxGetApp().mainframe), wxID_ANY, _L("Discard or Keep changes"), wxDefaultPosition, @@ -1057,6 +1058,9 @@ void UnsavedChangesDialog::show_info_line(Action action, std::string preset_name void UnsavedChangesDialog::close(Action action) { + if (action == Action::Transfer) { + check_option_valid(); + } m_exit_action = action; this->EndModal(wxID_CLOSE); } @@ -1653,6 +1657,28 @@ void UnsavedChangesDialog::on_sys_color_changed() Refresh(); } +bool UnsavedChangesDialog::check_option_valid() +{ + auto itor = std::find_if(m_presetitems.begin(), m_presetitems.end(), [](const PresetItem &item) { + return item.opt_key == "timelapse_type"; + }); + + if (itor != m_presetitems.end()) { + PresetBundle *preset_bundle = wxGetApp().preset_bundle; + Preset * new_preset = preset_bundle->printers.find_preset(m_new_selected_preset_name); + std::string str_print_type = new_preset->get_current_printer_type(preset_bundle); + if (str_print_type == "C11" && itor->new_value.ToStdString() == "Smooth") { + MessageDialog dlg(wxGetApp().plater(), _L("The P1P printer is not support smooth timelapse, it will not transform the timelapse changes."), + _L("Warning"), wxICON_WARNING | wxOK); + dlg.ShowModal(); + m_presetitems.erase(itor); + return false; + } + } + + return true; +} + //------------------------------------------ // FullCompareDialog diff --git a/src/slic3r/GUI/UnsavedChangesDialog.hpp b/src/slic3r/GUI/UnsavedChangesDialog.hpp index 0370e7e0d7..04dc15d81b 100644 --- a/src/slic3r/GUI/UnsavedChangesDialog.hpp +++ b/src/slic3r/GUI/UnsavedChangesDialog.hpp @@ -311,6 +311,8 @@ private: // additional action buttons used in dialog int m_buttons { ActionButtons::TRANSFER | ActionButtons::SAVE }; + std::string m_new_selected_preset_name; + public: // Discard and Cancel buttons are always but next buttons are optional enum ActionButtons { @@ -377,6 +379,7 @@ public: protected: void on_dpi_changed(const wxRect& suggested_rect) override; void on_sys_color_changed() override; + bool check_option_valid(); };