mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-10-10 01:01:57 +00:00
Keep Each Filament's Device Drying Values When the CLI Merges Filaments (#16157)
The device drying options hold several values per filament, as many as the filament preset gives, and a project stores them as the filaments' values one after another. The CLI filament merge wrote them like an option with one value per filament, putting each preset's first value at the filament's own index, so a project with three filaments whose preset gives "1", "0" was exported with 1;1;1;0;1;0 where the GUI writes 1;0;1;0;1;0. The merge now leaves these options out of the per-filament pass and rebuilds them afterwards from every filament's values in slot order. Without a fixed number of values per filament one slot cannot be replaced in place, so the stored values are kept when any slot has no config to rebuild from.
This commit is contained in:
@@ -10822,6 +10822,22 @@ void normalize_filament_values_to_variants(DynamicPrintConfig &config)
|
||||
}
|
||||
}
|
||||
|
||||
void set_filament_dev_options(DynamicPrintConfig &config, const std::vector<const DynamicPrintConfig *> &filament_configs)
|
||||
{
|
||||
for (const std::string &key : filament_dev_options) {
|
||||
if (std::none_of(filament_configs.begin(), filament_configs.end(), [&key](const DynamicPrintConfig *filament) { return filament->has(key); }))
|
||||
continue;
|
||||
const ConfigOption *default_value = print_config_def.get(key)->default_value.get();
|
||||
auto *dst = static_cast<ConfigOptionVectorBase *>(config.option(key, true));
|
||||
dst->clear();
|
||||
for (const DynamicPrintConfig *filament : filament_configs) {
|
||||
const auto *src = static_cast<const ConfigOptionVectorBase *>(filament->has(key) ? filament->option(key) : default_value);
|
||||
if (!src->empty())
|
||||
dst->append(src);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//used for object/region config
|
||||
//use the smallest of multiple to single
|
||||
|
||||
Reference in New Issue
Block a user