ENH: config: remove unused custome_defined logic
also improve project_embedded 1. remove unused is_custom_defined 2. improve project_embedded to support multi-extruder diff jira: no-jira Change-Id: I1db28c3cfd59ccc31c6855af30305396c71c4e9a
This commit is contained in:
parent
ad03fae1eb
commit
0434853bf3
|
@ -805,7 +805,7 @@ int ConfigBase::load_from_json(const std::string &file, ConfigSubstitutionContex
|
|||
key_values.emplace(BBL_JSON_KEY_VERSION, it.value());
|
||||
}
|
||||
else if (boost::iequals(it.key(), BBL_JSON_KEY_IS_CUSTOM)) {
|
||||
key_values.emplace(BBL_JSON_KEY_IS_CUSTOM, it.value());
|
||||
//skip it
|
||||
}
|
||||
else if (boost::iequals(it.key(), BBL_JSON_KEY_NAME)) {
|
||||
key_values.emplace(BBL_JSON_KEY_NAME, it.value());
|
||||
|
@ -1366,15 +1366,13 @@ ConfigSubstitutions ConfigBase::load_from_gcode_file(const std::string &file, Fo
|
|||
}
|
||||
|
||||
//BBS: add json support
|
||||
void ConfigBase::save_to_json(const std::string &file, const std::string &name, const std::string &from, const std::string &version, const std::string is_custom) const
|
||||
void ConfigBase::save_to_json(const std::string &file, const std::string &name, const std::string &from, const std::string &version) const
|
||||
{
|
||||
json j;
|
||||
//record the headers
|
||||
j[BBL_JSON_KEY_VERSION] = version;
|
||||
j[BBL_JSON_KEY_NAME] = name;
|
||||
j[BBL_JSON_KEY_FROM] = from;
|
||||
if (!is_custom.empty())
|
||||
j[BBL_JSON_KEY_IS_CUSTOM] = is_custom;
|
||||
|
||||
//record all the key-values
|
||||
for (const std::string &opt_key : this->keys())
|
||||
|
|
|
@ -2326,7 +2326,7 @@ public:
|
|||
void save(const std::string &file) const;
|
||||
|
||||
//BBS: add json support
|
||||
void save_to_json(const std::string &file, const std::string &name, const std::string &from, const std::string &version, const std::string is_custom = "") const;
|
||||
void save_to_json(const std::string &file, const std::string &name, const std::string &from, const std::string &version) const;
|
||||
|
||||
// Set all the nullable values to nils.
|
||||
void null_nullables();
|
||||
|
|
|
@ -556,13 +556,13 @@ bool Preset::save(DynamicPrintConfig* parent_config)
|
|||
opt_dst->set(opt_src);
|
||||
}
|
||||
}
|
||||
temp_config.save_to_json(this->file, this->name, from_str, this->version.to_string(), this->custom_defined);
|
||||
temp_config.save_to_json(this->file, this->name, from_str, this->version.to_string());
|
||||
} else if (!filament_id.empty() && inherits().empty()) {
|
||||
DynamicPrintConfig temp_config = config;
|
||||
temp_config.set_key_value(BBL_JSON_KEY_FILAMENT_ID, new ConfigOptionString(filament_id));
|
||||
temp_config.save_to_json(this->file, this->name, from_str, this->version.to_string(), this->custom_defined);
|
||||
temp_config.save_to_json(this->file, this->name, from_str, this->version.to_string());
|
||||
} else {
|
||||
this->config.save_to_json(this->file, this->name, from_str, this->version.to_string(), this->custom_defined);
|
||||
this->config.save_to_json(this->file, this->name, from_str, this->version.to_string());
|
||||
}
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " save config for: " << this->name << " and filament_id: " << filament_id << " and base_id: " << this->base_id;
|
||||
|
||||
|
@ -780,13 +780,6 @@ bool Preset::has_lidar(PresetBundle *preset_bundle)
|
|||
return has_lidar;
|
||||
}
|
||||
|
||||
bool Preset::is_custom_defined()
|
||||
{
|
||||
if (custom_defined == "1")
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
// The method previously only supports to be called on preset_bundle->printers.get_edited_preset()
|
||||
// I extened to support call on all presets
|
||||
bool Preset::is_bbl_vendor_preset(PresetBundle *preset_bundle)
|
||||
|
@ -1227,8 +1220,6 @@ void PresetCollection::load_presets(
|
|||
|
||||
if (key_values.find(BBL_JSON_KEY_FILAMENT_ID) != key_values.end())
|
||||
preset.filament_id = key_values[BBL_JSON_KEY_FILAMENT_ID];
|
||||
if (key_values.find(BBL_JSON_KEY_IS_CUSTOM) != key_values.end())
|
||||
preset.custom_defined = key_values[BBL_JSON_KEY_IS_CUSTOM];
|
||||
if (key_values.find(BBL_JSON_KEY_DESCRIPTION) != key_values.end())
|
||||
preset.description = key_values[BBL_JSON_KEY_DESCRIPTION];
|
||||
if (key_values.find("instantiation") != key_values.end())
|
||||
|
@ -1253,12 +1244,12 @@ void PresetCollection::load_presets(
|
|||
preset.config.update_diff_values_to_child_config(config, extruder_id_name, extruder_variant_name, *key_set1, *key_set2);
|
||||
}
|
||||
else {
|
||||
// We support custom root preset now
|
||||
auto inherits_config2 = dynamic_cast<ConfigOptionString *>(inherits_config);
|
||||
if ((inherits_config2 && !inherits_config2->value.empty()) && !preset.is_custom_defined()) {
|
||||
BOOST_LOG_TRIVIAL(error) << boost::format("can not find parent for config %1%!")%preset.file;
|
||||
if ((inherits_config2 && !inherits_config2->value.empty())) {
|
||||
BOOST_LOG_TRIVIAL(error) << boost::format("can not find parent %1% for config %2%!")%inherits_config2->value %preset.file;
|
||||
continue;
|
||||
}
|
||||
// We support custom root preset now
|
||||
// Find a default preset for the config. The PrintPresetCollection provides different default preset based on the "printer_technology" field.
|
||||
preset.config = default_preset.config;
|
||||
preset.config.apply(std::move(config));
|
||||
|
@ -1323,9 +1314,7 @@ Preset* PresetCollection::get_preset_differed_for_save(Preset& preset)
|
|||
if (preset.is_system || preset.is_default)
|
||||
return nullptr;
|
||||
|
||||
Preset* new_preset = new Preset();
|
||||
*new_preset = preset;
|
||||
|
||||
Preset* new_preset = nullptr;
|
||||
//BBS: only save difference for user preset
|
||||
std::string& inherits = preset.inherits();
|
||||
Preset* parent_preset = nullptr;
|
||||
|
@ -1333,15 +1322,46 @@ Preset* PresetCollection::get_preset_differed_for_save(Preset& preset)
|
|||
parent_preset = this->find_preset(inherits, false, true);
|
||||
}
|
||||
if (parent_preset) {
|
||||
new_preset = new Preset();
|
||||
*new_preset = preset;
|
||||
|
||||
DynamicPrintConfig temp_config;
|
||||
std::vector<std::string> dirty_options = preset.config.diff(parent_preset->config);
|
||||
|
||||
std::string extruder_id_name, extruder_variant_name;
|
||||
std::set<std::string> *key_set1 = nullptr, *key_set2 = nullptr;
|
||||
Preset::get_extruder_names_and_keysets(m_type, extruder_id_name, extruder_variant_name, &key_set1, &key_set2);
|
||||
|
||||
if (!extruder_id_name.empty()) {
|
||||
dirty_options.emplace_back(extruder_id_name);
|
||||
}
|
||||
if (!extruder_variant_name.empty()) {
|
||||
dirty_options.emplace_back(extruder_variant_name);
|
||||
}
|
||||
|
||||
for (auto option: dirty_options)
|
||||
{
|
||||
ConfigOption *opt_src = preset.config.option(option);
|
||||
ConfigOption *opt_dst = temp_config.option(option, true);
|
||||
opt_dst->set(opt_src);
|
||||
if (opt_dst->is_scalar() || !(opt_dst->nullable()))
|
||||
opt_dst->set(opt_src);
|
||||
else {
|
||||
ConfigOptionVectorBase* opt_vec_src = static_cast<ConfigOptionVectorBase*>(opt_src);
|
||||
ConfigOptionVectorBase* opt_vec_dst = static_cast<ConfigOptionVectorBase*>(opt_dst);
|
||||
ConfigOptionVectorBase* opt_vec_inherit = static_cast<ConfigOptionVectorBase*>(parent_preset->config.option(option));
|
||||
if (opt_vec_src->size() == 1)
|
||||
opt_dst->set(opt_src);
|
||||
else if (key_set1->find(option) != key_set1->end()) {
|
||||
opt_vec_dst->set_with_nil(opt_vec_src, opt_vec_inherit, 1);
|
||||
}
|
||||
else if (key_set2->find(option) != key_set2->end()) {
|
||||
opt_vec_dst->set_with_nil(opt_vec_src, opt_vec_inherit, 2);
|
||||
}
|
||||
else
|
||||
opt_dst->set(opt_src);
|
||||
}
|
||||
}
|
||||
|
||||
new_preset->config = temp_config;
|
||||
}
|
||||
|
||||
|
@ -1415,6 +1435,10 @@ void PresetCollection::load_project_embedded_presets(std::vector<Preset*>& proje
|
|||
std::vector<Preset*>::iterator it;
|
||||
|
||||
BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << boost::format(" enter, type %1% , total preset counts %2%")%Preset::get_type_string(m_type) %project_presets.size();
|
||||
std::string extruder_id_name, extruder_variant_name;
|
||||
std::set<std::string> *key_set1 = nullptr, *key_set2 = nullptr;
|
||||
Preset::get_extruder_names_and_keysets(m_type, extruder_id_name, extruder_variant_name, &key_set1, &key_set2);
|
||||
|
||||
lock();
|
||||
for (it = project_presets.begin(); it != project_presets.end(); it++) {
|
||||
Preset* preset = *it;
|
||||
|
@ -1452,11 +1476,13 @@ void PresetCollection::load_project_embedded_presets(std::vector<Preset*>& proje
|
|||
}
|
||||
else {
|
||||
// Find a default preset for the config. The PrintPresetCollection provides different default preset based on the "printer_technology" field.
|
||||
preset->config = default_preset.config;
|
||||
BOOST_LOG_TRIVIAL(warning) << boost::format("can not find parent for config %1%!")%preset->file;
|
||||
//continue;
|
||||
//BBS 202407: don't load project embedded preset when can not find inherit
|
||||
//preset->config = default_preset.config;
|
||||
BOOST_LOG_TRIVIAL(error) << boost::format("can not find parent for config %1%!")%preset->file;
|
||||
continue;
|
||||
}
|
||||
preset->config.apply(std::move(config));
|
||||
preset->config.update_diff_values_to_child_config(config, extruder_id_name, extruder_variant_name, *key_set1, *key_set2);
|
||||
//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(preset->config, default_preset.config);
|
||||
|
@ -1495,7 +1521,8 @@ std::vector<Preset*> PresetCollection::get_project_embedded_presets()
|
|||
|
||||
Preset* new_preset = get_preset_differed_for_save(preset);
|
||||
|
||||
project_presets.push_back(new_preset);
|
||||
if (new_preset)
|
||||
project_presets.push_back(new_preset);
|
||||
}
|
||||
unlock();
|
||||
BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << boost::format(" enter, type %1% , total preset counts %2%")%Preset::get_type_string(m_type) %project_presets.size();
|
||||
|
@ -1628,32 +1655,28 @@ void PresetCollection::save_user_presets(const std::string& dir_path, const std:
|
|||
preset->sync_info.clear();
|
||||
preset->file = path_for_preset(*preset);
|
||||
|
||||
if (preset->is_custom_defined()) {
|
||||
//BBS: only save difference for user preset
|
||||
std::string inherits = Preset::inherits(preset->config);
|
||||
if (inherits.empty()) {
|
||||
// We support custom root preset now
|
||||
//BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(" can not find inherits for %1% , should not happen")%preset->name;
|
||||
//// BBS add sync info
|
||||
//preset->sync_info = "delete";
|
||||
//need_to_delete_list.push_back(preset->setting_id);
|
||||
//delete_name_list.push_back(preset->name);
|
||||
preset->save(nullptr);
|
||||
} else {
|
||||
//BBS: only save difference for user preset
|
||||
std::string inherits = Preset::inherits(preset->config);
|
||||
if (inherits.empty()) {
|
||||
// We support custom root preset now
|
||||
//BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(" can not find inherits for %1% , should not happen")%preset->name;
|
||||
//// BBS add sync info
|
||||
//preset->sync_info = "delete";
|
||||
//need_to_delete_list.push_back(preset->setting_id);
|
||||
//delete_name_list.push_back(preset->name);
|
||||
preset->save(nullptr);
|
||||
continue;
|
||||
}
|
||||
Preset* parent_preset = this->find_preset(inherits, false, true);
|
||||
if (!parent_preset) {
|
||||
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(" can not find parent preset for %1% , inherits %2%")%preset->name %inherits;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (preset->base_id.empty())
|
||||
preset->base_id = parent_preset->setting_id;
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " " << preset->name << " filament_id: " << preset->filament_id << " base_id: " << preset->base_id;
|
||||
preset->save(&(parent_preset->config));
|
||||
continue;
|
||||
}
|
||||
Preset* parent_preset = this->find_preset(inherits, false, true);
|
||||
if (!parent_preset) {
|
||||
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(" can not find parent preset for %1% , inherits %2%")%preset->name %inherits;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (preset->base_id.empty())
|
||||
preset->base_id = parent_preset->setting_id;
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " " << preset->name << " filament_id: " << preset->filament_id << " base_id: " << preset->base_id;
|
||||
preset->save(&(parent_preset->config));
|
||||
}
|
||||
|
||||
for (auto delete_name: delete_name_list)
|
||||
|
@ -1911,11 +1934,11 @@ bool PresetCollection::validate_preset(const std::string &preset_name, std::stri
|
|||
|
||||
// Load a preset from an already parsed config file, insert it into the sorted sequence of presets
|
||||
// and select it, losing previous modifications.
|
||||
Preset& PresetCollection::load_preset(const std::string &path, const std::string &name, const DynamicPrintConfig &config, bool select, Semver file_version, bool is_custom_defined)
|
||||
Preset& PresetCollection::load_preset(const std::string &path, const std::string &name, const DynamicPrintConfig &config, bool select, Semver file_version)
|
||||
{
|
||||
DynamicPrintConfig cfg(this->default_preset().config);
|
||||
cfg.apply_only(config, cfg.keys(), true);
|
||||
return this->load_preset(path, name, std::move(cfg), select, file_version, is_custom_defined);
|
||||
return this->load_preset(path, name, std::move(cfg), select, file_version);
|
||||
}
|
||||
|
||||
static bool profile_print_params_same(const DynamicPrintConfig &cfg_old, const DynamicPrintConfig &cfg_new)
|
||||
|
@ -2179,7 +2202,7 @@ std::pair<Preset*, bool> PresetCollection::load_external_preset(
|
|||
return std::make_pair(&preset, false);
|
||||
}
|
||||
|
||||
Preset& PresetCollection::load_preset(const std::string &path, const std::string &name, DynamicPrintConfig &&config, bool select, Semver file_version, bool is_custom_defined)
|
||||
Preset& PresetCollection::load_preset(const std::string &path, const std::string &name, DynamicPrintConfig &&config, bool select, Semver file_version)
|
||||
{
|
||||
lock();
|
||||
auto it = this->find_preset_internal(name);
|
||||
|
@ -2194,7 +2217,7 @@ Preset& PresetCollection::load_preset(const std::string &path, const std::string
|
|||
preset.config = std::move(config);
|
||||
preset.loaded = true;
|
||||
preset.is_dirty = false;
|
||||
preset.custom_defined = is_custom_defined ? "1": "0";
|
||||
|
||||
//BBS
|
||||
if (file_version.valid())
|
||||
preset.version = file_version;
|
||||
|
|
|
@ -242,7 +242,6 @@ public:
|
|||
std::string user_id; // preset user_id
|
||||
std::string base_id; // base id of preset
|
||||
std::string sync_info; // enum: "delete", "create", "update", ""
|
||||
std::string custom_defined; // enum: "1", "0", ""
|
||||
std::string description; //
|
||||
long long updated_time{0}; //last updated time
|
||||
std::map<std::string, std::string> key_values;
|
||||
|
@ -461,8 +460,8 @@ public:
|
|||
|
||||
// Load a preset from an already parsed config file, insert it into the sorted sequence of presets
|
||||
// and select it, losing previous modifications.
|
||||
Preset& load_preset(const std::string &path, const std::string &name, const DynamicPrintConfig &config, bool select = true, Semver file_version = Semver(), bool is_custom_defined = false);
|
||||
Preset& load_preset(const std::string &path, const std::string &name, DynamicPrintConfig &&config, bool select = true, Semver file_version = Semver(), bool is_custom_defined = false);
|
||||
Preset& load_preset(const std::string &path, const std::string &name, const DynamicPrintConfig &config, bool select = true, Semver file_version = Semver());
|
||||
Preset& load_preset(const std::string &path, const std::string &name, DynamicPrintConfig &&config, bool select = true, Semver file_version = Semver());
|
||||
|
||||
bool clone_presets(std::vector<Preset const *> const &presets, std::vector<std::string> &failures, std::function<void(Preset &, Preset::Type &)> modifier, bool force_rewritten = false);
|
||||
bool clone_presets_for_printer(
|
||||
|
|
|
@ -2412,7 +2412,7 @@ ConfigSubstitutions PresetBundle::load_config_file(const std::string &path, Forw
|
|||
|
||||
// Load a config file from a boost property_tree. This is a private method called from load_config_file.
|
||||
// is_external == false on if called from ConfigWizard
|
||||
void PresetBundle::load_config_file_config(const std::string &name_or_path, bool is_external, DynamicPrintConfig &&config, Semver file_version, bool selected, bool is_custom_defined)
|
||||
void PresetBundle::load_config_file_config(const std::string &name_or_path, bool is_external, DynamicPrintConfig &&config, Semver file_version, bool selected)
|
||||
{
|
||||
PrinterTechnology printer_technology = Preset::printer_technology(config);
|
||||
|
||||
|
@ -2517,7 +2517,7 @@ void PresetBundle::load_config_file_config(const std::string &name_or_path, bool
|
|||
[&config, &inherits, &inherits_values,
|
||||
&compatible_printers_condition, &compatible_printers_condition_values,
|
||||
&compatible_prints_condition, &compatible_prints_condition_values,
|
||||
is_external, &name, &name_or_path, file_version, selected, is_custom_defined]
|
||||
is_external, &name, &name_or_path, file_version, selected]
|
||||
(PresetCollection &presets, size_t idx, const std::string &key, const std::set<std::string> &different_keys, std::string filament_id) {
|
||||
// Split the "compatible_printers_condition" and "inherits" values one by one from a single vector to the print & printer profiles.
|
||||
inherits = inherits_values[idx];
|
||||
|
@ -2529,7 +2529,7 @@ void PresetBundle::load_config_file_config(const std::string &name_or_path, bool
|
|||
if (is_external)
|
||||
presets.load_external_preset(name_or_path, name, config.opt_string(key, true), config, different_keys, PresetCollection::LoadAndSelect::Always, file_version, filament_id);
|
||||
else
|
||||
presets.load_preset(presets.path_from_name(name, inherits.empty()), name, config, selected, file_version, is_custom_defined).save(nullptr);
|
||||
presets.load_preset(presets.path_from_name(name, inherits.empty()), name, config, selected, file_version).save(nullptr);
|
||||
};
|
||||
|
||||
switch (Preset::printer_technology(config)) {
|
||||
|
@ -2598,7 +2598,7 @@ void PresetBundle::load_config_file_config(const std::string &name_or_path, bool
|
|||
loaded = this->filaments.load_external_preset(name_or_path, name, old_filament_profile_names->values.front(), config, filament_different_keys_set, PresetCollection::LoadAndSelect::Always, file_version, filament_id).first;
|
||||
else {
|
||||
// called from Config Wizard.
|
||||
loaded= &this->filaments.load_preset(this->filaments.path_from_name(name, inherits.empty()), name, config, true, file_version, is_custom_defined);
|
||||
loaded= &this->filaments.load_preset(this->filaments.path_from_name(name, inherits.empty()), name, config, true, file_version);
|
||||
loaded->save(nullptr);
|
||||
}
|
||||
this->filament_presets.clear();
|
||||
|
|
|
@ -162,8 +162,8 @@ public:
|
|||
|
||||
// Load user configuration and store it into the user profiles.
|
||||
// This method is called by the configuration wizard.
|
||||
void load_config_from_wizard(const std::string &name, DynamicPrintConfig config, Semver file_version, bool is_custom_defined = false)
|
||||
{ this->load_config_file_config(name, false, std::move(config), file_version, true, is_custom_defined); }
|
||||
void load_config_from_wizard(const std::string &name, DynamicPrintConfig config, Semver file_version)
|
||||
{ this->load_config_file_config(name, false, std::move(config), file_version, true); }
|
||||
|
||||
// Load configuration that comes from a model file containing configuration, such as 3MF et al.
|
||||
// This method is called by the Plater.
|
||||
|
@ -267,7 +267,7 @@ private:
|
|||
// Load print, filament & printer presets from a config. If it is an external config, then the name is extracted from the external path.
|
||||
// and the external config is just referenced, not stored into user profile directory.
|
||||
// If it is not an external config, then the config will be stored into the user profile directory.
|
||||
void load_config_file_config(const std::string &name_or_path, bool is_external, DynamicPrintConfig &&config, Semver file_version = Semver(), bool selected = false, bool is_custom_defined = false);
|
||||
void load_config_file_config(const std::string &name_or_path, bool is_external, DynamicPrintConfig &&config, Semver file_version = Semver(), bool selected = false);
|
||||
/*ConfigSubstitutions load_config_file_config_bundle(
|
||||
const std::string &path, const boost::property_tree::ptree &tree, ForwardCompatibilitySubstitutionRule compatibility_rule);*/
|
||||
|
||||
|
|
|
@ -5994,7 +5994,11 @@ void DynamicPrintConfig::update_diff_values_to_child_config(DynamicPrintConfig&
|
|||
int cur_variant_count = cur_extruder_variants.size();
|
||||
int target_variant_count = target_extruder_variants.size();
|
||||
|
||||
variant_index.resize(cur_variant_count, -1);
|
||||
if (cur_variant_count > 0)
|
||||
variant_index.resize(cur_variant_count, -1);
|
||||
else
|
||||
variant_index.resize(1, 0);
|
||||
|
||||
if (target_variant_count == 0) {
|
||||
variant_index[0] = 0;
|
||||
}
|
||||
|
@ -6050,16 +6054,6 @@ void DynamicPrintConfig::update_diff_values_to_child_config(DynamicPrintConfig&
|
|||
return;
|
||||
}
|
||||
|
||||
bool DynamicPrintConfig::is_custom_defined()
|
||||
{
|
||||
auto* is_custom_defined = dynamic_cast<const ConfigOptionStrings*>(this->option("is_custom_defined"));
|
||||
if (!is_custom_defined || is_custom_defined->empty())
|
||||
return false;
|
||||
if (is_custom_defined->get_at(0) == "1")
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
//BBS: pass map to recording all invalid valies
|
||||
//FIXME localize this function.
|
||||
std::map<std::string, std::string> validate(const FullPrintConfig &cfg, bool under_cli)
|
||||
|
|
|
@ -505,7 +505,6 @@ public:
|
|||
std::set<std::string>& key_set1, std::set<std::string>& key_set2);
|
||||
void update_diff_values_to_child_config(DynamicPrintConfig& new_config, std::string extruder_id_name, std::string extruder_variant_name, std::set<std::string>& key_set1, std::set<std::string>& key_set2);
|
||||
|
||||
bool is_custom_defined();
|
||||
};
|
||||
extern std::set<std::string> printer_extruder_options;
|
||||
extern std::set<std::string> print_options_with_variant;
|
||||
|
|
|
@ -2599,7 +2599,7 @@ bool ConfigWizard::priv::apply_config(AppConfig *app_config, PresetBundle *prese
|
|||
custom_config->set_key_value("filament_colour", wxGetApp().preset_bundle->project_config.option("filament_colour"));
|
||||
const std::string profile_name = page_custom->profile_name();
|
||||
Semver semver(SLIC3R_VERSION);
|
||||
preset_bundle->load_config_from_wizard(profile_name, *custom_config, semver, true);
|
||||
preset_bundle->load_config_from_wizard(profile_name, *custom_config, semver);
|
||||
|
||||
wxGetApp().plater()->sidebar().update_presets(Slic3r::Preset::Type::TYPE_PRINTER);
|
||||
wxGetApp().plater()->sidebar().update_presets(Slic3r::Preset::Type::TYPE_FILAMENT);
|
||||
|
|
|
@ -5156,7 +5156,6 @@ void GUI_App::sync_preset(Preset* preset)
|
|||
long long update_time = 0;
|
||||
// only sync user's preset
|
||||
if (!preset->is_user()) return;
|
||||
if (preset->is_custom_defined()) return;
|
||||
|
||||
auto setting_id = preset->setting_id;
|
||||
std::map<std::string, std::string> values_map;
|
||||
|
|
|
@ -1476,8 +1476,7 @@ bool MainFrame::can_export_all_gcode() const
|
|||
bool MainFrame::can_print_3mf() const
|
||||
{
|
||||
if (m_plater && !m_plater->model().objects.empty()) {
|
||||
if (wxGetApp().preset_bundle->printers.get_edited_preset().is_custom_defined())
|
||||
return false;
|
||||
//
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue