Merge remote-tracking branch 'remotes/origin/ys_preset_externals_bf'
This commit is contained in:
commit
161a2bc6f8
@ -353,6 +353,10 @@ public:
|
|||||||
// Generate a file path from a profile name. Add the ".ini" suffix if it is missing.
|
// Generate a file path from a profile name. Add the ".ini" suffix if it is missing.
|
||||||
std::string path_from_name(const std::string &new_name) const;
|
std::string path_from_name(const std::string &new_name) const;
|
||||||
|
|
||||||
|
// update m_edited_preset.is_external value after loading preset for .ini, .gcode, .amf, .3mf
|
||||||
|
void update_edited_preset_is_external(bool is_external) {
|
||||||
|
m_edited_preset.is_external = is_external; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Select a preset, if it exists. If it does not exist, select an invalid (-1) index.
|
// Select a preset, if it exists. If it does not exist, select an invalid (-1) index.
|
||||||
// This is a temporary state, which shall be fixed immediately by the following step.
|
// This is a temporary state, which shall be fixed immediately by the following step.
|
||||||
|
@ -565,11 +565,12 @@ void PresetBundle::load_config_file_config(const std::string &name_or_path, bool
|
|||||||
size_t idx = (i_group == 0) ? 0 : num_extruders + 1;
|
size_t idx = (i_group == 0) ? 0 : num_extruders + 1;
|
||||||
inherits = inherits_values[idx];
|
inherits = inherits_values[idx];
|
||||||
compatible_printers_condition = compatible_printers_condition_values[idx];
|
compatible_printers_condition = compatible_printers_condition_values[idx];
|
||||||
if (is_external)
|
if (is_external) {
|
||||||
presets.load_external_preset(name_or_path, name,
|
presets.load_external_preset(name_or_path, name,
|
||||||
config.opt_string((i_group == 0) ? "print_settings_id" : "printer_settings_id", true),
|
config.opt_string((i_group == 0) ? "print_settings_id" : "printer_settings_id", true),
|
||||||
config);
|
config);
|
||||||
else
|
presets.update_edited_preset_is_external(true);
|
||||||
|
} else
|
||||||
presets.load_preset(presets.path_from_name(name), name, config).save();
|
presets.load_preset(presets.path_from_name(name), name, config).save();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -582,9 +583,10 @@ void PresetBundle::load_config_file_config(const std::string &name_or_path, bool
|
|||||||
// Split the "compatible_printers_condition" and "inherits" from the cummulative vectors to separate filament presets.
|
// Split the "compatible_printers_condition" and "inherits" from the cummulative vectors to separate filament presets.
|
||||||
inherits = inherits_values[1];
|
inherits = inherits_values[1];
|
||||||
compatible_printers_condition = compatible_printers_condition_values[1];
|
compatible_printers_condition = compatible_printers_condition_values[1];
|
||||||
if (is_external)
|
if (is_external) {
|
||||||
this->filaments.load_external_preset(name_or_path, name, old_filament_profile_names->values.front(), config);
|
this->filaments.load_external_preset(name_or_path, name, old_filament_profile_names->values.front(), config);
|
||||||
else
|
this->filaments.update_edited_preset_is_external(true);
|
||||||
|
} else
|
||||||
this->filaments.load_preset(this->filaments.path_from_name(name), name, config).save();
|
this->filaments.load_preset(this->filaments.path_from_name(name), name, config).save();
|
||||||
this->filament_presets.clear();
|
this->filament_presets.clear();
|
||||||
this->filament_presets.emplace_back(name);
|
this->filament_presets.emplace_back(name);
|
||||||
@ -613,11 +615,12 @@ void PresetBundle::load_config_file_config(const std::string &name_or_path, bool
|
|||||||
cfg.opt_string("inherits", true) = inherits_values[i + 1];
|
cfg.opt_string("inherits", true) = inherits_values[i + 1];
|
||||||
// Load all filament presets, but only select the first one in the preset dialog.
|
// Load all filament presets, but only select the first one in the preset dialog.
|
||||||
Preset *loaded = nullptr;
|
Preset *loaded = nullptr;
|
||||||
if (is_external)
|
if (is_external) {
|
||||||
loaded = &this->filaments.load_external_preset(name_or_path, name,
|
loaded = &this->filaments.load_external_preset(name_or_path, name,
|
||||||
(i < old_filament_profile_names->values.size()) ? old_filament_profile_names->values[i] : "",
|
(i < old_filament_profile_names->values.size()) ? old_filament_profile_names->values[i] : "",
|
||||||
std::move(cfg), i == 0);
|
std::move(cfg), i == 0);
|
||||||
else {
|
this->filaments.update_edited_preset_is_external(true);
|
||||||
|
} else {
|
||||||
// Used by the config wizard when creating a custom setup.
|
// Used by the config wizard when creating a custom setup.
|
||||||
// Therefore this block should only be called for a single extruder.
|
// Therefore this block should only be called for a single extruder.
|
||||||
char suffix[64];
|
char suffix[64];
|
||||||
|
Loading…
Reference in New Issue
Block a user