mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-13 19:25:59 +08:00
Added handle_legacy_composite() callback to configuration layer
to support conversion of multiple configuration keys into one or multiple other configuration keys.
This commit is contained in:
parent
a9ed8455f3
commit
ae8684a4a4
@ -797,6 +797,9 @@ ConfigSubstitutions ConfigBase::load(const boost::property_tree::ptree &tree, Fo
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
// Do legacy conversion on a completely loaded dictionary.
|
||||
// Perform composite conversions, for example merging multiple keys into one key.
|
||||
this->handle_legacy_composite();
|
||||
return std::move(substitutions_ctxt.substitutions);
|
||||
}
|
||||
|
||||
|
@ -2160,6 +2160,10 @@ protected:
|
||||
// If the opt_key is no more valid in this version of Slic3r, opt_key is cleared by handle_legacy().
|
||||
// handle_legacy() is called internally by set_deserialize().
|
||||
virtual void handle_legacy(t_config_option_key &/*opt_key*/, std::string &/*value*/) const {}
|
||||
// Called after a config is loaded as a whole.
|
||||
// Perform composite conversions, for example merging multiple keys into one key.
|
||||
// For conversion of single options, the handle_legacy() method above is called.
|
||||
virtual void handle_legacy_composite() {}
|
||||
|
||||
public:
|
||||
using ConfigOptionResolver::option;
|
||||
|
@ -4323,6 +4323,13 @@ void PrintConfigDef::handle_legacy(t_config_option_key &opt_key, std::string &va
|
||||
}
|
||||
}
|
||||
|
||||
// Called after a config is loaded as a whole.
|
||||
// Perform composite conversions, for example merging multiple keys into one key.
|
||||
// Don't convert single options here, implement such conversion in PrintConfigDef::handle_legacy() instead.
|
||||
void PrintConfigDef::handle_legacy_composite(DynamicPrintConfig &config)
|
||||
{
|
||||
}
|
||||
|
||||
const PrintConfigDef print_config_def;
|
||||
|
||||
DynamicPrintConfig DynamicPrintConfig::full_print_config()
|
||||
|
@ -166,6 +166,8 @@ CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(PerimeterGeneratorType)
|
||||
|
||||
#undef CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS
|
||||
|
||||
class DynamicPrintConfig;
|
||||
|
||||
// Defines each and every confiuration option of Slic3r, including the properties of the GUI dialogs.
|
||||
// Does not store the actual values, but defines default values.
|
||||
class PrintConfigDef : public ConfigDef
|
||||
@ -174,6 +176,7 @@ public:
|
||||
PrintConfigDef();
|
||||
|
||||
static void handle_legacy(t_config_option_key &opt_key, std::string &value);
|
||||
static void handle_legacy_composite(DynamicPrintConfig &config);
|
||||
|
||||
// Array options growing with the number of extruders
|
||||
const std::vector<std::string>& extruder_option_keys() const { return m_extruder_option_keys; }
|
||||
@ -258,6 +261,12 @@ public:
|
||||
// handle_legacy() is called internally by set_deserialize().
|
||||
void handle_legacy(t_config_option_key &opt_key, std::string &value) const override
|
||||
{ PrintConfigDef::handle_legacy(opt_key, value); }
|
||||
|
||||
// Called after a config is loaded as a whole.
|
||||
// Perform composite conversions, for example merging multiple keys into one key.
|
||||
// For conversion of single options, the handle_legacy() method above is called.
|
||||
void handle_legacy_composite() override
|
||||
{ PrintConfigDef::handle_legacy_composite(*this); }
|
||||
};
|
||||
|
||||
void handle_legacy_sla(DynamicPrintConfig &config);
|
||||
|
Loading…
x
Reference in New Issue
Block a user