mirror of
https://git.mirrors.martin98.com/https://github.com/bambulab/BambuStudio.git
synced 2025-09-20 12:13:13 +08:00
ENH: profile description support inherits
jira:NONE Signed-off-by: xun.zhang <xun.zhang@bambulab.com> Change-Id: I8c49101cbc38b5d9364f28c6a0b82acdb47a2a80
This commit is contained in:
parent
c0877b507a
commit
8be37b1a73
@ -3339,7 +3339,8 @@ std::pair<PresetsConfigSubstitutions, size_t> PresetBundle::load_vendor_configs_
|
||||
std::map<std::string, DynamicPrintConfig>& config_maps,
|
||||
std::map<std::string, std::string>& filament_id_maps,
|
||||
PresetCollection* presets_collection,
|
||||
size_t& count) -> std::string {
|
||||
size_t& count,
|
||||
std::map<std::string, std::string>&description_maps) -> std::string {
|
||||
|
||||
std::string subfile = path + "/" + vendor_name + "/" + subfile_iter.second;
|
||||
// Load the print, filament or printer preset.
|
||||
@ -3361,7 +3362,6 @@ std::pair<PresetsConfigSubstitutions, size_t> PresetBundle::load_vendor_configs_
|
||||
return reason;
|
||||
}
|
||||
preset_name = key_values[BBL_JSON_KEY_NAME];
|
||||
description = key_values[BBL_JSON_KEY_DESCRIPTION];
|
||||
instantiation = key_values[BBL_JSON_KEY_INSTANTIATION];
|
||||
auto setting_it = key_values.find(BBL_JSON_KEY_SETTING_ID);
|
||||
if (setting_it != key_values.end())
|
||||
@ -3389,6 +3389,8 @@ std::pair<PresetsConfigSubstitutions, size_t> PresetBundle::load_vendor_configs_
|
||||
reason = "Can not find inherits: " + inherits;
|
||||
return reason;
|
||||
}
|
||||
if (auto ds_iter = description_maps.find(inherits); ds_iter != description_maps.end())
|
||||
description = ds_iter->second;
|
||||
}
|
||||
else {
|
||||
if (presets_collection->type() == Preset::TYPE_PRINTER)
|
||||
@ -3397,6 +3399,13 @@ std::pair<PresetsConfigSubstitutions, size_t> PresetBundle::load_vendor_configs_
|
||||
default_config = &presets_collection->default_preset().config;
|
||||
}
|
||||
config = *default_config;
|
||||
|
||||
if ( auto ds_iter=key_values.find(BBL_JSON_KEY_DESCRIPTION); ds_iter != key_values.end())
|
||||
description = ds_iter->second;
|
||||
|
||||
if (!description.empty())
|
||||
description_maps.emplace(preset_name, description);
|
||||
|
||||
config.apply(config_src);
|
||||
if (instantiation == "false" && "Template" != vendor_name) {
|
||||
config_maps.emplace(preset_name, std::move(config));
|
||||
@ -3521,13 +3530,14 @@ std::pair<PresetsConfigSubstitutions, size_t> PresetBundle::load_vendor_configs_
|
||||
|
||||
std::map<std::string, DynamicPrintConfig> configs;
|
||||
std::map<std::string, std::string> filament_id_maps;
|
||||
std::map<std::string, std::string> description_maps;
|
||||
//3.1) paste the process
|
||||
presets = &this->prints;
|
||||
configs.clear();
|
||||
filament_id_maps.clear();
|
||||
for (auto& subfile : process_subfiles)
|
||||
{
|
||||
std::string reason = parse_subfile(substitution_context, substitutions, flags, subfile, configs, filament_id_maps, presets, presets_loaded);
|
||||
std::string reason = parse_subfile(substitution_context, substitutions, flags, subfile, configs, filament_id_maps, presets, presets_loaded, description_maps);
|
||||
if (!reason.empty()) {
|
||||
//parse error
|
||||
std::string subfile_path = path + "/" + vendor_name + "/" + subfile.second;
|
||||
@ -3542,7 +3552,7 @@ std::pair<PresetsConfigSubstitutions, size_t> PresetBundle::load_vendor_configs_
|
||||
filament_id_maps.clear();
|
||||
for (auto& subfile : filament_subfiles)
|
||||
{
|
||||
std::string reason = parse_subfile(substitution_context, substitutions, flags, subfile, configs, filament_id_maps, presets, presets_loaded);
|
||||
std::string reason = parse_subfile(substitution_context, substitutions, flags, subfile, configs, filament_id_maps, presets, presets_loaded, description_maps);
|
||||
if (!reason.empty()) {
|
||||
//parse error
|
||||
std::string subfile_path = path + "/" + vendor_name + "/" + subfile.second;
|
||||
@ -3557,7 +3567,7 @@ std::pair<PresetsConfigSubstitutions, size_t> PresetBundle::load_vendor_configs_
|
||||
filament_id_maps.clear();
|
||||
for (auto& subfile : machine_subfiles)
|
||||
{
|
||||
std::string reason = parse_subfile(substitution_context, substitutions, flags, subfile, configs, filament_id_maps, presets, presets_loaded);
|
||||
std::string reason = parse_subfile(substitution_context, substitutions, flags, subfile, configs, filament_id_maps, presets, presets_loaded, description_maps);
|
||||
if (!reason.empty()) {
|
||||
//parse error
|
||||
std::string subfile_path = path + "/" + vendor_name + "/" + subfile.second;
|
||||
|
Loading…
x
Reference in New Issue
Block a user