QoL: remember choice
Signed-off-by: SoftFever <103989404+SoftFever@users.noreply.github.com>
This commit is contained in:
parent
0ea985f926
commit
6f5af33c2d
2 changed files with 47 additions and 13 deletions
|
@ -1044,22 +1044,30 @@ const double GLCanvas3D::DefaultCameraZoomToPlateMarginFactor = 1.25;
|
|||
void GLCanvas3D::load_arrange_settings()
|
||||
{
|
||||
std::string dist_fff_str =
|
||||
wxGetApp().app_config->get("arrange", "min_object_distance");
|
||||
wxGetApp().app_config->get("arrange", "min_object_distance_fff");
|
||||
|
||||
std::string dist_fff_seq_print_str =
|
||||
wxGetApp().app_config->get("arrange", "min_object_distance_seq_print");
|
||||
wxGetApp().app_config->get("arrange", "min_object_distance_seq_print_fff");
|
||||
|
||||
std::string dist_sla_str =
|
||||
wxGetApp().app_config->get("arrange", "min_object_distance_sla");
|
||||
|
||||
std::string en_rot_fff_str =
|
||||
wxGetApp().app_config->get("arrange", "enable_rotation");
|
||||
wxGetApp().app_config->get("arrange", "enable_rotation_fff");
|
||||
|
||||
std::string en_rot_fff_seqp_str =
|
||||
wxGetApp().app_config->get("arrange", "enable_rotation_seq_print");
|
||||
|
||||
std::string en_rot_sla_str =
|
||||
wxGetApp().app_config->get("arrange", "enable_rotation_sla");
|
||||
|
||||
std::string en_allow_multiple_materials_str =
|
||||
wxGetApp().app_config->get("arrange", "allow_multi_materials_on_same_plate");
|
||||
|
||||
std::string en_avoid_region_str =
|
||||
wxGetApp().app_config->get("arrange", "avoid_extrusion_cali_region");
|
||||
|
||||
|
||||
|
||||
if (!dist_fff_str.empty())
|
||||
m_arrange_settings_fff.distance = std::stof(dist_fff_str);
|
||||
|
@ -1071,13 +1079,20 @@ void GLCanvas3D::load_arrange_settings()
|
|||
m_arrange_settings_sla.distance = std::stof(dist_sla_str);
|
||||
|
||||
if (!en_rot_fff_str.empty())
|
||||
m_arrange_settings_fff.enable_rotation = (en_rot_fff_str == "1" || en_rot_fff_str == "yes");
|
||||
m_arrange_settings_fff.enable_rotation = (en_rot_fff_str == "1" || en_rot_fff_str == "true");
|
||||
|
||||
if (!en_allow_multiple_materials_str.empty())
|
||||
m_arrange_settings_fff.allow_multi_materials_on_same_plate = (en_allow_multiple_materials_str == "1" || en_allow_multiple_materials_str == "true");
|
||||
|
||||
|
||||
if (!en_rot_fff_seqp_str.empty())
|
||||
m_arrange_settings_fff_seq_print.enable_rotation = (en_rot_fff_seqp_str == "1" || en_rot_fff_seqp_str == "yes");
|
||||
m_arrange_settings_fff_seq_print.enable_rotation = (en_rot_fff_seqp_str == "1" || en_rot_fff_seqp_str == "true");
|
||||
|
||||
if(!en_avoid_region_str.empty())
|
||||
m_arrange_settings_fff.avoid_extrusion_cali_region = (en_avoid_region_str == "1" || en_avoid_region_str == "true");
|
||||
|
||||
if (!en_rot_sla_str.empty())
|
||||
m_arrange_settings_sla.enable_rotation = (en_rot_sla_str == "1" || en_rot_sla_str == "yes");
|
||||
m_arrange_settings_sla.enable_rotation = (en_rot_sla_str == "1" || en_rot_sla_str == "true");
|
||||
|
||||
//BBS: add specific arrange settings
|
||||
m_arrange_settings_fff_seq_print.is_seq_print = true;
|
||||
|
@ -5122,13 +5137,13 @@ bool GLCanvas3D::_render_orient_menu(float left, float right, float bottom, floa
|
|||
|
||||
if (imgui->checkbox(_L("Enable rotation"), settings.enable_rotation)) {
|
||||
settings_out.enable_rotation = settings.enable_rotation;
|
||||
appcfg->set("orient", rot_key, settings_out.enable_rotation ? "1" : "0");
|
||||
appcfg->set("orient", rot_key, settings_out.enable_rotation);
|
||||
settings_changed = true;
|
||||
}
|
||||
|
||||
if (imgui->checkbox(_L("Optimize support interface area"), settings.min_area)) {
|
||||
settings_out.min_area = settings.min_area;
|
||||
appcfg->set("orient", key_min_area, settings_out.min_area ? "1" : "0");
|
||||
appcfg->set("orient", key_min_area, settings_out.min_area);
|
||||
settings_changed = true;
|
||||
}
|
||||
|
||||
|
@ -5145,8 +5160,8 @@ bool GLCanvas3D::_render_orient_menu(float left, float right, float bottom, floa
|
|||
settings_out = OrientSettings{};
|
||||
settings_out.overhang_angle = 60.f;
|
||||
appcfg->set("orient", angle_key, std::to_string(settings_out.overhang_angle));
|
||||
appcfg->set("orient", rot_key, settings_out.enable_rotation ? "1" : "0");
|
||||
appcfg->set("orient", key_min_area, settings_out.min_area? "1" : "0");
|
||||
appcfg->set("orient", rot_key, settings_out.enable_rotation );
|
||||
appcfg->set("orient", key_min_area, settings_out.min_area);
|
||||
settings_changed = true;
|
||||
}
|
||||
|
||||
|
@ -5240,13 +5255,13 @@ bool GLCanvas3D::_render_arrange_menu(float left, float right, float bottom, flo
|
|||
ImGui::Separator();
|
||||
if (imgui->bbl_checkbox(_L("Auto rotate for arrangement"), settings.enable_rotation)) {
|
||||
settings_out.enable_rotation = settings.enable_rotation;
|
||||
appcfg->set("arrange", rot_key.c_str(), settings_out.enable_rotation? "1" : "0");
|
||||
appcfg->set("arrange", rot_key.c_str(), settings_out.enable_rotation);
|
||||
settings_changed = true;
|
||||
}
|
||||
|
||||
if (imgui->bbl_checkbox(_L("Allow multiple materials on same plate"), settings.allow_multi_materials_on_same_plate)) {
|
||||
settings_out.allow_multi_materials_on_same_plate = settings.allow_multi_materials_on_same_plate;
|
||||
appcfg->set("arrange", multi_material_key.c_str(), settings_out.allow_multi_materials_on_same_plate ? "1" : "0");
|
||||
appcfg->set("arrange", multi_material_key.c_str(), settings_out.allow_multi_materials_on_same_plate );
|
||||
settings_changed = true;
|
||||
}
|
||||
|
||||
|
@ -5256,7 +5271,7 @@ bool GLCanvas3D::_render_arrange_menu(float left, float right, float bottom, flo
|
|||
if (op && op->getBool()) {
|
||||
if (imgui->bbl_checkbox(_L("Avoid extrusion calibration region"), settings.avoid_extrusion_cali_region)) {
|
||||
settings_out.avoid_extrusion_cali_region = settings.avoid_extrusion_cali_region;
|
||||
appcfg->set("arrange", avoid_extrusion_key.c_str(), settings_out.avoid_extrusion_cali_region ? "1" : "0");
|
||||
appcfg->set("arrange", avoid_extrusion_key.c_str(), settings_out.avoid_extrusion_cali_region);
|
||||
settings_changed = true;
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -1361,6 +1361,9 @@ wxWindow *SelectMachineDialog::create_ams_checkbox(wxString title, wxWindow *par
|
|||
|
||||
checkbox->SetToolTip(tooltip);
|
||||
text->SetToolTip(tooltip);
|
||||
ams_check->Bind(wxEVT_TOGGLEBUTTON, [this](wxCommandEvent &e) {
|
||||
wxGetApp().app_config->set("bbl_machine", "use_ams", ams_check->GetValue());
|
||||
});
|
||||
|
||||
text->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent & event) {
|
||||
ams_check->SetValue(ams_check->GetValue() ? false : true);
|
||||
|
@ -1398,6 +1401,10 @@ wxWindow *SelectMachineDialog::create_item_checkbox(wxString title, wxWindow *pa
|
|||
checkbox->SetToolTip(tooltip);
|
||||
text->SetToolTip(tooltip);
|
||||
|
||||
checkbox->Bind(wxEVT_TOGGLEBUTTON, [this, param, check](wxCommandEvent &e) {
|
||||
wxGetApp().app_config->set("bbl_machine",param.c_str(), check->GetValue());
|
||||
});
|
||||
|
||||
text->Bind(wxEVT_LEFT_DOWN, [this, check](wxMouseEvent &) { check->SetValue(check->GetValue() ? false : true); });
|
||||
m_checkbox_list[param] = check;
|
||||
return checkbox;
|
||||
|
@ -1407,12 +1414,18 @@ void SelectMachineDialog::update_select_layout(MachineObject *obj)
|
|||
{
|
||||
if (obj && obj->is_function_supported(PrinterFunction::FUNC_FLOW_CALIBRATION)) {
|
||||
select_flow->Show();
|
||||
auto flow_cali_str = wxGetApp().app_config->get("bbl_machine", "flow_cali");
|
||||
if(!flow_cali_str.empty())
|
||||
m_checkbox_list["flow_cali"]->SetValue(flow_cali_str == "1" || flow_cali_str == "true");
|
||||
} else {
|
||||
select_flow->Hide();
|
||||
}
|
||||
|
||||
if (obj && obj->is_function_supported(PrinterFunction::FUNC_AUTO_LEVELING)) {
|
||||
select_bed->Show();
|
||||
auto bed_leveling_str = wxGetApp().app_config->get("bbl_machine", "bed_leveling");
|
||||
if(!bed_leveling_str.empty())
|
||||
m_checkbox_list["bed_leveling"]->SetValue(bed_leveling_str == "1" || bed_leveling_str == "true");
|
||||
} else {
|
||||
select_bed->Hide();
|
||||
}
|
||||
|
@ -1421,6 +1434,9 @@ void SelectMachineDialog::update_select_layout(MachineObject *obj)
|
|||
&& obj->is_support_print_with_timelapse()
|
||||
&& is_show_timelapse()) {
|
||||
select_timelapse->Show();
|
||||
auto timelapse_str = wxGetApp().app_config->get("bbl_machine", "timelapse");
|
||||
if(!timelapse_str.empty())
|
||||
m_checkbox_list["timelapse"]->SetValue(timelapse_str == "1" || timelapse_str == "true");
|
||||
} else {
|
||||
select_timelapse->Hide();
|
||||
}
|
||||
|
@ -2533,6 +2549,9 @@ void SelectMachineDialog::update_ams_check(MachineObject* obj)
|
|||
&& obj->ams_support_use_ams
|
||||
&& obj->has_ams()) {
|
||||
select_use_ams->Show();
|
||||
auto use_ams_str = wxGetApp().app_config->get("bbl_machine", "use_ams");
|
||||
if(!use_ams_str.empty())
|
||||
ams_check->SetValue(use_ams_str == "1" || use_ams_str == "true");
|
||||
} else {
|
||||
select_use_ams->Hide();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue