enabled dependency setting for filament and process (#6235)

* enabled dependency setting for filament and process

* Add information about inheritance back to Dependencies tab

* Merge pull request #1 from michmela44/Add_inherits_to_dependencies

Add information about inheritance back to Dependencies tab

* Merge branch 'main' into feature/enable_profile_dependencies
This commit is contained in:
Azi 2025-01-13 04:49:46 -08:00 committed by GitHub
parent cd4a1e01ae
commit 4c955e5cb5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1064,26 +1064,24 @@ void Tab::on_roll_back_value(const bool to_sys /*= true*/)
load_key_value("printable_area", true/*some value*/, true); load_key_value("printable_area", true/*some value*/, true);
} }
} }
//if (group->title == "Profile dependencies") { if (group->title == "Profile dependencies") {
// // "compatible_printers" option doesn't exists in Printer Settimgs Tab if (m_type != Preset::TYPE_PRINTER && (m_options_list["compatible_printers"] & os) == 0) {
// if (m_type != Preset::TYPE_PRINTER && (m_options_list["compatible_printers"] & os) == 0) { to_sys ? group->back_to_sys_value("compatible_printers") : group->back_to_initial_value("compatible_printers");
// to_sys ? group->back_to_sys_value("compatible_printers") : group->back_to_initial_value("compatible_printers"); load_key_value("compatible_printers", true/*some value*/, true);
// load_key_value("compatible_printers", true/*some value*/, true);
// bool is_empty = m_config->option<ConfigOptionStrings>("compatible_printers")->values.empty(); bool is_empty = m_config->option<ConfigOptionStrings>("compatible_printers")->values.empty();
// m_compatible_printers.checkbox->SetValue(is_empty); m_compatible_printers.checkbox->SetValue(is_empty);
// is_empty ? m_compatible_printers.btn->Disable() : m_compatible_printers.btn->Enable(); is_empty ? m_compatible_printers.btn->Disable() : m_compatible_printers.btn->Enable();
// } }
// // "compatible_prints" option exists only in Filament Settimgs and Materials Tabs if ((m_type == Preset::TYPE_FILAMENT || m_type == Preset::TYPE_SLA_MATERIAL) && (m_options_list["compatible_prints"] & os) == 0) {
// if ((m_type == Preset::TYPE_FILAMENT || m_type == Preset::TYPE_SLA_MATERIAL) && (m_options_list["compatible_prints"] & os) == 0) { to_sys ? group->back_to_sys_value("compatible_prints") : group->back_to_initial_value("compatible_prints");
// to_sys ? group->back_to_sys_value("compatible_prints") : group->back_to_initial_value("compatible_prints"); load_key_value("compatible_prints", true/*some value*/, true);
// load_key_value("compatible_prints", true/*some value*/, true);
// bool is_empty = m_config->option<ConfigOptionStrings>("compatible_prints")->values.empty(); bool is_empty = m_config->option<ConfigOptionStrings>("compatible_prints")->values.empty();
// m_compatible_prints.checkbox->SetValue(is_empty); m_compatible_prints.checkbox->SetValue(is_empty);
// is_empty ? m_compatible_prints.btn->Disable() : m_compatible_prints.btn->Enable(); is_empty ? m_compatible_prints.btn->Disable() : m_compatible_prints.btn->Enable();
// } }
//} }
for (const auto &kvp : group->opt_map()) { for (const auto &kvp : group->opt_map()) {
const std::string& opt_key = kvp.first; const std::string& opt_key = kvp.first;
if ((m_options_list[opt_key] & os) == 0) if ((m_options_list[opt_key] & os) == 0)
@ -1380,6 +1378,11 @@ void Tab::on_value_change(const std::string& opt_key, const boost::any& value)
return; return;
} }
if (opt_key == "compatible_prints")
this->compatible_widget_reload(m_compatible_prints);
if (opt_key == "compatible_printers")
this->compatible_widget_reload(m_compatible_printers);
const bool is_fff = supports_printer_technology(ptFFF); const bool is_fff = supports_printer_technology(ptFFF);
ConfigOptionsGroup* og_freq_chng_params = wxGetApp().sidebar().og_freq_chng_params(is_fff); ConfigOptionsGroup* og_freq_chng_params = wxGetApp().sidebar().og_freq_chng_params(is_fff);
//BBS: GUI refactor //BBS: GUI refactor
@ -1855,7 +1858,7 @@ void Tab::build_preset_description_line(ConfigOptionsGroup* optgroup)
}; };
auto detach_preset_btn = [this](wxWindow* parent) { auto detach_preset_btn = [this](wxWindow* parent) {
m_detach_preset_btn = new ScalableButton(parent, wxID_ANY, "lock_normal_sys", "", m_detach_preset_btn = new ScalableButton(parent, wxID_ANY, "lock_normal", "",
wxDefaultSize, wxDefaultPosition, wxBU_LEFT | wxBU_EXACTFIT, true); wxDefaultSize, wxDefaultPosition, wxBU_LEFT | wxBU_EXACTFIT, true);
ScalableButton* btn = m_detach_preset_btn; ScalableButton* btn = m_detach_preset_btn;
btn->SetFont(Slic3r::GUI::wxGetApp().normal_font()); btn->SetFont(Slic3r::GUI::wxGetApp().normal_font());
@ -1863,25 +1866,25 @@ void Tab::build_preset_description_line(ConfigOptionsGroup* optgroup)
auto sizer = new wxBoxSizer(wxHORIZONTAL); auto sizer = new wxBoxSizer(wxHORIZONTAL);
sizer->Add(btn); sizer->Add(btn);
//btn->Bind(wxEVT_BUTTON, [this, parent](wxCommandEvent&) btn->Bind(wxEVT_BUTTON, [this, parent](wxCommandEvent&)
//{ {
// bool system = m_presets->get_edited_preset().is_system; bool system = m_presets->get_edited_preset().is_system;
// bool dirty = m_presets->get_edited_preset().is_dirty; bool dirty = m_presets->get_edited_preset().is_dirty;
// wxString msg_text = system ? wxString msg_text = system ?
// _(L("A copy of the current system preset will be created, which will be detached from the system preset.")) : _(L("A copy of the current system preset will be created, which will be detached from the system preset.")) :
// _(L("The current custom preset will be detached from the parent system preset.")); _(L("The current custom preset will be detached from the parent system preset."));
// if (dirty) { if (dirty) {
// msg_text += "\n\n"; msg_text += "\n\n";
// msg_text += _(L("Modifications to the current profile will be saved.")); msg_text += _(L("Modifications to the current profile will be saved."));
// } }
// msg_text += "\n\n"; msg_text += "\n\n";
// msg_text += _(L("This action is not revertible.\nDo you want to proceed?")); msg_text += _(L("This action is not revertible.\nDo you want to proceed?"));
// //wxMessageDialog dialog(parent, msg_text, _(L("Detach preset")), wxICON_WARNING | wxYES_NO | wxCANCEL); //wxMessageDialog dialog(parent, msg_text, _(L("Detach preset")), wxICON_WARNING | wxYES_NO | wxCANCEL);
// MessageDialog dialog(parent, msg_text, _(L("Detach preset")), wxICON_WARNING | wxYES_NO | wxCANCEL); MessageDialog dialog(parent, msg_text, _(L("Detach preset")), wxICON_WARNING | wxYES_NO | wxCANCEL);
// if (dialog.ShowModal() == wxID_YES) if (dialog.ShowModal() == wxID_YES)
// save_preset(m_presets->get_edited_preset().is_system ? std::string() : m_presets->get_edited_preset().name, true); save_preset(m_presets->get_edited_preset().is_system ? std::string() : m_presets->get_edited_preset().name, true);
//}); });
btn->Hide(); btn->Hide();
@ -1903,72 +1906,72 @@ void Tab::update_preset_description_line()
wxString description_line; wxString description_line;
//if (preset.is_default) { if (preset.is_default) {
// description_line = _(L("This is a default preset.")); description_line = _(L("This is a default preset."));
//} else if (preset.is_system) { } else if (preset.is_system) {
// description_line = _(L("This is a system preset.")); description_line = _(L("This is a system preset."));
//} else if (parent == nullptr) { } else if (parent == nullptr) {
// description_line = _(L("Current preset is inherited from the default preset.")); description_line = _(L("Current preset is inherited from the default preset."));
//} else { } else {
// std::string name = parent->name; std::string name = parent->name;
// boost::replace_all(name, "&", "&&"); boost::replace_all(name, "&", "&&");
// description_line = _(L("Current preset is inherited from")) + ":\n\t" + from_u8(name); description_line = _(L("Current preset is inherited from")) + ":\n\t" + from_u8(name);
//} }
//if (preset.is_default || preset.is_system) if (preset.is_default || preset.is_system)
// description_line += "\n\t" + _(L("It can't be deleted or modified.")) + description_line += "\n\t" + _(L("It can't be deleted or modified.")) +
// "\n\t" + _(L("Any modifications should be saved as a new preset inherited from this one.")) + "\n\t" + _(L("Any modifications should be saved as a new preset inherited from this one.")) +
// "\n\t" + _(L("To do that please specify a new name for the preset.")); "\n\t" + _(L("To do that please specify a new name for the preset."));
//if (parent && parent->vendor) if (parent && parent->vendor)
//{ {
// description_line += "\n\n" + _(L("Additional information:")) + "\n"; description_line += "\n\n" + _(L("Additional information:")) + "\n";
// description_line += "\t" + _(L("vendor")) + ": " + (m_type == Slic3r::Preset::TYPE_PRINTER ? "\n\t\t" : "") + parent->vendor->name + description_line += "\t" + _(L("vendor")) + ": " + (m_type == Slic3r::Preset::TYPE_PRINTER ? "\n\t\t" : "") + parent->vendor->name +
// ", ver: " + parent->vendor->config_version.to_string(); ", ver: " + parent->vendor->config_version.to_string();
// if (m_type == Slic3r::Preset::TYPE_PRINTER) { if (m_type == Slic3r::Preset::TYPE_PRINTER) {
// const std::string &printer_model = preset.config.opt_string("printer_model"); const std::string &printer_model = preset.config.opt_string("printer_model");
// if (! printer_model.empty()) if (! printer_model.empty())
// description_line += "\n\n\t" + _(L("printer model")) + ": \n\t\t" + printer_model; description_line += "\n\n\t" + _(L("printer model")) + ": \n\t\t" + printer_model;
// switch (preset.printer_technology()) { switch (preset.printer_technology()) {
// case ptFFF: case ptFFF:
// { {
// //FIXME add prefered_sla_material_profile for SLA //FIXME add prefered_sla_material_profile for SLA
// const std::string &default_print_profile = preset.config.opt_string("default_print_profile"); const std::string &default_print_profile = preset.config.opt_string("default_print_profile");
// const std::vector<std::string> &default_filament_profiles = preset.config.option<ConfigOptionStrings>("default_filament_profile")->values; const std::vector<std::string> &default_filament_profiles = preset.config.option<ConfigOptionStrings>("default_filament_profile")->values;
// if (!default_print_profile.empty()) if (!default_print_profile.empty())
// description_line += "\n\n\t" + _(L("default print profile")) + ": \n\t\t" + default_print_profile; description_line += "\n\n\t" + _(L("default print profile")) + ": \n\t\t" + default_print_profile;
// if (!default_filament_profiles.empty()) if (!default_filament_profiles.empty())
// { {
// description_line += "\n\n\t" + _(L("default filament profile")) + ": \n\t\t"; description_line += "\n\n\t" + _(L("default filament profile")) + ": \n\t\t";
// for (auto& profile : default_filament_profiles) { for (auto& profile : default_filament_profiles) {
// if (&profile != &*default_filament_profiles.begin()) if (&profile != &*default_filament_profiles.begin())
// description_line += ", "; description_line += ", ";
// description_line += profile; description_line += profile;
// } }
// } }
// break; break;
// } }
// case ptSLA: case ptSLA:
// { {
// //FIXME add prefered_sla_material_profile for SLA //FIXME add prefered_sla_material_profile for SLA
// const std::string &default_sla_material_profile = preset.config.opt_string("default_sla_material_profile"); const std::string &default_sla_material_profile = preset.config.opt_string("default_sla_material_profile");
// if (!default_sla_material_profile.empty()) if (!default_sla_material_profile.empty())
// description_line += "\n\n\t" + _(L("default SLA material profile")) + ": \n\t\t" + default_sla_material_profile; description_line += "\n\n\t" + _(L("default SLA material profile")) + ": \n\t\t" + default_sla_material_profile;
// const std::string &default_sla_print_profile = preset.config.opt_string("default_sla_print_profile"); const std::string &default_sla_print_profile = preset.config.opt_string("default_sla_print_profile");
// if (!default_sla_print_profile.empty()) if (!default_sla_print_profile.empty())
// description_line += "\n\n\t" + _(L("default SLA print profile")) + ": \n\t\t" + default_sla_print_profile; description_line += "\n\n\t" + _(L("default SLA print profile")) + ": \n\t\t" + default_sla_print_profile;
// break; break;
// } }
// default: break; default: break;
// } }
// } }
// else if (!preset.alias.empty()) else if (!preset.alias.empty())
// { {
// description_line += "\n\n\t" + _(L("full profile name")) + ": \n\t\t" + preset.name; description_line += "\n\n\t" + _(L("full profile name")) + ": \n\t\t" + preset.name;
// description_line += "\n\t" + _(L("symbolic profile name")) + ": \n\t\t" + preset.alias; description_line += "\n\t" + _(L("symbolic profile name")) + ": \n\t\t" + preset.alias;
// } }
//} }
m_parent_preset_description_line->SetText(description_line, false); m_parent_preset_description_line->SetText(description_line, false);
@ -2378,19 +2381,19 @@ page = add_options_page(L("Others"), "custom-gcode_other"); // ORCA: icon only v
option.opt.height = 25;//250; option.opt.height = 25;//250;
optgroup->append_single_option_line(option); optgroup->append_single_option_line(option);
#if 0 #if 1
//page = add_options_page(L("Dependencies"), "advanced.png"); page = add_options_page(L("Dependencies"), "custom-gcode_advanced");
// optgroup = page->new_optgroup(L("Profile dependencies")); optgroup = page->new_optgroup(L("Profile dependencies"));
// create_line_with_widget(optgroup.get(), "compatible_printers", "", [this](wxWindow* parent) { create_line_with_widget(optgroup.get(), "compatible_printers", "", [this](wxWindow* parent) {
// return compatible_widget_create(parent, m_compatible_printers); return compatible_widget_create(parent, m_compatible_printers);
// }); });
//
// option = optgroup->get_option("compatible_printers_condition");
// option.opt.full_width = true;
// optgroup->append_single_option_line(option);
// build_preset_description_line(optgroup.get()); option = optgroup->get_option("compatible_printers_condition");
option.opt.full_width = true;
optgroup->append_single_option_line(option);
build_preset_description_line(optgroup.get());
#endif #endif
} }
@ -2482,8 +2485,8 @@ void TabPrint::update()
m_update_cnt--; m_update_cnt--;
if (m_update_cnt==0) { if (m_update_cnt==0) {
toggle_options(); if (m_active_page && !(m_active_page->title() == "Dependencies"))
toggle_options();
// update() could be called during undo/redo execution // update() could be called during undo/redo execution
// Update of objectList can cause a crash in this case (because m_objects doesn't match ObjectList) // Update of objectList can cause a crash in this case (because m_objects doesn't match ObjectList)
if (m_type != Preset::TYPE_MODEL && !wxGetApp().plater()->inside_snapshot_capture()) if (m_type != Preset::TYPE_MODEL && !wxGetApp().plater()->inside_snapshot_capture())
@ -3531,26 +3534,26 @@ void TabFilament::build()
option.opt.full_width = true; option.opt.full_width = true;
option.opt.height = notes_field_height;// 250; option.opt.height = notes_field_height;// 250;
optgroup->append_single_option_line(option); optgroup->append_single_option_line(option);
#if 0 #if 1
//page = add_options_page(L("Dependencies"), "advanced"); page = add_options_page(L("Dependencies"), "advanced");
// optgroup = page->new_optgroup(L("Profile dependencies")); optgroup = page->new_optgroup(L("Profile dependencies"));
// create_line_with_widget(optgroup.get(), "compatible_printers", "", [this](wxWindow* parent) { create_line_with_widget(optgroup.get(), "compatible_printers", "", [this](wxWindow* parent) {
// return compatible_widget_create(parent, m_compatible_printers); return compatible_widget_create(parent, m_compatible_printers);
// }); });
// option = optgroup->get_option("compatible_printers_condition"); option = optgroup->get_option("compatible_printers_condition");
// option.opt.full_width = true; option.opt.full_width = true;
// optgroup->append_single_option_line(option); optgroup->append_single_option_line(option);
// create_line_with_widget(optgroup.get(), "compatible_prints", "", [this](wxWindow* parent) { create_line_with_widget(optgroup.get(), "compatible_prints", "", [this](wxWindow* parent) {
// return compatible_widget_create(parent, m_compatible_prints); return compatible_widget_create(parent, m_compatible_prints);
// }); });
// option = optgroup->get_option("compatible_prints_condition"); option = optgroup->get_option("compatible_prints_condition");
// option.opt.full_width = true; option.opt.full_width = true;
// optgroup->append_single_option_line(option); optgroup->append_single_option_line(option);
// build_preset_description_line(optgroup.get()); //build_preset_description_line(optgroup.get());
#endif #endif
} }
@ -5297,7 +5300,8 @@ void Tab::activate_selected_page(std::function<void()> throw_if_canceled)
m_active_page->activate(m_mode, throw_if_canceled); m_active_page->activate(m_mode, throw_if_canceled);
update_changed_ui(); update_changed_ui();
update_description_lines(); update_description_lines();
toggle_options(); if (m_active_page && !(m_active_page->title() == "Dependencies"))
toggle_options();
m_active_page->update_visibility(m_mode, true); // for taggle line m_active_page->update_visibility(m_mode, true); // for taggle line
} }
@ -6270,8 +6274,8 @@ const ConfigOptionsGroupShp Page::get_optgroup(const wxString& title) const
void TabSLAMaterial::build() void TabSLAMaterial::build()
{ {
//m_presets = &m_preset_bundle->sla_materials; m_presets = &m_preset_bundle->sla_materials;
//load_initial_data(); load_initial_data();
//auto page = add_options_page(L("Material"), ""); //auto page = add_options_page(L("Material"), "");