mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-14 14:35:54 +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
|
// 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);
|
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().
|
// 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().
|
// handle_legacy() is called internally by set_deserialize().
|
||||||
virtual void handle_legacy(t_config_option_key &/*opt_key*/, std::string &/*value*/) const {}
|
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:
|
public:
|
||||||
using ConfigOptionResolver::option;
|
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;
|
const PrintConfigDef print_config_def;
|
||||||
|
|
||||||
DynamicPrintConfig DynamicPrintConfig::full_print_config()
|
DynamicPrintConfig DynamicPrintConfig::full_print_config()
|
||||||
|
@ -166,6 +166,8 @@ CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(PerimeterGeneratorType)
|
|||||||
|
|
||||||
#undef CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS
|
#undef CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS
|
||||||
|
|
||||||
|
class DynamicPrintConfig;
|
||||||
|
|
||||||
// Defines each and every confiuration option of Slic3r, including the properties of the GUI dialogs.
|
// 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.
|
// Does not store the actual values, but defines default values.
|
||||||
class PrintConfigDef : public ConfigDef
|
class PrintConfigDef : public ConfigDef
|
||||||
@ -174,6 +176,7 @@ public:
|
|||||||
PrintConfigDef();
|
PrintConfigDef();
|
||||||
|
|
||||||
static void handle_legacy(t_config_option_key &opt_key, std::string &value);
|
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
|
// Array options growing with the number of extruders
|
||||||
const std::vector<std::string>& extruder_option_keys() const { return m_extruder_option_keys; }
|
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().
|
// handle_legacy() is called internally by set_deserialize().
|
||||||
void handle_legacy(t_config_option_key &opt_key, std::string &value) const override
|
void handle_legacy(t_config_option_key &opt_key, std::string &value) const override
|
||||||
{ PrintConfigDef::handle_legacy(opt_key, value); }
|
{ 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);
|
void handle_legacy_sla(DynamicPrintConfig &config);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user