FIX: the P1P printer is not support smooth timelapse

Change-Id: I0e9faf9d9c63d6541189724813fd803c8522a26b
(cherry picked from commit 84edf0b3eeb84c65990926ab8fc69b0f51ce6f3d)
This commit is contained in:
zhimin.zeng 2022-11-25 11:05:03 +08:00 committed by Lane.Wei
parent 882e06bd9b
commit 7dddb17d8a
5 changed files with 62 additions and 2 deletions

View file

@ -661,6 +661,31 @@ std::string Preset::get_printer_type(PresetBundle *preset_bundle)
return ""; 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) bool Preset::is_bbl_vendor_preset(PresetBundle *preset_bundle)
{ {

View file

@ -298,7 +298,8 @@ public:
// special for upport G and Support W // special for upport G and Support W
std::string get_filament_type(std::string &display_filament_type); 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); bool is_bbl_vendor_preset(PresetBundle *preset_bundle);

View file

@ -602,6 +602,11 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig *config, co
bool has_fuzzy_skin = (config->opt_enum<FuzzySkinType>("fuzzy_skin") != FuzzySkinType::None); bool has_fuzzy_skin = (config->opt_enum<FuzzySkinType>("fuzzy_skin") != FuzzySkinType::None);
for (auto el : { "fuzzy_skin_thickness", "fuzzy_skin_point_distance"}) for (auto el : { "fuzzy_skin_thickness", "fuzzy_skin_point_distance"})
toggle_line(el, has_fuzzy_skin); 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*/) void ConfigManipulation::update_print_sla_config(DynamicPrintConfig* config, const bool is_global_config/* = false*/)

View file

@ -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) UnsavedChangesDialog::UnsavedChangesDialog(Preset::Type type, PresetCollection *dependent_presets, const std::string &new_selected_preset, bool no_transfer)
: DPIDialog(static_cast<wxWindow *>(wxGetApp().mainframe), : m_new_selected_preset_name(new_selected_preset)
, DPIDialog(static_cast<wxWindow *>(wxGetApp().mainframe),
wxID_ANY, wxID_ANY,
_L("Discard or Keep changes"), _L("Discard or Keep changes"),
wxDefaultPosition, wxDefaultPosition,
@ -1057,6 +1058,9 @@ void UnsavedChangesDialog::show_info_line(Action action, std::string preset_name
void UnsavedChangesDialog::close(Action action) void UnsavedChangesDialog::close(Action action)
{ {
if (action == Action::Transfer) {
check_option_valid();
}
m_exit_action = action; m_exit_action = action;
this->EndModal(wxID_CLOSE); this->EndModal(wxID_CLOSE);
} }
@ -1653,6 +1657,28 @@ void UnsavedChangesDialog::on_sys_color_changed()
Refresh(); 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 // FullCompareDialog

View file

@ -311,6 +311,8 @@ private:
// additional action buttons used in dialog // additional action buttons used in dialog
int m_buttons { ActionButtons::TRANSFER | ActionButtons::SAVE }; int m_buttons { ActionButtons::TRANSFER | ActionButtons::SAVE };
std::string m_new_selected_preset_name;
public: public:
// Discard and Cancel buttons are always but next buttons are optional // Discard and Cancel buttons are always but next buttons are optional
enum ActionButtons { enum ActionButtons {
@ -377,6 +379,7 @@ public:
protected: protected:
void on_dpi_changed(const wxRect& suggested_rect) override; void on_dpi_changed(const wxRect& suggested_rect) override;
void on_sys_color_changed() override; void on_sys_color_changed() override;
bool check_option_valid();
}; };