WIP: SL1 profiles, SL1 in wizard, switching between FFF / SLA

This commit is contained in:
bubnikv 2018-10-31 16:22:36 +01:00
parent 66e97aa4eb
commit fd1c5dd218
21 changed files with 408 additions and 148 deletions

View file

@ -74,7 +74,7 @@ void BackgroundSlicingProcess::thread_proc()
this->set_step_done(bspsGCodeFinalize);
}
}
} catch (CanceledException &ex) {
} catch (CanceledException & /* ex */) {
// Canceled, this is all right.
assert(m_print->canceled());
} catch (std::exception &ex) {

View file

@ -234,13 +234,13 @@ void BedShapePanel::update_shape()
Vec2d rect_origin(Vec2d::Zero());
try{
rect_size = boost::any_cast<Vec2d>(m_optgroups[SHAPE_RECTANGULAR]->get_value("rect_size")); }
catch (const std::exception &e){
catch (const std::exception & /* e */){
return;
}
try{
rect_origin = boost::any_cast<Vec2d>(m_optgroups[SHAPE_RECTANGULAR]->get_value("rect_origin"));
}
catch (const std::exception &e){
catch (const std::exception & /* e */){
return;}
auto x = rect_size(0);
@ -269,7 +269,7 @@ void BedShapePanel::update_shape()
try{
diameter = boost::any_cast<double>(m_optgroups[SHAPE_CIRCULAR]->get_value("diameter"));
}
catch (const std::exception &e){
catch (const std::exception & /* e */){
return;
}
if (diameter == 0.0) return ;

View file

@ -39,7 +39,7 @@ private:
struct priv;
std::unique_ptr<priv> p;
friend class ConfigWizardPage;
friend struct ConfigWizardPage;
};

View file

@ -68,7 +68,7 @@ void enable_screensaver()
bool debugged()
{
#ifdef _WIN32
return IsDebuggerPresent();
return IsDebuggerPresent() == TRUE;
#else
return false;
#endif /* _WIN32 */
@ -233,7 +233,7 @@ void change_opt_value(DynamicPrintConfig& config, const t_config_option_key& opt
break;
}
}
catch (const std::exception &e)
catch (const std::exception & /* e */)
{
int i = 0;//no reason, just experiment
}

View file

@ -91,7 +91,7 @@ bool GUI_App::OnInit()
load_language();
// Suppress the '- default -' presets.
preset_bundle->set_default_suppressed(app_config->get("no_defaults").empty() ? false : true);
preset_bundle->set_default_suppressed(app_config->get("no_defaults") == "1");
// eval{
preset_bundle->load_presets(*app_config);
// };
@ -601,8 +601,9 @@ void GUI_App::add_config_menu(wxMenuBar *menu)
bool GUI_App::check_unsaved_changes()
{
std::string dirty;
PrinterTechnology printer_technology = preset_bundle->printers.get_edited_preset().printer_technology();
for (Tab *tab : tabs_list)
if (tab->current_preset_is_dirty())
if (tab->supports_printer_technology(printer_technology) && tab->current_preset_is_dirty())
if (dirty.empty())
dirty = tab->name();
else
@ -636,9 +637,10 @@ void GUI_App::delete_tab_from_list(Tab* tab)
// Update UI / Tabs to reflect changes in the currently loaded presets
void GUI_App::load_current_presets()
{
for (Tab *tab : tabs_list) {
tab->load_current_preset();
}
PrinterTechnology printer_technology = preset_bundle->printers.get_edited_preset().printer_technology();
for (Tab *tab : tabs_list)
if (tab->supports_printer_technology(printer_technology))
tab->load_current_preset();
}
Sidebar& GUI_App::sidebar()

View file

@ -418,7 +418,7 @@ struct Sidebar::priv
void Sidebar::priv::show_preset_comboboxes()
{
const bool showSLA = wxGetApp().preset_bundle->printers.get_selected_preset().printer_technology() == ptSLA;
const bool showSLA = wxGetApp().preset_bundle->printers.get_edited_preset().printer_technology() == ptSLA;
wxWindowUpdateLocker noUpdates(wxGetApp().mainframe);
@ -562,40 +562,49 @@ void Sidebar::remove_unused_filament_combos(const int current_extruder_count)
void Sidebar::update_presets(Preset::Type preset_type)
{
PresetBundle &preset_bundle = *wxGetApp().preset_bundle;
switch (preset_type) {
case Preset::TYPE_FILAMENT:
if (p->combos_filament.size() == 1) {
// Single filament printer, synchronize the filament presets.
const std::string &name = wxGetApp().preset_bundle->filaments.get_selected_preset().name;
wxGetApp().preset_bundle->set_filament_preset(0, name);
const std::string &name = preset_bundle.filaments.get_selected_preset().name;
preset_bundle.set_filament_preset(0, name);
}
for (size_t i = 0; i < p->combos_filament.size(); i++) {
wxGetApp().preset_bundle->update_platter_filament_ui(i, p->combos_filament[i]);
preset_bundle.update_platter_filament_ui(i, p->combos_filament[i]);
}
break;
case Preset::TYPE_PRINT:
wxGetApp().preset_bundle->prints.update_platter_ui(p->combo_print);
preset_bundle.prints.update_platter_ui(p->combo_print);
break;
case Preset::TYPE_SLA_MATERIAL:
wxGetApp().preset_bundle->sla_materials.update_platter_ui(p->combo_sla_material);
preset_bundle.sla_materials.update_platter_ui(p->combo_sla_material);
break;
case Preset::TYPE_PRINTER:
// Update the print choosers to only contain the compatible presets, update the dirty flags.
wxGetApp().preset_bundle->prints.update_platter_ui(p->combo_print);
// Update the printer choosers, update the dirty flags.
wxGetApp().preset_bundle->printers.update_platter_ui(p->combo_printer);
// Update the filament choosers to only contain the compatible presets, update the color preview,
// update the dirty flags.
for (size_t i = 0; i < p->combos_filament.size(); i++) {
wxGetApp().preset_bundle->update_platter_filament_ui(i, p->combos_filament[i]);
}
p->show_preset_comboboxes();
break;
case Preset::TYPE_PRINTER:
{
PrinterTechnology printer_technology = preset_bundle.printers.get_edited_preset().printer_technology();
// Update the print choosers to only contain the compatible presets, update the dirty flags.
if (printer_technology == ptFFF)
preset_bundle.prints.update_platter_ui(p->combo_print);
else
preset_bundle.sla_materials.update_platter_ui(p->combo_sla_material);
// Update the printer choosers, update the dirty flags.
preset_bundle.printers.update_platter_ui(p->combo_printer);
// Update the filament choosers to only contain the compatible presets, update the color preview,
// update the dirty flags.
if (printer_technology == ptFFF) {
for (size_t i = 0; i < p->combos_filament.size(); ++ i)
preset_bundle.update_platter_filament_ui(i, p->combos_filament[i]);
}
p->show_preset_comboboxes();
break;
}
default: break;
}

View file

@ -210,23 +210,20 @@ void Preset::normalize(DynamicPrintConfig &config)
}
}
DynamicPrintConfig& Preset::load(const std::vector<std::string> &keys, const StaticPrintConfig &defaults)
std::string Preset::remove_invalid_keys(DynamicPrintConfig &config, const DynamicPrintConfig &default_config)
{
// Set the configuration from the defaults.
this->config.apply_only(defaults, keys.empty() ? defaults.keys() : keys);
if (! this->is_default) {
// Load the preset file, apply preset values on top of defaults.
try {
this->config.load_from_ini(this->file);
Preset::normalize(this->config);
} catch (const std::ifstream::failure &err) {
throw std::runtime_error(std::string("The selected preset cannot be loaded: ") + this->file + "\n\tReason: " + err.what());
} catch (const std::runtime_error &err) {
throw std::runtime_error(std::string("Failed loading the preset file: ") + this->file + "\n\tReason: " + err.what());
std::string incorrect_keys;
for (const std::string &key : config.keys())
if (! default_config.has(key)) {
if (incorrect_keys.empty())
incorrect_keys = key;
else {
incorrect_keys += ", ";
incorrect_keys += key;
}
config.erase(key);
}
}
this->loaded = true;
return this->config;
return incorrect_keys;
}
void Preset::save()
@ -390,6 +387,7 @@ const std::vector<std::string>& Preset::sla_material_options()
"exposure_time", "initial_exposure_time",
"material_correction_printing", "material_correction_curing",
"material_notes",
"default_sla_material_profile",
"compatible_printers",
"compatible_printers_condition", "inherits"
};
@ -436,7 +434,8 @@ void PresetCollection::add_default_preset(const std::vector<std::string> &keys,
{
// Insert just the default preset.
m_presets.emplace_back(Preset(this->type(), preset_name, true));
m_presets.back().load(keys, defaults);
m_presets.back().config.apply_only(defaults, keys.empty() ? defaults.keys() : keys);
m_presets.back().loaded = true;
++ m_num_default_presets;
}
@ -446,7 +445,6 @@ void PresetCollection::load_presets(const std::string &dir_path, const std::stri
{
boost::filesystem::path dir = boost::filesystem::canonical(boost::filesystem::path(dir_path) / subdir).make_preferred();
m_dir_path = dir.string();
t_config_option_keys keys = this->default_preset().config.keys();
std::string errors_cummulative;
for (auto &dir_entry : boost::filesystem::directory_iterator(dir))
if (boost::filesystem::is_regular_file(dir_entry.status()) && boost::algorithm::iends_with(dir_entry.path().filename().string(), ".ini")) {
@ -462,8 +460,26 @@ void PresetCollection::load_presets(const std::string &dir_path, const std::stri
try {
Preset preset(m_type, name, false);
preset.file = dir_entry.path().string();
//FIXME One should initialize with SLAFullPrintConfig for the SLA profiles!
preset.load(keys, static_cast<const HostConfig&>(FullPrintConfig::defaults()));
// Load the preset file, apply preset values on top of defaults.
try {
DynamicPrintConfig config;
config.load_from_ini(preset.file);
// Find a default preset for the config. The PrintPresetCollection provides different default preset based on the "printer_technology" field.
const Preset &default_preset = this->default_preset_for(config);
preset.config = default_preset.config;
preset.config.apply(std::move(config));
Preset::normalize(preset.config);
// Report configuration fields, which are misplaced into a wrong group.
std::string incorrect_keys = Preset::remove_invalid_keys(config, default_preset.config);
if (! incorrect_keys.empty())
BOOST_LOG_TRIVIAL(error) << "Error in a preset file: The preset \"" <<
preset.file << "\" contains the following incorrect keys: " << incorrect_keys << ", which were removed";
preset.loaded = true;
} catch (const std::ifstream::failure &err) {
throw std::runtime_error(std::string("The selected preset cannot be loaded: ") + preset.file + "\n\tReason: " + err.what());
} catch (const std::runtime_error &err) {
throw std::runtime_error(std::string("Failed loading the preset file: ") + preset.file + "\n\tReason: " + err.what());
}
m_presets.emplace_back(preset);
} catch (const std::runtime_error &err) {
errors_cummulative += err.what();
@ -491,8 +507,8 @@ static bool profile_print_params_same(const DynamicPrintConfig &cfg1, const Dyna
// Following keys are used by the UI, not by the slicing core, therefore they are not important
// when comparing profiles for equality. Ignore them.
for (const char *key : { "compatible_printers", "compatible_printers_condition", "inherits",
"print_settings_id", "filament_settings_id", "printer_settings_id",
"printer_model", "printer_variant", "default_print_profile", "default_filament_profile" })
"print_settings_id", "filament_settings_id", "sla_material_settings_id", "printer_settings_id",
"printer_model", "printer_variant", "default_print_profile", "default_filament_profile", "default_sla_material_profile" })
diff.erase(std::remove(diff.begin(), diff.end(), key), diff.end());
// Preset with the same name as stored inside the config exists.
return diff.empty();
@ -718,7 +734,7 @@ size_t PresetCollection::update_compatible_with_printer_internal(const Preset &a
Preset &preset_edited = selected ? m_edited_preset : preset_selected;
if (! preset_edited.update_compatible_with_printer(active_printer, &config) &&
selected && unselect_if_incompatible)
m_idx_selected = (size_t)-1;
m_idx_selected = -1;
if (selected)
preset_selected.is_compatible = preset_edited.is_compatible;
}
@ -1018,4 +1034,10 @@ std::string PresetCollection::path_from_name(const std::string &new_name) const
return (boost::filesystem::path(m_dir_path) / file_name).make_preferred().string();
}
const Preset& PrinterPresetCollection::default_preset_for(const DynamicPrintConfig &config) const
{
const ConfigOptionEnumGeneric *opt_printer_technology = config.opt<ConfigOptionEnumGeneric>("printer_technology");
return this->default_preset((opt_printer_technology == nullptr || opt_printer_technology->value == 0) ? 0 : 1);
}
} // namespace Slic3r

View file

@ -125,9 +125,6 @@ public:
// Configuration data, loaded from a file, or set from the defaults.
DynamicPrintConfig config;
// Load this profile for the following keys only.
DynamicPrintConfig& load(const std::vector<std::string> &keys, const StaticPrintConfig &defaults);
void save();
// Return a label of this preset, consisting of a name and a "(modified)" suffix, if this preset is dirty.
@ -177,8 +174,10 @@ public:
static const std::vector<std::string>& sla_printer_options();
static const std::vector<std::string>& sla_material_options();
static void update_suffix_modified();
static void normalize(DynamicPrintConfig &config);
static void update_suffix_modified();
static void normalize(DynamicPrintConfig &config);
// Report configuration fields, which are misplaced into a wrong group, remove them from the config.
static std::string remove_invalid_keys(DynamicPrintConfig &config, const DynamicPrintConfig &default_config);
protected:
friend class PresetCollection;
@ -200,9 +199,11 @@ public:
typedef std::deque<Preset>::iterator Iterator;
typedef std::deque<Preset>::const_iterator ConstIterator;
Iterator begin() { return m_presets.begin() + m_num_default_presets; }
ConstIterator begin() const { return m_presets.begin() + m_num_default_presets; }
ConstIterator begin() const { return m_presets.cbegin() + m_num_default_presets; }
ConstIterator cbegin() const { return m_presets.cbegin() + m_num_default_presets; }
Iterator end() { return m_presets.end(); }
ConstIterator end() const { return m_presets.end(); }
ConstIterator end() const { return m_presets.cend(); }
ConstIterator cend() const { return m_presets.cend(); }
void reset(bool delete_files);
@ -279,8 +280,9 @@ public:
static const std::string& get_suffix_modified();
// Return a preset possibly with modifications.
Preset& default_preset() { return m_presets.front(); }
const Preset& default_preset() const { return m_presets.front(); }
Preset& default_preset(size_t idx = 0) { assert(idx < m_num_default_presets); return m_presets[idx]; }
const Preset& default_preset(size_t idx = 0) const { assert(idx < m_num_default_presets); return m_presets[idx]; }
virtual const Preset& default_preset_for(const DynamicPrintConfig & /* config */) const { return this->default_preset(); }
// Return a preset by an index. If the preset is active, a temporary copy is returned.
Preset& preset(size_t idx) { return (int(idx) == m_idx_selected) ? m_edited_preset : m_presets[idx]; }
const Preset& preset(size_t idx) const { return const_cast<PresetCollection*>(this)->preset(idx); }
@ -440,6 +442,16 @@ private:
friend class PresetBundle;
};
// Printer supports the FFF and SLA technologies, with different set of configuration values,
// therefore this PresetCollection needs to handle two defaults.
class PrinterPresetCollection : public PresetCollection
{
public:
PrinterPresetCollection(Preset::Type type, const std::vector<std::string> &keys, const Slic3r::StaticPrintConfig &defaults, const std::string &default_name = "- default -") :
PresetCollection(type, keys, defaults, default_name) {}
const Preset& default_preset_for(const DynamicPrintConfig &config) const override;
};
} // namespace Slic3r
#endif /* slic3r_Preset_hpp_ */

View file

@ -79,13 +79,17 @@ PresetBundle::PresetBundle() :
this->printers.preset(1).printer_technology() = ptSLA;
for (size_t i = 0; i < 2; ++ i) {
// The following ugly switch is to avoid printers.preset(0) to return the edited instance, as the 0th default is the current one.
Preset &preset = (i == 0) ? this->printers.default_preset() : this->printers.preset(1);
Preset &preset = this->printers.default_preset(i);
preset.config.optptr("printer_settings_id", true);
preset.config.optptr("printer_vendor", true);
preset.config.optptr("printer_model", true);
preset.config.optptr("printer_variant", true);
preset.config.optptr("default_print_profile", true);
preset.config.option<ConfigOptionStrings>("default_filament_profile", true)->values = { "" };
if (i == 0) {
preset.config.optptr("default_print_profile", true);
preset.config.option<ConfigOptionStrings>("default_filament_profile", true)->values = { "" };
} else
preset.config.optptr("default_sla_material_profile", true);
// default_sla_material_profile
preset.inherits();
}
@ -315,7 +319,7 @@ void PresetBundle::load_selections(const AppConfig &config)
sla_materials.select_preset_by_name_strict(initial_sla_material_profile_name);
printers.select_preset_by_name(initial_printer_profile_name, true);
if (printers.get_selected_preset().printer_technology() == ptFFF){
if (printers.get_selected_preset().printer_technology() == ptFFF) {
// Load the names of the other filament profiles selected for a multi-material printer.
auto *nozzle_diameter = dynamic_cast<const ConfigOptionFloats*>(printers.get_selected_preset().config.option("nozzle_diameter"));
size_t num_extruders = nozzle_diameter->values.size();
@ -342,8 +346,8 @@ void PresetBundle::load_selections(const AppConfig &config)
// Export selections (current print, current filaments, current printer) into config.ini
void PresetBundle::export_selections(AppConfig &config)
{
assert(filament_presets.size() >= 1);
assert(filament_presets.size() > 1 || filaments.get_selected_preset_name() == filament_presets.front());
assert(this->printers.get_edited_preset().printer_technology() != ptFFF || filament_presets.size() >= 1);
assert(this->printers.get_edited_preset().printer_technology() != ptFFF || filament_presets.size() > 1 || filaments.get_selected_preset_name() == filament_presets.front());
config.clear_section("presets");
config.set("presets", "print", prints.get_selected_preset_name());
config.set("presets", "filament", filament_presets.front());
@ -975,7 +979,7 @@ size_t PresetBundle::load_configbundle(const std::string &path, unsigned int fla
} else if (boost::starts_with(section.first, "sla_material:")) {
presets = &this->sla_materials;
loaded = &loaded_sla_materials;
preset_name = section.first.substr(9);
preset_name = section.first.substr(13);
} else if (boost::starts_with(section.first, "printer:")) {
presets = &this->printers;
loaded = &loaded_printers;
@ -1025,25 +1029,25 @@ size_t PresetBundle::load_configbundle(const std::string &path, unsigned int fla
continue;
if (presets != nullptr) {
// Load the print, filament or printer preset.
const DynamicPrintConfig &default_config = presets->default_preset().config;
DynamicPrintConfig config(default_config);
for (auto &kvp : section.second)
config.set_deserialize(kvp.first, kvp.second.data());
const DynamicPrintConfig *default_config = nullptr;
DynamicPrintConfig config;
if (presets == &this->printers) {
// Select the default config based on the printer_technology field extracted from kvp.
DynamicPrintConfig config_src;
for (auto &kvp : section.second)
config_src.set_deserialize(kvp.first, kvp.second.data());
default_config = &presets->default_preset_for(config_src).config;
config = *default_config;
config.apply(config_src);
} else {
default_config = &presets->default_preset().config;
config = *default_config;
for (auto &kvp : section.second)
config.set_deserialize(kvp.first, kvp.second.data());
}
Preset::normalize(config);
// Report configuration fields, which are misplaced into a wrong group.
std::string incorrect_keys;
size_t n_incorrect_keys = 0;
for (const std::string &key : config.keys())
if (! default_config.has(key)) {
if (incorrect_keys.empty())
incorrect_keys = key;
else {
incorrect_keys += ", ";
incorrect_keys += key;
}
config.erase(key);
++ n_incorrect_keys;
}
std::string incorrect_keys = Preset::remove_invalid_keys(config, *default_config);
if (! incorrect_keys.empty())
BOOST_LOG_TRIVIAL(error) << "Error in a Vendor Config Bundle \"" << path << "\": The printer preset \"" <<
section.first << "\" contains the following incorrect keys: " << incorrect_keys << ", which were removed";
@ -1207,12 +1211,11 @@ void PresetBundle::update_compatible_with_printer(bool select_other_if_incompati
}
case ptSLA:
{
const std::string &prefered_print_profile = printer_preset.config.opt_string("default_print_profile");
const std::vector<std::string> &prefered_filament_profiles = printer_preset.config.option<ConfigOptionStrings>("default_filament_profile")->values;
prefered_print_profile.empty() ?
const std::string &prefered_sla_material_profile = printer_preset.config.opt_string("default_sla_material_profile");
prefered_sla_material_profile.empty() ?
this->sla_materials.update_compatible_with_printer(printer_preset, select_other_if_incompatible) :
this->sla_materials.update_compatible_with_printer(printer_preset, select_other_if_incompatible,
[&prefered_print_profile](const std::string& profile_name){ return profile_name == prefered_print_profile; });
[&prefered_sla_material_profile](const std::string& profile_name){ return profile_name == prefered_sla_material_profile; });
}
}
}

View file

@ -41,7 +41,7 @@ public:
PresetCollection prints;
PresetCollection filaments;
PresetCollection sla_materials;
PresetCollection printers;
PrinterPresetCollection printers;
// Filament preset names for a multi-extruder or multi-material print.
// extruders.size() should be the same as printers.get_edited_preset().config.nozzle_diameter.size()
std::vector<std::string> filament_presets;

View file

@ -627,7 +627,8 @@ void Tab::load_config(const DynamicPrintConfig& config)
}
// Reload current $self->{config} (aka $self->{presets}->edited_preset->config) into the UI fields.
void Tab::reload_config(){
void Tab::reload_config()
{
Freeze();
for (auto page : m_pages)
page->reload_config();
@ -787,6 +788,7 @@ void Tab::update_preset_description_line()
", ver: " + parent->vendor->config_version.to_string();
if (name() == "printer"){
const std::string &printer_model = preset.config.opt_string("printer_model");
//FIXME add prefered_sla_material_profile for SLA
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;
if (!printer_model.empty())
@ -2045,7 +2047,8 @@ void TabPrinter::on_preset_loaded()
void TabPrinter::update_pages()
{
// update m_pages ONLY if printer technology is changed
if (m_presets->get_edited_preset().printer_technology() == m_printer_technology)
const PrinterTechnology new_printer_technology = m_presets->get_edited_preset().printer_technology();
if (new_printer_technology == m_printer_technology)
return;
// hide all old pages
@ -2057,7 +2060,8 @@ void TabPrinter::update_pages()
// build Tab according to the technology, if it's not exist jet OR
// set m_pages_(technology after changing) to m_pages
if (m_presets->get_edited_preset().printer_technology() == ptFFF)
// m_printer_technology will be set by Tab::load_current_preset()
if (new_printer_technology == ptFFF)
m_pages_fff.empty() ? build_fff() : m_pages.swap(m_pages_fff);
else
m_pages_sla.empty() ? build_sla() : m_pages.swap(m_pages_sla);
@ -2207,35 +2211,35 @@ void Tab::load_current_preset()
update_tab_ui();
// update show/hide tabs
if (m_name == "printer"){
if (m_name == "printer") {
PrinterTechnology& printer_technology = m_presets->get_edited_preset().printer_technology();
if (printer_technology != static_cast<TabPrinter*>(this)->m_printer_technology)
{
for (auto& tab : wxGetApp().mainframe->get_preset_tabs()){
for (auto& tab : wxGetApp().mainframe->get_preset_tabs()) {
if (tab.technology != printer_technology)
{
int page_id = wxGetApp().tab_panel()->FindPage(tab.panel);
wxGetApp().tab_panel()->GetPage(page_id)->Show(false);
wxGetApp().tab_panel()->RemovePage(page_id);
}
else
} else
wxGetApp().tab_panel()->InsertPage(wxGetApp().tab_panel()->FindPage(this), tab.panel, tab.panel->title());
}
static_cast<TabPrinter*>(this)->m_printer_technology = printer_technology;
}
}
on_presets_changed();
if (name() == "print")
update_frequently_changed_parameters();
if (m_name == "printer"){
static_cast<TabPrinter*>(this)->m_initial_extruders_count = static_cast<TabPrinter*>(this)->m_extruders_count;
const Preset* parent_preset = m_presets->get_selected_preset_parent();
static_cast<TabPrinter*>(this)->m_sys_extruders_count = parent_preset == nullptr ? 0 :
static_cast<const ConfigOptionFloats*>(parent_preset->config.option("nozzle_diameter"))->values.size();
on_presets_changed();
if (printer_technology == ptFFF) {
static_cast<TabPrinter*>(this)->m_initial_extruders_count = static_cast<TabPrinter*>(this)->m_extruders_count;
const Preset* parent_preset = m_presets->get_selected_preset_parent();
static_cast<TabPrinter*>(this)->m_sys_extruders_count = parent_preset == nullptr ? 0 :
static_cast<const ConfigOptionFloats*>(parent_preset->config.option("nozzle_diameter"))->values.size();
}
}
else {
on_presets_changed();
if (m_name == "print")
update_frequently_changed_parameters();
}
m_opt_status_value = (m_presets->get_selected_preset_parent() ? osSystemValue : 0) | osInitValue;
init_options_list();
update_changed_ui();
@ -2543,7 +2547,7 @@ void Tab::delete_preset()
// Delete the file and select some other reasonable preset.
// The 'external' presets will only be removed from the preset list, their files will not be deleted.
try{ m_presets->delete_current_preset(); }
catch (const std::exception &e)
catch (const std::exception & /* e */)
{
return;
}

View file

@ -213,6 +213,7 @@ public:
wxString title() const { return m_title; }
std::string name() const { return m_name; }
Preset::Type type() const { return m_type; }
virtual bool supports_printer_technology(const PrinterTechnology tech) = 0;
void create_preset_tab();
void load_current_preset();
@ -291,6 +292,7 @@ public:
void reload_config() override;
void update() override;
void OnActivate() override;
bool supports_printer_technology(const PrinterTechnology tech) override { return tech == ptFFF; }
};
//Slic3r::GUI::Tab::Filament;
@ -308,6 +310,7 @@ public:
void reload_config() override;
void update() override;
void OnActivate() override;
bool supports_printer_technology(const PrinterTechnology tech) override { return tech == ptFFF; }
};
//Slic3r::GUI::Tab::Printer;
@ -321,9 +324,9 @@ class TabPrinter : public Tab
std::vector<PageShp> m_pages_fff;
std::vector<PageShp> m_pages_sla;
public:
wxButton* m_serial_test_btn;
wxButton* m_print_host_test_btn;
wxButton* m_printhost_browse_btn;
wxButton* m_serial_test_btn = nullptr;
wxButton* m_print_host_test_btn = nullptr;
wxButton* m_printhost_browse_btn = nullptr;
size_t m_extruders_count;
size_t m_extruders_count_old = 0;
@ -349,6 +352,7 @@ public:
void build_extruder_pages();
void on_preset_loaded() override;
void init_options_list() override;
bool supports_printer_technology(const PrinterTechnology /* tech */) override { return true; }
};
class TabSLAMaterial : public Tab
@ -362,6 +366,7 @@ public:
void build() override;
void update() override;
void init_options_list() override;
bool supports_printer_technology(const PrinterTechnology tech) override { return tech == ptSLA; }
};
class SavePresetWindow :public wxDialog