OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::DynamicConfig Class Reference

#include </home/runner/work/OrcaSlicer/OrcaSlicer/src/libslic3r/Config.hpp>

Inheritance diagram for Slic3r::DynamicConfig:
Collaboration diagram for Slic3r::DynamicConfig:

Classes

struct  KeyDifference
 Detailed information about the difference found for a single key. More...
struct  DynamicConfigDifference
 The full report object containing all detected differences. More...

Public Member Functions

 DynamicConfig ()=default
 DynamicConfig (const DynamicConfig &rhs)
 DynamicConfig (DynamicConfig &&rhs) noexcept
 DynamicConfig (const ConfigBase &rhs, const t_config_option_keys &keys)
 DynamicConfig (const ConfigBase &rhs)
virtual ~DynamicConfig () override=default
DynamicConfig & operator= (const DynamicConfig &rhs)
DynamicConfig & operator= (DynamicConfig &&rhs) noexcept
DynamicConfig & operator+= (const DynamicConfig &rhs)
DynamicConfig & operator+= (DynamicConfig &&rhs)
bool operator== (const DynamicConfig &rhs) const
bool operator!= (const DynamicConfig &rhs) const
void swap (DynamicConfig &other)
void clear ()
bool erase (const t_config_option_key &opt_key)
size_t remove_nil_options ()
const ConfigDef * def () const override
template<class T>
T * opt (const t_config_option_key &opt_key, bool create=false)
template<class T>
const T * opt (const t_config_option_key &opt_key) const
const ConfigOption * optptr (const t_config_option_key &opt_key) const override
ConfigOption * optptr (const t_config_option_key &opt_key, bool create=false) override
t_config_option_keys keys () const override
bool empty () const
bool set_key_value (const std::string &opt_key, ConfigOption *opt)
bool equals (const DynamicConfig &other, const std::set< std::string > *skipped_keys=nullptr) const
t_config_option_keys diff (const DynamicConfig &other) const
t_config_option_keys equal (const DynamicConfig &other) const
std::string & opt_string (const t_config_option_key &opt_key, bool create=false)
const std::string & opt_string (const t_config_option_key &opt_key) const
std::string & opt_string (const t_config_option_key &opt_key, unsigned int idx)
const std::string & opt_string (const t_config_option_key &opt_key, unsigned int idx) const
double & opt_float (const t_config_option_key &opt_key)
const double & opt_float (const t_config_option_key &opt_key) const
double & opt_float (const t_config_option_key &opt_key, unsigned int idx)
const double & opt_float (const t_config_option_key &opt_key, unsigned int idx) const
double & opt_float_nullable (const t_config_option_key &opt_key, unsigned int idx)
const double & opt_float_nullable (const t_config_option_key &opt_key, unsigned int idx) const
FloatOrPercent & opt_float_or_percent_nullable (const t_config_option_key &opt_key, unsigned int idx)
const FloatOrPercent & opt_float_or_percent_nullable (const t_config_option_key &opt_key, unsigned int idx) const
int & opt_int (const t_config_option_key &opt_key)
int opt_int (const t_config_option_key &opt_key) const
int & opt_int (const t_config_option_key &opt_key, unsigned int idx)
int opt_int (const t_config_option_key &opt_key, unsigned int idx) const
int & opt_int_nullable (const t_config_option_key &opt_key, unsigned int idx)
const int & opt_int_nullable (const t_config_option_key &opt_key, unsigned int idx) const
template<typename ENUM>
ENUM opt_enum (const t_config_option_key &opt_key) const
int opt_enum (const t_config_option_key &opt_key, unsigned int idx) const
int opt_enum_nullable (const t_config_option_key &opt_key, unsigned int idx) const
bool opt_bool (const t_config_option_key &opt_key) const
bool opt_bool (const t_config_option_key &opt_key, unsigned int idx) const
bool opt_bool_nullable (const t_config_option_key &opt_key, unsigned int idx) const
bool read_cli (int argc, const char *const argv[], t_config_option_keys *extra, t_config_option_keys *keys=nullptr)
std::map< t_config_option_key, std::unique_ptr< ConfigOption > >::const_iterator cbegin () const
std::map< t_config_option_key, std::unique_ptr< ConfigOption > >::const_iterator cend () const
size_t size () const
DynamicConfigDifference diff_report (const DynamicConfig &rhs) const
 Computes the symmetric difference between this DynamicConfig (left) and another DynamicConfig (rhs).
virtual bool apply_to (ConfigBase &) const
ConfigOption * option (const t_config_option_key &opt_key, bool create=false)
template<typename TYPE>
TYPE * option (const t_config_option_key &opt_key, bool create=false)
const ConfigOption * option (const t_config_option_key &opt_key) const
ConfigOption * option_throw (const t_config_option_key &opt_key, bool create=false)
template<typename TYPE>
TYPE * option_throw (const t_config_option_key &opt_key, bool create=false)
const ConfigOption * option_throw (const t_config_option_key &opt_key) const
void apply (const ConfigBase &other, bool ignore_nonexistent=false)
void apply_only (const ConfigBase &other, const t_config_option_keys &keys, bool ignore_nonexistent=false)
bool equals (const ConfigBase &other, const std::set< std::string > *skipped_keys=nullptr) const
t_config_option_keys diff (const ConfigBase &other) const
t_config_option_keys equal (const ConfigBase &other) const
std::string opt_serialize (const t_config_option_key &opt_key) const
void set (const std::string &opt_key, bool value, bool create=false)
void set (const std::string &opt_key, int value, bool create=false)
void set (const std::string &opt_key, double value, bool create=false)
void set (const std::string &opt_key, const char *value, bool create=false)
void set (const std::string &opt_key, const std::string &value, bool create=false)
bool set_deserialize_nothrow (const t_config_option_key &opt_key_src, const std::string &value_src, ConfigSubstitutionContext &substitutions, bool append=false)
void set_deserialize (const t_config_option_key &opt_key, const std::string &str, ConfigSubstitutionContext &config_substitutions, bool append=false)
void set_deserialize (std::initializer_list< SetDeserializeItem > items, ConfigSubstitutionContext &substitutions)
void set_deserialize_strict (const t_config_option_key &opt_key, const std::string &str, bool append=false)
void set_deserialize_strict (std::initializer_list< SetDeserializeItem > items)
double get_abs_value_at (const t_config_option_key &opt_key, size_t index) const
double get_abs_value (const t_config_option_key &opt_key) const
double get_abs_value (const t_config_option_key &opt_key, double ratio_over) const
void setenv_ () const
ConfigSubstitutions load (const std::string &file, ForwardCompatibilitySubstitutionRule compatibility_rule)
ConfigSubstitutions load (const boost::property_tree::ptree &tree, ForwardCompatibilitySubstitutionRule compatibility_rule)
ConfigSubstitutions load_string_map (std::map< std::string, std::string > &key_values, ForwardCompatibilitySubstitutionRule compatibility_rule)
int load_from_json (const std::string &file, ConfigSubstitutionContext &substitutions, bool load_inherits_in_config, std::map< std::string, std::string > &key_values, std::string &reason)
ConfigSubstitutions load_from_json (const std::string &file, ForwardCompatibilitySubstitutionRule compatibility_rule, std::map< std::string, std::string > &key_values, std::string &reason)
ConfigSubstitutions load_from_ini (const std::string &file, ForwardCompatibilitySubstitutionRule compatibility_rule)
ConfigSubstitutions load_from_ini_string (const std::string &data, ForwardCompatibilitySubstitutionRule compatibility_rule)
ConfigSubstitutions load_from_ini_string_commented (std::string &&data, ForwardCompatibilitySubstitutionRule compatibility_rule)
ConfigSubstitutions load_from_gcode_file (const std::string &file, ForwardCompatibilitySubstitutionRule compatibility_rule)
void save (const std::string &file) const
void save_to_json (const std::string &file, const std::string &name, const std::string &from, const std::string &version) const
void save_to_json (std::ostream &os, const std::string &name, const std::string &from, const std::string &version, bool replace_invalid_utf8=false) const
void update_plugin_manifest ()
void null_nullables ()
bool has (const t_config_option_key &opt_key) const

Static Public Member Functions

static size_t load_from_gcode_string_legacy (ConfigBase &config, const char *str, ConfigSubstitutionContext &substitutions)
static void set_resolve_capability_fn (std::function< std::string(std::string, std::string)> fn)

Protected Member Functions

virtual void handle_legacy (t_config_option_key &, std::string &) const
virtual void handle_legacy_composite ()

Private Member Functions

template<class Archive>
void serialize (Archive &ar)
bool set_deserialize_raw (const t_config_option_key &opt_key_src, const std::string &value, ConfigSubstitutionContext &substitutions, bool append)
void save_plugin_collection (const std::string &opt_key, const ConfigOption *opt, std::vector< std::string > &plugin_refs) const
std::vector< std::string > collect_plugin_manifest () const

Private Attributes

std::map< t_config_option_key, std::unique_ptr< ConfigOption > > options

Static Private Attributes

static std::function< std::string(std::string, std::string)> resolve_capability_fn = nullptr

Friends

class cereal::access

Detailed Description

Constructor & Destructor Documentation

◆ DynamicConfig() [1/5]

Slic3r::DynamicConfig::DynamicConfig ( )
default

◆ DynamicConfig() [2/5]

Slic3r::DynamicConfig::DynamicConfig ( const DynamicConfig & rhs)
inline
2913{ *this = rhs; }

References DynamicConfig().

Here is the call graph for this function:

◆ DynamicConfig() [3/5]

Slic3r::DynamicConfig::DynamicConfig ( DynamicConfig && rhs)
inlinenoexcept
2914: options(std::move(rhs.options)) { rhs.options.clear(); }
std::map< t_config_option_key, std::unique_ptr< ConfigOption > > options
Definition Config.hpp:3119

References DynamicConfig().

Here is the call graph for this function:

◆ DynamicConfig() [4/5]

Slic3r::DynamicConfig::DynamicConfig ( const ConfigBase & rhs,
const t_config_option_keys & keys )
explicit
1690{
1691 for (const t_config_option_key& opt_key : keys)
1692 this->options[opt_key] = std::unique_ptr<ConfigOption>(rhs.option(opt_key)->clone());
1693}
t_config_option_keys keys() const override
Definition Config.cpp:1919
std::string t_config_option_key
Definition Config.hpp:96

References Slic3r::ConfigBase::ConfigBase(), Slic3r::ConfigOption::clone(), keys(), Slic3r::ConfigBase::option(), and options.

Here is the call graph for this function:

◆ DynamicConfig() [5/5]

Slic3r::DynamicConfig::DynamicConfig ( const ConfigBase & rhs)
inlineexplicit
2916: DynamicConfig(rhs, rhs.keys()) {}

References Slic3r::ConfigBase::ConfigBase(), DynamicConfig(), and keys().

Here is the call graph for this function:

◆ ~DynamicConfig()

virtual Slic3r::DynamicConfig::~DynamicConfig ( )
overridevirtualdefault

Member Function Documentation

◆ apply()

void Slic3r::ConfigBase::apply ( const ConfigBase & other,
bool ignore_nonexistent = false )
inlineinherited
2803 { if (! other.apply_to(*this)) this->apply_only(other, other.keys(), ignore_nonexistent); }
void apply_only(const ConfigBase &other, const t_config_option_keys &keys, bool ignore_nonexistent=false)
Definition Config.cpp:484

References ConfigBase(), apply_only(), apply_to(), and keys().

Referenced by Slic3r::BackgroundSlicingProcess::apply(), Slic3r::GCodeProcessor::apply_config_superslicer(), Slic3r::GUI::CalibUtils::calib_flowrate(), Slic3r::GUI::CalibUtils::calib_generic_PA(), Slic3r::GUI::CalibUtils::calib_max_vol_speed(), Slic3r::GUI::CalibUtils::calib_pa_pattern(), Slic3r::GUI::CalibUtils::calib_retraction(), Slic3r::GUI::CalibUtils::calib_temptue(), Slic3r::GUI::CalibUtils::calib_VFA(), Slic3r::PresetBundle::config_from_gcode(), Slic3r::PresetBundle::construct_full_config(), Slic3r::GUI::SLAImportJob::finalize(), Slic3r::PresetBundle::full_fff_config(), Slic3r::PresetBundle::full_sla_config(), Slic3r::PresetBundle::import_json_presets(), Slic3r::GUI::PartPlate::load_gcode_from_file(), Slic3r::PresetCollection::load_user_preset(), Slic3r::GCodeProcessor::process_file(), Slic3r::Preset::reload(), Slic3r::PresetBundle::resolve_vendor_preset(), Slic3r::CLI::run(), Slic3r::GUI::CalibUtils::set_for_auto_pa_model_and_config(), Slic3r::GUI::PartPlateList::store_to_3mf_structure(), Slic3r::GUI::PlaterPresetComboBox::sync_colour_config(), Slic3r::GUI::PresetComboBox::update_ams_color(), Slic3r::GUI::ObjectSettings::update_config_values(), and Slic3r::update_static_print_config_from_dynamic().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ apply_only()

void Slic3r::ConfigBase::apply_only ( const ConfigBase & other,
const t_config_option_keys & keys,
bool ignore_nonexistent = false )
inherited
485{
486 // loop through options and apply them
487 for (const t_config_option_key &opt_key : keys) {
488 // Create a new option with default value for the key.
489 // If the key is not in the parameter definition, or this ConfigBase is a static type and it does not support the parameter,
490 // an exception is thrown if not ignore_nonexistent.
491 ConfigOption *my_opt = this->option(opt_key, true);
492 if (my_opt == nullptr) {
493 // opt_key does not exist in this ConfigBase and it cannot be created, because it is not defined by this->def().
494 // This is only possible if other is of DynamicConfig type.
495 if (auto n = opt_key.find('#'); n != std::string::npos) {
496 auto opt_key2 = opt_key.substr(0, n);
497 auto my_opt2 = dynamic_cast<ConfigOptionVectorBase*>(this->option(opt_key2));
498 auto other_opt = other.option(opt_key2);
499 if (my_opt2 == nullptr && other_opt) {
500 my_opt2 = dynamic_cast<ConfigOptionVectorBase *>(this->option(opt_key2, true));
501 if (my_opt2->empty()) {
502 my_opt2->resize(1, other_opt);
503 }
504 }
505 if (my_opt2) {
506 int index = std::atoi(opt_key.c_str() + n + 1);
507 if (other_opt)
508 my_opt2->set_at(other_opt, index, index);
509 continue;
510 }
511 }
512 if (ignore_nonexistent)
513 continue;
514 throw UnknownOptionException(opt_key);
515 }
516 const ConfigOption *other_opt = other.option(opt_key);
517 if (other_opt == nullptr) {
518 // The key was not found in the source config, therefore it will not be initialized!
519// printf("Not found, therefore not initialized: %s\n", opt_key.c_str());
520 } else
521 my_opt->set(other_opt);
522 }
523}
ConfigOption * option(const t_config_option_key &opt_key, bool create=false)
Definition Config.hpp:2768
virtual t_config_option_keys keys() const =0

References ConfigBase(), keys(), option(), and Slic3r::ConfigOption::set().

Referenced by apply(), Slic3r::PresetBundle::load_config_file_config(), Slic3r::Preset::load_external_config(), Slic3r::PresetCollection::load_external_preset(), Slic3r::PresetCollection::load_preset(), Slic3r::PresetCollection::load_user_preset(), Slic3r::GUI::Tab::may_discard_current_dirty_preset(), Slic3r::PresetBundle::reload_local_bundle(), Slic3r::CLI::run(), Slic3r::PresetBundle::save_changes_for_preset(), Slic3r::GUI::CreatePrinterPresetDialog::save_printable_area_config(), and Slic3r::GUI::TabPrintModel::update_model_config().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ apply_to()

virtual bool Slic3r::ConfigBase::apply_to ( ConfigBase & ) const
inlinevirtualinherited
2750{ return false; }

References ConfigBase().

Referenced by apply().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cbegin()

std::map< t_config_option_key, std::unique_ptr< ConfigOption > >::const_iterator Slic3r::DynamicConfig::cbegin ( ) const
inline
3080{ return options.cbegin(); }

References options.

Referenced by Slic3r::apply_to_print_region_config(), Slic3r::CacheDictionary::collect(), Slic3r::dynamic_config_iterate(), cereal::save(), and Slic3r::save_config().

Here is the caller graph for this function:

◆ cend()

std::map< t_config_option_key, std::unique_ptr< ConfigOption > >::const_iterator Slic3r::DynamicConfig::cend ( ) const
inline
3081{ return options.cend(); }

References options.

Referenced by Slic3r::apply_to_print_region_config(), Slic3r::CacheDictionary::collect(), Slic3r::dynamic_config_iterate(), cereal::save(), and Slic3r::save_config().

Here is the caller graph for this function:

◆ clear()

void Slic3r::DynamicConfig::clear ( )
inline
2988 {
2989 this->options.clear();
2990 }

Referenced by cereal::load(), operator=(), operator=(), and Slic3r::read_config().

Here is the caller graph for this function:

◆ collect_plugin_manifest()

std::vector< std::string > Slic3r::ConfigBase::collect_plugin_manifest ( ) const
privateinherited
1663{
1664 std::vector<std::string> refs;
1666 return refs;
1667
1668 // Each plugin-backed option (ConfigOptionDef::is_plugin_backed) contributes its resolved
1669 // reference(s) via save_plugin_collection, which appends in order and skips duplicates, so no
1670 // second de-duplication pass is needed here.
1671 for (const std::string& opt_key : this->keys())
1672 if (const ConfigOption* opt = this->option(opt_key))
1673 this->save_plugin_collection(opt_key, opt, refs);
1674 return refs;
1675}
void save_plugin_collection(const std::string &opt_key, const ConfigOption *opt, std::vector< std::string > &plugin_refs) const
Definition Config.cpp:1626
static std::function< std::string(std::string, std::string)> resolve_capability_fn
Definition Config.hpp:2904

References keys(), option(), resolve_capability_fn, and save_plugin_collection().

Referenced by save_to_json(), and update_plugin_manifest().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ def()

const ConfigDef * Slic3r::DynamicConfig::def ( ) const
inlineoverridevirtual

Implements Slic3r::ConfigBase.

Reimplemented in Slic3r::DynamicPrintAndCLIConfig, and Slic3r::DynamicPrintConfig.

3006{ return nullptr; }

Referenced by operator+=(), operator+=(), operator=(), operator=(), optptr(), Slic3r::prune_stale_plugin_overrides(), and read_cli().

Here is the caller graph for this function:

◆ diff() [1/2]

t_config_option_keys Slic3r::ConfigBase::diff ( const ConfigBase & other) const
inherited
542{
544 for (const t_config_option_key &opt_key : this->keys()) {
545 const ConfigOption *this_opt = this->option(opt_key);
546 const ConfigOption *other_opt = other.option(opt_key);
547 if (this_opt != nullptr && other_opt != nullptr && *this_opt != *other_opt)
548 diff.emplace_back(opt_key);
549 }
550 return diff;
551}
t_config_option_keys diff(const ConfigBase &other) const
Definition Config.cpp:541
std::vector< std::string > t_config_option_keys
Definition Config.hpp:97

References ConfigBase(), diff(), keys(), and option().

Referenced by diff().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ diff() [2/2]

t_config_option_keys Slic3r::DynamicConfig::diff ( const DynamicConfig & other) const
2067{
2069 dynamic_config_iterate(*this, other,
2070 [&diff](const t_config_option_key &key, const ConfigOption *l, const ConfigOption *r) {
2071 if (*l != *r)
2072 diff.emplace_back(key);
2073 // Continue iterating.
2074 return false;
2075 });
2076 return diff;
2077}
t_config_option_keys diff(const DynamicConfig &other) const
Definition Config.cpp:2066
static bool dynamic_config_iterate(const DynamicConfig &lhs, const DynamicConfig &rhs, Fn fn, const std::set< std::string > *skipped_keys=nullptr)
Definition Config.cpp:2031

References DynamicConfig(), diff(), and Slic3r::dynamic_config_iterate().

Referenced by Slic3r::GUI::ObjectSettings::add_missed_options(), Slic3r::GUI::ConfigManipulation::apply(), diff(), Slic3r::PresetCollection::dirty_options(), Slic3r::PresetCollection::dirty_options_without_option_list(), Slic3r::PresetBundle::full_fff_config(), Slic3r::profile_print_params_same(), Slic3r::PresetBundle::resolve_vendor_preset(), Slic3r::CLI::run(), Slic3r::Preset::set_dirty(), and Slic3r::GUI::PartPlate::set_vase_mode_related_object_config().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ diff_report()

DynamicConfig::DynamicConfigDifference Slic3r::DynamicConfig::diff_report ( const DynamicConfig & rhs) const

Computes the symmetric difference between this DynamicConfig (left) and another DynamicConfig (rhs).

Parameters
rhsThe right-hand side config to compare against.
Returns
DynamicConfigDifference report.
1928 {
1929 DynamicConfig::DynamicConfigDifference result;
1930
1931 std::set<t_config_option_key> all_keys;
1932
1933 for (const auto& kvp : this->options) {
1934 all_keys.insert(kvp.first);
1935 }
1936 for (const auto& kvp : rhs.options) {
1937 all_keys.insert(kvp.first);
1938 }
1939
1940 for (const auto& key : all_keys) {
1941 auto left_it = this->options.find(key);
1942 auto right_it = rhs.options.find(key);
1943
1944 bool left_has = (left_it != this->options.end());
1945 bool right_has = (right_it != rhs.options.end());
1946
1947 if (left_has && right_has) {
1948 if (*left_it->second != *right_it->second) {
1949 result.differences[key] = {
1950 left_it->second->serialize(),
1951 right_it->second->serialize()
1952 };
1953 }
1954 } else if (left_has) {
1955 result.differences[key] = {
1956 left_it->second->serialize(),
1957 std::nullopt
1958 };
1959 } else if (right_has) {
1960 result.differences[key] = {
1961 std::nullopt,
1962 right_it->second->serialize()
1963 };
1964 }
1965 }
1966 return result;
1967}

References DynamicConfig(), Slic3r::DynamicConfig::DynamicConfigDifference::differences, and options.

Here is the call graph for this function:

◆ empty()

bool Slic3r::DynamicConfig::empty ( ) const
inline
3017{ return options.empty(); }

References options.

Referenced by Slic3r::extract_profile(), Slic3r::import_sla_archive(), Slic3r::GUI::Tab::load_current_preset(), Slic3r::GUI::Plater::priv::load_files(), Slic3r::GUI::ObjectList::paste_settings_into_list(), Slic3r::CLI::run(), and Slic3r::GUI::Tab::sync_excluder().

Here is the caller graph for this function:

◆ equal() [1/2]

t_config_option_keys Slic3r::ConfigBase::equal ( const ConfigBase & other) const
inherited
555{
557 for (const t_config_option_key &opt_key : this->keys()) {
558 const ConfigOption *this_opt = this->option(opt_key);
559 const ConfigOption *other_opt = other.option(opt_key);
560 if (this_opt != nullptr && other_opt != nullptr && *this_opt == *other_opt)
561 equal.emplace_back(opt_key);
562 }
563 return equal;
564}
t_config_option_keys equal(const ConfigBase &other) const
Definition Config.cpp:554

References ConfigBase(), equal(), keys(), and option().

Referenced by equal().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ equal() [2/2]

t_config_option_keys Slic3r::DynamicConfig::equal ( const DynamicConfig & other) const
2081{
2083 dynamic_config_iterate(*this, other,
2084 [&equal](const t_config_option_key &key, const ConfigOption *l, const ConfigOption *r) {
2085 if (*l == *r)
2086 equal.emplace_back(key);
2087 // Continue iterating.
2088 return false;
2089 });
2090 return equal;
2091}
t_config_option_keys equal(const DynamicConfig &other) const
Definition Config.cpp:2080

References DynamicConfig(), Slic3r::dynamic_config_iterate(), and equal().

Referenced by equal().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ equals() [1/2]

bool Slic3r::ConfigBase::equals ( const ConfigBase & other,
const std::set< std::string > * skipped_keys = nullptr ) const
inherited
528{
529 for (const t_config_option_key &opt_key : this->keys()) {
530 if (skipped_keys && (skipped_keys->count(opt_key) != 0))
531 continue;
532 const ConfigOption *this_opt = this->option(opt_key);
533 const ConfigOption *other_opt = other.option(opt_key);
534 if (this_opt != nullptr && other_opt != nullptr && *this_opt != *other_opt)
535 return false;
536 }
537 return true;
538}

References ConfigBase(), keys(), and option().

Here is the call graph for this function:

◆ equals() [2/2]

bool Slic3r::DynamicConfig::equals ( const DynamicConfig & other,
const std::set< std::string > * skipped_keys = nullptr ) const
2059{
2060 return ! dynamic_config_iterate(*this, other,
2061 [](const t_config_option_key & /* key */, const ConfigOption *l, const ConfigOption *r) { return *l != *r; },
2062 skipped_keys);
2063}

References DynamicConfig(), and Slic3r::dynamic_config_iterate().

Referenced by Slic3r::PresetCollection::is_dirty(), and Slic3r::GUI::GUI_App::reload_settings().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ erase()

bool Slic3r::DynamicConfig::erase ( const t_config_option_key & opt_key)
inline
2993 {
2994 auto it = this->options.find(opt_key);
2995 if (it == this->options.end())
2996 return false;
2997 this->options.erase(it);
2998 return true;
2999 }

Referenced by Slic3r::PresetBundle::construct_full_config(), Slic3r::GUI::ExportConfigsDialog::earse_preset_fields_for_safe(), Slic3r::PresetBundle::full_config_secure(), Slic3r::PresetBundle::full_fff_config(), Slic3r::PresetBundle::full_sla_config(), Slic3r::GUI::ExportPresetBundleDialog::InitExportData(), Slic3r::DynamicPrintConfig::normalize_fdm(), Slic3r::DynamicPrintConfig::normalize_fdm_1(), Slic3r::PresetBundle::reload_local_bundle(), and Slic3r::CLI::run().

Here is the caller graph for this function:

◆ get_abs_value() [1/2]

double Slic3r::ConfigBase::get_abs_value ( const t_config_option_key & opt_key) const
inherited
740{
741 // Get stored option value.
742 const ConfigOption *raw_opt = this->option(opt_key);
743 if (raw_opt == nullptr) {
744 std::stringstream ss;
745 ss << "You can't define an option that need " << opt_key << " without defining it!";
746 throw std::runtime_error(ss.str());
747 }
748 assert(raw_opt != nullptr);
749
750 if (raw_opt->type() == coFloat)
751 return static_cast<const ConfigOptionFloat*>(raw_opt)->value;
752 if (raw_opt->type() == coInt)
753 return static_cast<const ConfigOptionInt *>(raw_opt)->value;
754 if (raw_opt->type() == coBool)
755 return static_cast<const ConfigOptionBool *>(raw_opt)->value ? 1 : 0;
756
757 const ConfigOptionPercent *cast_opt = nullptr;
758 if (raw_opt->type() == coFloatOrPercent) {
759 auto cofop = static_cast<const ConfigOptionFloatOrPercent*>(raw_opt);
760 if (cofop->value == 0 && boost::ends_with(opt_key, "_line_width")) {
761 return this->get_abs_value("line_width");
762 }
763 if (!cofop->percent)
764 return cofop->value;
765 cast_opt = cofop;
766 }
767
768 if (raw_opt->type() == coPercent) {
769 cast_opt = static_cast<const ConfigOptionPercent *>(raw_opt);
770 }
771
772 // Get option definition.
773 const ConfigDef *def = this->def();
774 if (def == nullptr)
775 throw NoDefinitionException(opt_key);
776 const ConfigOptionDef *opt_def = def->get(opt_key);
777
778
779 assert(opt_def != nullptr);
780 if (opt_def->ratio_over == "")
781 return cast_opt->get_abs_value(1);
782 // Compute absolute value over the absolute value of the base option.
783 //FIXME there are some ratio_over chains, which end with empty ratio_with.
784 // For example, XXX_extrusion_width parameters are not handled by get_abs_value correctly.
785 return opt_def->ratio_over.empty() ? 0. :
786 static_cast<const ConfigOptionFloatOrPercent*>(raw_opt)->get_abs_value(this->get_abs_value(opt_def->ratio_over));
787
788
789 throw ConfigurationError("ConfigBase::get_abs_value(): Not a valid option type for get_abs_value()");
790}
virtual const ConfigDef * def() const =0
double get_abs_value(const t_config_option_key &opt_key) const
Definition Config.cpp:739
zaa_minimize_perimeter_height ConfigOptionFloat
Definition PrintConfig.hpp:1954
@ coInt
Definition Config.hpp:188
@ coBool
Definition Config.hpp:210
@ coFloat
Definition Config.hpp:184
@ coFloatOrPercent
Definition Config.hpp:200
@ coPercent
Definition Config.hpp:196

References Slic3r::coBool, Slic3r::coFloat, Slic3r::coFloatOrPercent, Slic3r::coInt, Slic3r::coPercent, def(), get_abs_value(), Slic3r::ConfigOptionPercent::get_abs_value(), option(), Slic3r::ConfigOptionDef::ratio_over, Slic3r::ConfigOption::type(), and Slic3r::ConfigOptionSingle< T >::value.

Referenced by Slic3r::GUI::Plater::_calib_pa_pattern(), Slic3r::GUI::CalibUtils::calib_pa_pattern(), get_abs_value(), get_abs_value(), Slic3r::GUI::GLGizmoBrimEars::get_brim_default_radius(), Slic3r::GUI::CalibUtils::set_for_auto_pa_model_and_config(), and Slic3r::GUI::ConfigManipulation::update_print_fff_config().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_abs_value() [2/2]

double Slic3r::ConfigBase::get_abs_value ( const t_config_option_key & opt_key,
double ratio_over ) const
inherited
795{
796 // Get stored option value.
797 const ConfigOption *raw_opt = this->option(opt_key);
798 // Mirror the single-arg overload — assert() is a no-op under NDEBUG.
799 if (raw_opt == nullptr)
800 throw ConfigurationError("ConfigBase::get_abs_value(): \"" + opt_key + "\" is not defined");
801 if (raw_opt->type() != coFloatOrPercent)
802 throw ConfigurationError("ConfigBase::get_abs_value(): opt_key is not of coFloatOrPercent");
803 // Compute absolute value.
804 return static_cast<const ConfigOptionFloatOrPercent*>(raw_opt)->get_abs_value(ratio_over);
805}

References Slic3r::coFloatOrPercent, get_abs_value(), option(), and Slic3r::ConfigOption::type().

Here is the call graph for this function:

◆ get_abs_value_at()

double Slic3r::ConfigBase::get_abs_value_at ( const t_config_option_key & opt_key,
size_t index ) const
inherited
712{
713 const ConfigOption *raw_opt = this->option(opt_key);
714 assert(raw_opt != nullptr);
715 if (raw_opt->type() == coFloats) {
716 return static_cast<const ConfigOptionFloats*>(raw_opt)->get_at(index);
717 }
718 if (raw_opt->type() == coFloatsOrPercents) {
719 const ConfigDef *def = this->def();
720 if (def == nullptr) throw NoDefinitionException(opt_key);
721 const ConfigOptionDef *opt_def = def->get(opt_key);
722 assert(opt_def != nullptr);
723
724 if (opt_def->ratio_over.empty()) {
725 return 0;
726 } else {
727 const ConfigOption *ratio_opt = this->option(opt_def->ratio_over);
728 assert(ratio_opt->type() == coFloats);
729 const ConfigOptionFloats *ratio_values = static_cast<const ConfigOptionFloats *>(ratio_opt);
730 return static_cast<const ConfigOptionFloatsOrPercents *>(raw_opt)->get_at(index).get_abs_value(ratio_values->get_at(index));
731 }
732 }
733
734 throw ConfigurationError("ConfigBase::get_abs_value_at(): Not a valid option type for get_abs_value_at()");
735}
@ coFloatsOrPercents
Definition Config.hpp:202
@ coFloats
Definition Config.hpp:186
ConfigOptionFloatsOrPercentsTempl< false > ConfigOptionFloatsOrPercents
Definition Config.hpp:1531
ConfigOptionFloatsTempl< false > ConfigOptionFloats
Definition Config.hpp:1015

References Slic3r::coFloats, Slic3r::coFloatsOrPercents, def(), Slic3r::ConfigOptionVector< double >::get_at(), option(), Slic3r::ConfigOptionDef::ratio_over, and Slic3r::ConfigOption::type().

Referenced by Slic3r::GUI::Plater::_calib_pa_pattern().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ handle_legacy()

virtual void Slic3r::ConfigBase::handle_legacy ( t_config_option_key & ,
std::string &  ) const
inlineprotectedvirtualinherited

Reimplemented in Slic3r::DynamicPrintAndCLIConfig, Slic3r::DynamicPrintConfig, and Slic3r::StaticPrintConfig.

2757{}

Referenced by load_from_json(), and set_deserialize_nothrow().

Here is the caller graph for this function:

◆ handle_legacy_composite()

virtual void Slic3r::ConfigBase::handle_legacy_composite ( )
inlineprotectedvirtualinherited

Reimplemented in Slic3r::DynamicPrintConfig.

2761{}

Referenced by load(), load_from_gcode_file(), load_from_gcode_string_legacy(), and load_from_json().

Here is the caller graph for this function:

◆ has()

bool Slic3r::ConfigOptionResolver::has ( const t_config_option_key & opt_key) const
inlineinherited
2697{ return this->optptr(opt_key) != nullptr; }
virtual const ConfigOption * optptr(const t_config_option_key &opt_key) const =0

References optptr().

Referenced by Slic3r::_BBS_3MF_Exporter::_add_slice_info_config_file_to_archive(), Slic3r::active_bed_exclude_volume_mode(), Slic3r::append_bed_exclude_volumes(), Slic3r::append_printer_bed_assets(), Slic3r::GUI::change_opt_value(), Slic3r::GUI::ConfigManipulation::check_adaptive_pressure_advance_model(), Slic3r::GUI::PartPlateList::check_all_plate_local_bed_type(), Slic3r::GUI::ConfigManipulation::check_chamber_minimal_temperature(), Slic3r::GUI::ConfigManipulation::check_chamber_temperature(), Slic3r::GUI::ConfigManipulation::check_filament_max_volumetric_speed(), Slic3r::GUI::ConfigManipulation::check_nozzle_recommended_temperature_range(), Slic3r::GUI::ConfigManipulation::check_nozzle_temperature_initial_layer_range(), Slic3r::GUI::ConfigManipulation::check_nozzle_temperature_range(), Slic3r::config_value_or_none(), Slic3r::GUI::Bed3D::detect_type(), Slic3r::PresetCollection::dirty_options(), Slic3r::PresetCollection::dirty_options_without_option_list(), Slic3r::GUI::ensure_belt_purge_tower(), Slic3r::extend_default_config_length(), Slic3r::extend_extruder_variant(), Slic3r::anonymous_namespace{PluginResolver.cpp}::find_option_for_capability(), Slic3r::get_bed_excluded_regions_by_extruder(), Slic3r::GUI::PartPlate::get_bed_type(), Slic3r::anonymous_namespace{SL1.cpp}::get_cfg_value(), Slic3r::GUI::GLGizmoBrimEars::get_config_options(), Slic3r::GUI::ConfigOptionsGroup::get_config_value(), Slic3r::GUI::get_formatted_tooltip_text(), Slic3r::get_instance_arrange_poly(), Slic3r::GUI::PartPlate::get_object_filament_extruders(), Slic3r::GUI::OrientJob::get_orient_mesh(), Slic3r::DynamicPrintConfig::get_parameter_size(), Slic3r::GUI::CalibrationPresetPage::get_print_preset(), Slic3r::GUI::PartPlate::get_spiral_vase_mode(), Slic3r::GUI::ConfigManipulation::get_temperature_range(), Slic3r::GUI::PresetComboBox::get_tooltip(), Slic3r::PrintConfigDef::handle_legacy_composite(), Slic3r::handle_legacy_project_loaded(), Slic3r::handle_legacy_sla(), Slic3r::has_bed_exclude_volumes(), Slic3r::PresetBundle::import_json_presets(), Slic3r::PresetCollection::is_dirty(), Slic3r::GUI::is_same_nozzle_type(), Slic3r::GUI::ObjectList::load_shape_object(), Slic3r::PresetCollection::load_user_preset(), Slic3r::DynamicPrintConfig::normalize_fdm(), Slic3r::DynamicPrintConfig::normalize_fdm_1(), Slic3r::GUI::PartPlateList::notify_instance_update(), Slic3r::GUI::TabPrintPlate::on_value_change(), Slic3r::DynamicConfig::read_cli(), Slic3r::Preset::remove_invalid_keys(), Slic3r::GUI::PartPlate::render_logo(), Slic3r::PresetBundle::resolve_vendor_preset(), Slic3r::CLI::run(), Slic3r::GUI::PartPlate::set_bed_type(), Slic3r::set_filament_dev_options(), Slic3r::Model::setExtruderParams(), Slic3r::Model::setPrintSpeedTable(), Slic3r::GUI::TabFilament::toggle_options(), Slic3r::GUI::ConfigManipulation::toggle_print_fff_options(), Slic3r::GLVolumeCollection::update_colors_by_extruder(), Slic3r::PresetBundle::update_compatible(), Slic3r::GUI::TabPrintPlate::update_custom_dirty(), Slic3r::GUI::TabPrintModel::update_model_config(), Slic3r::GUI::ConfigManipulation::update_print_fff_config(), and Slic3r::GUI::Tab::validate_filament_temperature_pairs().

Here is the call graph for this function:

◆ keys()

t_config_option_keys Slic3r::DynamicConfig::keys ( ) const
overridevirtual

Implements Slic3r::ConfigBase.

1920{
1922 keys.reserve(this->options.size());
1923 for (const auto &opt : this->options)
1924 keys.emplace_back(opt.first);
1925 return keys;
1926}
T * opt(const t_config_option_key &opt_key, bool create=false)
Definition Config.hpp:3007

References keys(), opt(), and options.

Referenced by DynamicConfig(), DynamicConfig(), Slic3r::_3MF_Exporter::_add_print_config_file_to_archive(), Slic3r::_BBS_3MF_Exporter::_add_print_config_file_to_archive(), Slic3r::GCode::append_full_config(), Slic3r::Search::SettingsIndex::append_options(), Slic3r::PlaceholderParser::apply_config(), Slic3r::PlaceholderParser::config_diff(), Slic3r::PresetBundle::config_from_gcode(), Slic3r::GUI::Plater::export_published_3mf(), Slic3r::extend_default_config_length(), Slic3r::anonymous_namespace{PluginResolver.cpp}::find_option_for_capability(), Slic3r::full_print_config_diffs(), Slic3r::GUI::SettingsFactory::get_bundle(), Slic3r::GUI::get_config_json(), keys(), Slic3r::Preset::load_external_config(), Slic3r::PresetCollection::load_preset(), Slic3r::PresetCollection::load_user_preset(), Slic3r::DynamicPrintConfig::new_from_defaults_keys(), Slic3r::GUI::ObjectList::paste_settings_into_list(), Slic3r::GCode::placeholder_parser_process(), anonymous_namespace{OrcaSlicer_profile_validator.cpp}::preset_templates(), Slic3r::prune_stale_plugin_overrides(), read_cli(), Slic3r::CLI::run(), Slic3r::GUI::Tab::sync_excluder(), Slic3r::GUI::ObjectTableSettings::update_config_values(), Slic3r::DynamicPrintConfig::update_diff_values_to_child_config(), Slic3r::DynamicPrintConfig::update_non_diff_values_to_base_config(), Slic3r::update_static_print_config_from_dynamic(), Slic3r::GUI::UnsavedChangesDialog::update_tree(), Slic3r::DynamicPrintConfig::update_values_from_multi_to_multi_2(), and Slic3r::GUI::variant_keys().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ load() [1/2]

ConfigSubstitutions Slic3r::ConfigBase::load ( const boost::property_tree::ptree & tree,
ForwardCompatibilitySubstitutionRule compatibility_rule )
inherited
1229{
1230 ConfigSubstitutionContext substitutions_ctxt(compatibility_rule);
1231 for (const boost::property_tree::ptree::value_type &v : tree) {
1232 try {
1233 t_config_option_key opt_key = v.first;
1234 this->set_deserialize(opt_key, v.second.get_value<std::string>(), substitutions_ctxt);
1235 } catch (UnknownOptionException & /* e */) {
1236 // ignore
1237 }
1238 }
1239 // Do legacy conversion on a completely loaded dictionary.
1240 // Perform composite conversions, for example merging multiple keys into one key.
1242 return std::move(substitutions_ctxt.substitutions);
1243}
virtual void handle_legacy_composite()
Definition Config.hpp:2761
void set_deserialize(const t_config_option_key &opt_key, const std::string &str, ConfigSubstitutionContext &config_substitutions, bool append=false)
Definition Config.cpp:614

References handle_legacy_composite(), set_deserialize(), and Slic3r::ConfigSubstitutionContext::substitutions.

Here is the call graph for this function:

◆ load() [2/2]

ConfigSubstitutions Slic3r::ConfigBase::load ( const std::string & file,
ForwardCompatibilitySubstitutionRule compatibility_rule )
inherited
846{
847 std::map<std::string, std::string> key_values;
848 if (is_gcode_file(file))
849 return this->load_from_gcode_file(file, compatibility_rule);
850 else if (is_json_file(file)) {
851 std::string reason;
852 return this->load_from_json(file, compatibility_rule, key_values, reason);
853 }
854 else {
855 BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << "unsupported format for config file" << file;
856 return ConfigSubstitutions();
857 //return this->load_from_ini(file, compatibility_rule);
858 }
859}
ConfigSubstitutions load_from_gcode_file(const std::string &file, ForwardCompatibilitySubstitutionRule compatibility_rule)
Definition Config.cpp:1402
int load_from_json(const std::string &file, ConfigSubstitutionContext &substitutions, bool load_inherits_in_config, std::map< std::string, std::string > &key_values, std::string &reason)
Definition Config.cpp:871
std::vector< ConfigSubstitution > ConfigSubstitutions
Definition Config.hpp:269
bool is_json_file(const std::string &path)
Definition utils.cpp:1214
bool is_gcode_file(const std::string &path)
Definition utils.cpp:1208

References Slic3r::is_gcode_file(), Slic3r::is_json_file(), load_from_gcode_file(), and load_from_json().

Referenced by Slic3r::extract_profile(), Slic3r::import_sla_archive(), Slic3r::import_sla_archive(), load_from_ini(), and load_from_ini_string().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ load_from_gcode_file()

ConfigSubstitutions Slic3r::ConfigBase::load_from_gcode_file ( const std::string & file,
ForwardCompatibilitySubstitutionRule compatibility_rule )
inherited
1403{
1404 // Read a 64k block from the end of the G-code.
1405 boost::nowide::ifstream ifs(file);
1406 BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": before parse_file %1%") % file.c_str();
1407 // Look for Slic3r or OrcaSlicer header.
1408 // Look for the header across the whole file as the G-code may have been extended at the start by a post-processing script or the user.
1409 //BBS
1410 bool has_delimiters = true;
1411 {
1412 //BBS
1413 std::string bambuslicer_gcode_header = "; OrcaSlicer";
1414
1415 std::string orcaslicer_gcode_header = std::string("; generated by ");
1416 orcaslicer_gcode_header += SLIC3R_APP_NAME;
1417
1418 std::string header;
1419 bool header_found = false;
1420 while (std::getline(ifs, header)) {
1421 // BBS
1422 const char* line_c = skip_whitespaces(header.c_str());
1423 if (std::toupper(*line_c) == 'N')
1424 line_c = skip_word(line_c);
1425 line_c = skip_whitespaces(line_c);
1426 // BBS
1427 if (strncmp(bambuslicer_gcode_header.c_str(), line_c, strlen(bambuslicer_gcode_header.c_str())) == 0 ||
1428 strncmp(orcaslicer_gcode_header.c_str(), line_c, strlen(orcaslicer_gcode_header.c_str())) == 0) {
1429 header_found = true;
1430 break;
1431 }
1432 }
1433 if (!header_found) {
1434 // TRN %1% is the application name.
1435 std::string error_message = format(_u8L("Not a G-code file generated by %1%."), SLIC3R_APP_FULL_NAME);
1436 BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << error_message;
1437 throw Slic3r::RuntimeError(error_message.c_str());
1438 }
1439 }
1440
1441 ConfigSubstitutionContext substitutions_ctxt(compatibility_rule);
1442 size_t key_value_pairs = 0;
1443
1444 if (has_delimiters)
1445 {
1446 //BBS
1447 // PrusaSlicer starting with 2.4.0-alpha0 delimits the config section stored into G-code with
1448 // ; CONFIG_BLOCK_START
1449 // ...
1450 // ; CONFIG_BLOCK_END
1451 bool begin_found = false;
1452 bool end_found = false;
1453 std::string line;
1454 while (std::getline(ifs, line))
1455 if (line.rfind("; CONFIG_BLOCK_START",0)==0) {
1456 begin_found = true;
1457 break;
1458 }
1459 if (!begin_found) {
1460 //BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << format("Configuration block closing tag \"; CONFIG_BLOCK_START\" not found when reading %1%", file);
1461 // TRN %1% is a tag in the G-code file that must not be translated.
1462 throw Slic3r::RuntimeError(format(_u8L("Config tag \"%1%\" not found"), "; CONFIG_BLOCK_START"));
1463 }
1464 std::string key, value;
1465 while (std::getline(ifs, line)) {
1466 if (line.rfind("; CONFIG_BLOCK_END",0)==0) {
1467 end_found = true;
1468 break;
1469 }
1470 // line should be a valid key = value pair.
1471 auto pos = line.find('=');
1472 if (pos != std::string::npos && pos > 1 && line.front() == ';') {
1473 key = line.substr(1, pos - 1);
1474 value = line.substr(pos + 1);
1475 boost::trim(key);
1476 boost::trim(value);
1477 try {
1478 this->set_deserialize(key, value, substitutions_ctxt);
1479 ++ key_value_pairs;
1480 } catch (UnknownOptionException & /* e */) {
1481 // ignore
1482 }
1483 }
1484 }
1485 if (!end_found) {
1486 //BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << format("Configuration block opening tag \"; CONFIG_BLOCK_END\" not found when reading %1%", file);
1487 throw Slic3r::RuntimeError(format(_u8L("Config tag \"%1%\" not found"), "; CONFIG_BLOCK_END"));
1488 }
1489 }
1490 else
1491 {
1492 auto header_end_pos = ifs.tellg();
1493 // Slicer older than 2.4.0-alpha0 do not emit any delimiter.
1494 // Try a heuristics reading the G-code from back.
1495 ifs.seekg(0, ifs.end);
1496 auto file_length = ifs.tellg();
1497 auto data_length = std::min<std::fstream::pos_type>(65535, file_length - header_end_pos);
1498 ifs.seekg(file_length - data_length, ifs.beg);
1499 std::vector<char> data(size_t(data_length) + 1, 0);
1500 ifs.read(data.data(), data_length);
1501 ifs.close();
1502 key_value_pairs = load_from_gcode_string_legacy(*this, data.data(), substitutions_ctxt);
1503 }
1504
1505 if (key_value_pairs < 80) {
1506 BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << format("Suspiciously low number of configuration values extracted from %1%: %2%", file, key_value_pairs);
1507 throw Slic3r::RuntimeError(format(_u8L("Suspiciously low number of configuration values extracted from %1%: %2%"), file, key_value_pairs));
1508 }
1509
1510 // Do legacy conversion on a completely loaded dictionary.
1511 // Perform composite conversions, for example merging multiple keys into one key.
1513
1514 BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": finished to parse_file %1%") % file.c_str();
1515 return std::move(substitutions_ctxt.substitutions);
1516}
static size_t load_from_gcode_string_legacy(ConfigBase &config, const char *str, ConfigSubstitutionContext &substitutions)
Definition Config.cpp:1264
#define SLIC3R_APP_FULL_NAME
Definition libslic3r.h:11
Vec3d pos(const Pt &p)
Definition ReprojectPointsOnMesh.hpp:16
static const char * skip_whitespaces(const char *c)
Definition Config.cpp:1257
std::string format(const char *fmt, TArgs &&... args)
Definition format.hpp:45
static const char * skip_word(const char *c)
Definition Config.cpp:1251
#define _u8L(s)
Definition I18N.hpp:11

References _u8L, Slic3r::format(), handle_legacy_composite(), load_from_gcode_string_legacy(), set_deserialize(), Slic3r::skip_whitespaces(), Slic3r::skip_word(), SLIC3R_APP_FULL_NAME, and Slic3r::ConfigSubstitutionContext::substitutions.

Referenced by Slic3r::PresetBundle::config_from_gcode(), load(), and Slic3r::GCodeProcessor::process_file().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ load_from_gcode_string_legacy()

size_t Slic3r::ConfigBase::load_from_gcode_string_legacy ( ConfigBase & config,
const char * str,
ConfigSubstitutionContext & substitutions )
staticinherited
1265{
1266 if (str == nullptr)
1267 return 0;
1268
1269 // BBS. Remove line numbers.
1270 std::regex match_pattern("\nN[0-9]* *");
1271 std::string replace_pattern = "\n";
1272 char* result = (char*)calloc(strlen(str) + 1, 1);
1273 std::regex_replace(result, str, str + strlen(str), match_pattern, replace_pattern);
1274
1275 // Walk line by line in reverse until a non-configuration key appears.
1276 const char *data_start = result;
1277 data_start = skip_whitespaces(data_start);
1278 if (std::toupper(*data_start) == 'N')
1279 data_start = skip_word(data_start);
1280
1281 // boost::nowide::ifstream seems to cook the text data somehow, so less then the 64k of characters may be retrieved.
1282 const char *end = data_start + strlen(data_start);
1283 size_t num_key_value_pairs = 0;
1284 for (;;) {
1285 // Extract next line.
1286 for (--end; end > data_start && (*end == '\r' || *end == '\n'); --end);
1287 if (end == data_start)
1288 break;
1289 const char *start = end ++;
1290 for (; start > data_start && *start != '\r' && *start != '\n'; --start);
1291 if (start == data_start)
1292 break;
1293 // Extracted a line from start to end. Extract the key = value pair.
1294 if (end - (++ start) < 10 || start[0] != ';' || start[1] != ' ')
1295 break;
1296 const char *key = start + 2;
1297 if (!((*key >= 'a' && *key <= 'z') || (*key >= 'A' && *key <= 'Z')))
1298 // A key must start with a letter.
1299 break;
1300 const char *sep = key;
1301 for (; sep != end && *sep != '='; ++ sep) ;
1302 if (sep == end || sep[-1] != ' ' || sep[1] != ' ')
1303 break;
1304 const char *value = sep + 2;
1305 if (value > end)
1306 break;
1307 const char *key_end = sep - 1;
1308 if (key_end - key < 3)
1309 break;
1310 // The key may contain letters, digits and underscores.
1311 for (const char *c = key; c != key_end; ++ c)
1312 if (!((*c >= 'a' && *c <= 'z') || (*c >= 'A' && *c <= 'Z') || (*c >= '0' && *c <= '9') || *c == '_')) {
1313 key = nullptr;
1314 break;
1315 }
1316 if (key == nullptr)
1317 break;
1318 try {
1319 config.set_deserialize(std::string(key, key_end), std::string(value, end), substitutions);
1320 ++num_key_value_pairs;
1321 }
1322 catch (UnknownOptionException & /* e */) {
1323 // ignore
1324 }
1325 end = start;
1326 }
1327
1328 // Do legacy conversion on a completely loaded dictionary.
1329 // Perform composite conversions, for example merging multiple keys into one key.
1330 config.handle_legacy_composite();
1331
1332 free(result);
1333 return num_key_value_pairs;
1334}
T * end(Slic3r::Mat< N, M, T > &mat)
Definition Point.hpp:841

References ConfigBase(), handle_legacy_composite(), set_deserialize(), Slic3r::skip_whitespaces(), and Slic3r::skip_word().

Referenced by Slic3r::_3MF_Importer::_extract_print_config_from_archive(), Slic3r::_BBS_3MF_Importer::_extract_print_config_from_archive(), load_from_gcode_file(), and Slic3r::load_from_superslicer_gcode_file().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ load_from_ini()

ConfigSubstitutions Slic3r::ConfigBase::load_from_ini ( const std::string & file,
ForwardCompatibilitySubstitutionRule compatibility_rule )
inherited
1170{
1171 try {
1172 boost::property_tree::ptree tree;
1173 boost::nowide::ifstream ifs(file);
1174 boost::property_tree::read_ini(ifs, tree);
1175 return this->load(tree, compatibility_rule);
1176 } catch (const ConfigurationError &e) {
1177 throw ConfigurationError(format(_u8L("Failed loading configuration file \"%1%\": %2%"), file, e.what()));
1178 }
1179}
ConfigSubstitutions load(const std::string &file, ForwardCompatibilitySubstitutionRule compatibility_rule)
Definition Config.cpp:845

References _u8L, Slic3r::format(), and load().

Referenced by Slic3r::_BBS_3MF_Importer::_extract_project_embedded_presets_from_archive().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ load_from_ini_string()

ConfigSubstitutions Slic3r::ConfigBase::load_from_ini_string ( const std::string & data,
ForwardCompatibilitySubstitutionRule compatibility_rule )
inherited
1182{
1183 boost::property_tree::ptree tree;
1184 std::istringstream iss(data);
1185 boost::property_tree::read_ini(iss, tree);
1186 return this->load(tree, compatibility_rule);
1187}

References load().

Referenced by Slic3r::GUI::Plater::priv::load_files(), and load_from_ini_string_commented().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ load_from_ini_string_commented()

ConfigSubstitutions Slic3r::ConfigBase::load_from_ini_string_commented ( std::string && data,
ForwardCompatibilitySubstitutionRule compatibility_rule )
inherited
1192{
1193 // Convert the "data" string into INI format by removing the semi-colons at the start of a line.
1194 // Also the "; generated by PrusaSlicer ..." comment line will be removed.
1195 size_t j = 0;
1196 for (size_t i = 0; i < data.size();)
1197 if (i == 0 || data[i] == '\n') {
1198 // Start of a line.
1199 if (data[i] == '\n') {
1200 // Consume LF, don't keep empty lines.
1201 if (j > 0 && data[j - 1] != '\n')
1202 data[j ++] = data[i];
1203 ++ i;
1204 }
1205 // Skip all leading spaces;
1206 for (; i < data.size() && (data[i] == ' ' || data[i] == '\t'); ++ i) ;
1207 // Skip the semicolon (comment indicator).
1208 if (i < data.size() && data[i] == ';')
1209 ++ i;
1210 // Skip all leading spaces after semicolon.
1211 for (; i < data.size() && (data[i] == ' ' || data[i] == '\t'); ++ i) ;
1212 if (strncmp(data.data() + i, "generated by ", 13) == 0) {
1213 // Skip the "; generated by ..." line.
1214 for (; i < data.size() && data[i] != '\n'; ++ i);
1215 }
1216 } else if (data[i] == '\r' && i + 1 < data.size() && data[i + 1] == '\n') {
1217 // Skip CR.
1218 ++ i;
1219 } else {
1220 // Consume the rest of the data.
1221 data[j ++] = data[i ++];
1222 }
1223 data.erase(data.begin() + j, data.end());
1224
1225 return this->load_from_ini_string(data, compatibility_rule);
1226}
ConfigSubstitutions load_from_ini_string(const std::string &data, ForwardCompatibilitySubstitutionRule compatibility_rule)
Definition Config.cpp:1181

References load_from_ini_string().

Here is the call graph for this function:

◆ load_from_json() [1/2]

int Slic3r::ConfigBase::load_from_json ( const std::string & file,
ConfigSubstitutionContext & substitutions,
bool load_inherits_in_config,
std::map< std::string, std::string > & key_values,
std::string & reason )
inherited
872{
873 json j;
874 std::list<std::string> different_settings_append;
875 std::string new_support_style;
876 std::string is_infill_first;
877 std::string get_wall_sequence;
878 bool is_project_settings = false;
879
880 CNumericLocalesSetter locales_setter;
881
882 std::function<bool(const json::const_iterator&, const char,const char,const bool,std::string&)> parse_str_arr = [&parse_str_arr](const json::const_iterator& it, const char single_sep,const char array_sep,const bool escape_string_style,std::string& value_str)->bool {
883 // must have consistent type name
884 std::string consistent_type;
885 for (auto iter = it.value().begin(); iter != it.value().end(); ++iter) {
886 if (consistent_type.empty())
887 consistent_type = iter.value().type_name();
888 else {
889 if (consistent_type != iter.value().type_name())
890 return false;
891 }
892 }
893
894 bool first = true;
895 for (auto iter = it.value().begin(); iter != it.value().end(); iter++) {
896 if (iter.value().is_array()) {
897 if (!first)
898 value_str += array_sep;
899 else
900 first = false;
901 bool success = parse_str_arr(iter, single_sep, array_sep,escape_string_style, value_str);
902 if (!success)
903 return false;
904 }
905 else if (iter.value().is_string()) {
906 if (!first)
907 value_str += single_sep;
908 else
909 first = false;
910 if (!escape_string_style)
911 value_str += iter.value();
912 else {
913 value_str += "\"";
914 value_str += escape_string_cstyle(iter.value());
915 value_str += "\"";
916 }
917 }
918 else {
919 //should not happen
920 return false;
921 }
922 }
923 return true;
924 };
925
926 try {
927 boost::nowide::ifstream ifs(file);
928 ifs >> j;
929 ifs.close();
930
931 const ConfigDef* config_def = this->def();
932 if (config_def == nullptr) {
933 BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << ": no config defs!";
934 return -1;
935 }
936 //parse the json elements
937 for (auto it = j.begin(); it != j.end(); it++) {
938 if (ascii_iequals(it.key(), BBL_JSON_KEY_VERSION)) {
939 key_values.emplace(BBL_JSON_KEY_VERSION, it.value());
940 }
941 else if (ascii_iequals(it.key(), BBL_JSON_KEY_IS_CUSTOM)) {
942 //skip it
943 }
944 else if (ascii_iequals(it.key(), BBL_JSON_KEY_NAME)) {
945 key_values.emplace(BBL_JSON_KEY_NAME, it.value());
946 if (it.value() == "project_settings")
947 is_project_settings = true;
948 }
949 else if (ascii_iequals(it.key(), BBL_JSON_KEY_URL)) {
950 key_values.emplace(BBL_JSON_KEY_URL, it.value());
951 }
952 else if (ascii_iequals(it.key(), BBL_JSON_KEY_TYPE)) {
953 key_values.emplace(BBL_JSON_KEY_TYPE, it.value());
954 }
955 else if (ascii_iequals(it.key(), BBL_JSON_KEY_SETTING_ID)) {
956 key_values.emplace(BBL_JSON_KEY_SETTING_ID, it.value());
957 }
958 else if (ascii_iequals(it.key(), BBL_JSON_KEY_FILAMENT_ID)) {
959 key_values.emplace(BBL_JSON_KEY_FILAMENT_ID, it.value());
960 }
961 else if (ascii_iequals(it.key(), BBL_JSON_KEY_FROM)) {
962 key_values.emplace(BBL_JSON_KEY_FROM, it.value());
963 }
964 else if (ascii_iequals(it.key(), BBL_JSON_KEY_DESCRIPTION)) {
965 key_values.emplace(BBL_JSON_KEY_DESCRIPTION, it.value());
966 }
967 else if (ascii_iequals(it.key(), BBL_JSON_KEY_INSTANTIATION)) {
968 key_values.emplace(BBL_JSON_KEY_INSTANTIATION, it.value());
969 }
970 else if (!load_inherits_to_config && ascii_iequals(it.key(), BBL_JSON_KEY_INHERITS)) {
971 key_values.emplace(BBL_JSON_KEY_INHERITS, it.value());
972 }
973 else if (!load_inherits_to_config && ascii_iequals(it.key(), BBL_JSON_KEY_INCLUDES)) {
974 key_values.emplace(BBL_JSON_KEY_INCLUDES, it.value().dump());
975 } else if (ascii_iequals(it.key(), ORCA_JSON_KEY_RENAMED_FROM)) {
976 key_values.emplace(ORCA_JSON_KEY_RENAMED_FROM, it.value());
977 } else {
978 t_config_option_key opt_key = it.key();
979 std::string value_str;
980
981 if (it.value().is_string()) {
982 //bool test1 = (it.key() == std::string("end_gcode"));
983 this->set_deserialize(opt_key, it.value(), substitution_context);
984 //some logic for special values
985 if (opt_key == "support_type") {
986 //std::string new_value = dynamic_cast<ConfigOptionString*>(this->option(opt_key))->value;
987 if (it.value() == "hybrid(auto)") {
988 different_settings_append.push_back(opt_key);
989 different_settings_append.push_back("support_style");
990 new_support_style = "tree_hybrid";
991 }
992 } else if (opt_key == "wall_infill_order") {
993 //BBS: check wall_infill order to decide if it be different and append to diff_setting_append
994 if (it.value() == "outer wall/inner wall/infill" || it.value() == "infill/outer wall/inner wall" || it.value() == "inner-outer-inner wall/infill") {
995 get_wall_sequence = "wall_seq_diff_to_system";
996 }
997
998 if (it.value() == "infill/outer wall/inner wall" || it.value() == "infill/inner wall/outer wall") {
999 different_settings_append.push_back("is_infill_first");
1000 is_infill_first = "true";
1001 }
1002 }
1003 }
1004 else if (it.value().is_array()) {
1005 t_config_option_key opt_key_src = opt_key;
1006 this->handle_legacy(opt_key, value_str);
1007 if (opt_key.empty()) {
1008 //BBS: record these options
1009 substitution_context.unrecogized_keys.push_back(opt_key_src);
1010 continue;
1011 }
1012 bool valid = true, first = true;
1013 const ConfigOptionDef* optdef = config_def->get(opt_key);
1014 if (optdef == nullptr) {
1015 // If we didn't find an option, look for any other option having this as an alias.
1016 for (const auto& opt : config_def->options) {
1017 for (const t_config_option_key& opt_key2 : opt.second.aliases) {
1018 if (opt_key2 == opt_key) {
1019 opt_key = opt.first;
1020 optdef = &opt.second;
1021 break;
1022 }
1023 }
1024 if (optdef != nullptr)
1025 break;
1026 }
1027 }
1028
1029 char single_sep = ',';
1030 char array_sep = '#'; // currenty not used
1031 bool escape_string_type = false;
1032 if (optdef) {
1033 switch (optdef->type)
1034 {
1035 case coStrings:
1036 escape_string_type = true;
1037 single_sep = ';';
1038 break;
1039 case coPointsGroups:
1040 single_sep = '#';
1041 break;
1042 default:
1043 break;
1044 }
1045 }
1046
1047 // BBS: we only support 2 depth array
1048 valid = parse_str_arr(it, single_sep, array_sep,escape_string_type, value_str);
1049 if (!valid) {
1050 BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << ": parse " << file << " error, invalid json array for " << it.key();
1051 break;
1052 }
1053 if (valid)
1054 this->set_deserialize(opt_key, value_str, substitution_context);
1055 }
1056 else {
1057 //should not happen
1058 BOOST_LOG_TRIVIAL(error) << __FUNCTION__<< ": parse "<<file<<" error, invalid json type for " << it.key();
1059 }
1060 }
1061 }
1062 if (!different_settings_append.empty()) {
1063 if (!new_support_style.empty()) {
1064 ConfigOptionEnum<SupportMaterialStyle>* opt = this->option<ConfigOptionEnum<SupportMaterialStyle>>("support_style", true);
1065 opt->value = smsTreeHybrid;
1066 }
1067
1068 if (!is_infill_first.empty()) {
1069 ConfigOptionBool *opt = this->option<ConfigOptionBool>("is_infill_first", true);
1070 opt->value = true;
1071 }
1072
1073 if (is_project_settings) {
1074 std::vector<std::string>& different_settings = this->option<ConfigOptionStrings>("different_settings_to_system", true)->values;
1075 size_t size = different_settings.size();
1076 if (size == 0) {
1077 const auto *filament_ids = this->option<ConfigOptionStrings>("filament_settings_id");
1078 size = (filament_ids ? filament_ids->values.size() : 0) + 2;
1079 different_settings.resize(size);
1080 }
1081
1082 std::vector<bool> is_first(size, false);
1083 std::vector<std::vector<std::string>> original_diffs(size);
1084 for (int index = 0; index < size; index++)
1085 {
1086 if (different_settings[index].empty()) {
1087 is_first[index] = true;
1088 }
1089 else {
1090 // remove unneeded key
1091 if (get_wall_sequence.empty()) {
1092 std::string wall_sqe_string = "wall_sequence";
1093 int pos=different_settings[index].find(wall_sqe_string);
1094
1095 if (pos != different_settings[index].npos) {
1096 int erase_len = wall_sqe_string.size();
1097 if (pos + erase_len < different_settings[index].size() && different_settings[index][pos + erase_len] == ';')
1098 erase_len++;
1099 different_settings[index].erase(pos, erase_len);
1100 }
1101
1102 }
1103
1104 if (different_settings[index].empty()) {
1105 is_first[index] = true;
1106 continue;
1107 }
1108
1109 Slic3r::unescape_strings_cstyle(different_settings[index], original_diffs[index]);
1110 }
1111 }
1112
1113 for (auto diff_key : different_settings_append)
1114 {
1115 //get the index in the group
1116 int index = 0;
1117 bool need_insert = true;
1118 if (diff_key == "support_type")
1119 index = 0;
1120 else if (diff_key == "support_style")
1121 index = 0;
1122 else if (diff_key == "is_infill_first")
1123 index = 0;
1124
1125 //check whether exist firstly
1126 if (!original_diffs[index].empty()) {
1127 for (int j = 0; j < original_diffs[index].size(); j++) {
1128 if (original_diffs[index][j] == diff_key) {
1129 need_insert = false;
1130 break;
1131 }
1132 }
1133 }
1134 if (!need_insert)
1135 continue;
1136
1137 //insert this key
1138 if (!is_first[index])
1139 different_settings[index] += ";";
1140 else
1141 is_first[index] = false;
1142 different_settings[index] += diff_key;
1143 }
1144 }
1145 }
1146
1147 // Do legacy conversion on a completely loaded dictionary.
1148 // Perform composite conversions, for example merging multiple keys into one key.
1150 return 0;
1151 }
1152 catch (const std::ifstream::failure &err) {
1153 BOOST_LOG_TRIVIAL(error) << __FUNCTION__<< ": parse "<<file<<" got a ifstream error, reason = " << err.what();
1154 reason = std::string("ifstreamError: ") + err.what();
1155 //throw ConfigurationError(format("Failed loading configuration file \"%1%\": %2%", file, e.what()));
1156 }
1157 catch(nlohmann::detail::parse_error &err) {
1158 BOOST_LOG_TRIVIAL(error) << __FUNCTION__<< ": parse "<<file<<" got a nlohmann::detail::parse_error, reason = " << err.what();
1159 reason = std::string("JsonParseError: ") + err.what();
1160 //throw ConfigurationError(format("Failed loading configuration file \"%1%\": %2%", file, err.what()));
1161 }
1162 catch(std::exception &err) {
1163 BOOST_LOG_TRIVIAL(error) << __FUNCTION__<< ": parse "<<file<<" got a generic exception, reason = " << err.what();
1164 reason = std::string("std::exception: ") + err.what();
1165 }
1166 return -1;
1167}
#define BBL_JSON_KEY_DESCRIPTION
Definition Preset.hpp:59
#define BBL_JSON_KEY_VERSION
Definition Preset.hpp:55
#define BBL_JSON_KEY_INCLUDES
Definition Preset.hpp:76
#define BBL_JSON_KEY_INSTANTIATION
Definition Preset.hpp:77
#define BBL_JSON_KEY_NAME
Definition Preset.hpp:58
#define BBL_JSON_KEY_URL
Definition Preset.hpp:57
#define BBL_JSON_KEY_TYPE
Definition Preset.hpp:66
#define BBL_JSON_KEY_IS_CUSTOM
Definition Preset.hpp:56
#define BBL_JSON_KEY_FROM
Definition Preset.hpp:67
#define ORCA_JSON_KEY_RENAMED_FROM
Definition Preset.hpp:96
#define BBL_JSON_KEY_FILAMENT_ID
Definition Preset.hpp:71
#define BBL_JSON_KEY_INHERITS
Definition Preset.hpp:75
#define BBL_JSON_KEY_SETTING_ID
Definition Preset.hpp:68
virtual void handle_legacy(t_config_option_key &, std::string &) const
Definition Config.hpp:2757
bool unescape_strings_cstyle(const std::string &str, std::vector< std::string > &out)
Definition Config.cpp:173
is_infill_first((ConfigOptionBool, small_area_infill_flow_compensation))((ConfigOptionEnum< WallDirection >
std::string escape_string_cstyle(const std::string &str)
Definition Config.cpp:76
nlohmann::json json
Definition AssembleList.cpp:42
@ smsTreeHybrid
Definition PrintConfig.hpp:363
@ coPointsGroups
Definition Config.hpp:217
@ coStrings
Definition Config.hpp:194
zaa_minimize_perimeter_height filament_ids((ConfigOptionStrings, filament_colour))((ConfigOptionStrings
bool ascii_iequals(std::string_view a, std::string_view b)
Definition Utils.hpp:306
bool empty(const BoundingBoxBase< PointType, PointsType > &bb)
Definition BoundingBox.hpp:273

References Slic3r::ascii_iequals(), BBL_JSON_KEY_DESCRIPTION, BBL_JSON_KEY_FILAMENT_ID, BBL_JSON_KEY_FROM, BBL_JSON_KEY_INCLUDES, BBL_JSON_KEY_INHERITS, BBL_JSON_KEY_INSTANTIATION, BBL_JSON_KEY_IS_CUSTOM, BBL_JSON_KEY_NAME, BBL_JSON_KEY_SETTING_ID, BBL_JSON_KEY_TYPE, BBL_JSON_KEY_URL, BBL_JSON_KEY_VERSION, Slic3r::coPointsGroups, Slic3r::coStrings, def(), Slic3r::empty(), Slic3r::escape_string_cstyle(), Slic3r::filament_ids(), Slic3r::ConfigDef::get(), handle_legacy(), handle_legacy_composite(), Slic3r::is_infill_first(), option(), Slic3r::ConfigDef::options, ORCA_JSON_KEY_RENAMED_FROM, set_deserialize(), Slic3r::smsTreeHybrid, Slic3r::ConfigOptionDef::type, Slic3r::unescape_strings_cstyle(), Slic3r::ConfigSubstitutionContext::unrecogized_keys, and Slic3r::ConfigOptionSingle< T >::value.

Referenced by Slic3r::_BBS_3MF_Importer::_extract_project_config_from_archive(), Slic3r::_BBS_3MF_Importer::_extract_project_embedded_presets_from_archive(), Slic3r::PresetBundle::import_json_presets(), load(), load_from_json(), Slic3r::PhysicalPrinterCollection::load_printers(), and Slic3r::PresetCollection::resolve_user_preset().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ load_from_json() [2/2]

ConfigSubstitutions Slic3r::ConfigBase::load_from_json ( const std::string & file,
ForwardCompatibilitySubstitutionRule compatibility_rule,
std::map< std::string, std::string > & key_values,
std::string & reason )
inherited
863{
864 int ret = 0;
865 ConfigSubstitutionContext substitutions_ctxt(compatibility_rule);
866
867 ret = load_from_json(file, substitutions_ctxt, true, key_values, reason);
868 return std::move(substitutions_ctxt.substitutions);
869}

References load_from_json(), and Slic3r::ConfigSubstitutionContext::substitutions.

Here is the call graph for this function:

◆ load_string_map()

ConfigSubstitutions Slic3r::ConfigBase::load_string_map ( std::map< std::string, std::string > & key_values,
ForwardCompatibilitySubstitutionRule compatibility_rule )
inherited
827{
828 CNumericLocalesSetter locales_setter;
829
830 ConfigSubstitutionContext substitutions_ctxt(compatibility_rule);
831 std::map<std::string, std::string>::iterator it;
832 for (it = key_values.begin(); it != key_values.end(); it++) {
833 try {
834 t_config_option_key opt_key = it->first;
835 this->set_deserialize(opt_key, it->second, substitutions_ctxt);
836 }
837 catch (UnknownOptionException& /* e */) {
838 // ignore
839 }
840 }
841 return std::move(substitutions_ctxt.substitutions);
842}

References set_deserialize(), and Slic3r::ConfigSubstitutionContext::substitutions.

Referenced by Slic3r::PresetCollection::load_user_preset().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ null_nullables()

void Slic3r::ConfigBase::null_nullables ( )
inherited
1617{
1618 for (const std::string &opt_key : this->keys()) {
1619 ConfigOption *opt = this->optptr(opt_key, false);
1620 assert(opt != nullptr);
1621 if (opt->nullable())
1622 opt->deserialize("nil", ForwardCompatibilitySubstitutionRule::Disable);
1623 }
1624}
virtual ConfigOption * optptr(const t_config_option_key &opt_key, bool create=false)=0
@ Disable
Definition Config.hpp:243

References Slic3r::Disable, keys(), and optptr().

Here is the call graph for this function:

◆ operator!=()

bool Slic3r::DynamicConfig::operator!= ( const DynamicConfig & rhs) const
inline
2980{ return ! (*this == rhs); }

References DynamicConfig().

Here is the call graph for this function:

◆ operator+=() [1/2]

DynamicConfig & Slic3r::DynamicConfig::operator+= ( const DynamicConfig & rhs)
inline
2944 {
2945 assert(this->def() == nullptr || this->def() == rhs.def());
2946 for (const auto &kvp : rhs.options) {
2947 auto it = this->options.find(kvp.first);
2948 if (it == this->options.end())
2949 this->options[kvp.first].reset(kvp.second->clone());
2950 else {
2951 assert(it->second->type() == kvp.second->type());
2952 if (it->second->type() == kvp.second->type())
2953 *it->second = *kvp.second;
2954 else
2955 it->second.reset(kvp.second->clone());
2956 }
2957 }
2958 return *this;
2959 }
const ConfigDef * def() const override
Definition Config.hpp:3006

References DynamicConfig(), def(), and options.

Here is the call graph for this function:

◆ operator+=() [2/2]

DynamicConfig & Slic3r::DynamicConfig::operator+= ( DynamicConfig && rhs)
inline
2964 {
2965 assert(this->def() == nullptr || this->def() == rhs.def());
2966 for (auto &kvp : rhs.options) {
2967 auto it = this->options.find(kvp.first);
2968 if (it == this->options.end()) {
2969 this->options.insert(std::make_pair(kvp.first, std::move(kvp.second)));
2970 } else {
2971 assert(it->second->type() == kvp.second->type());
2972 it->second = std::move(kvp.second);
2973 }
2974 }
2975 rhs.options.clear();
2976 return *this;
2977 }

References DynamicConfig(), and def().

Here is the call graph for this function:

◆ operator=() [1/2]

DynamicConfig & Slic3r::DynamicConfig::operator= ( const DynamicConfig & rhs)
inline
2922 {
2923 assert(this->def() == nullptr || this->def() == rhs.def());
2924 this->clear();
2925 for (const auto &kvp : rhs.options)
2926 this->options[kvp.first].reset(kvp.second->clone());
2927 return *this;
2928 }
void clear()
Definition Config.hpp:2987

References DynamicConfig(), clear(), def(), and options.

Referenced by Slic3r::DynamicPrintConfig::operator=(), and Slic3r::DynamicPrintConfig::operator=().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator=() [2/2]

DynamicConfig & Slic3r::DynamicConfig::operator= ( DynamicConfig && rhs)
inlinenoexcept
2933 {
2934 assert(this->def() == nullptr || this->def() == rhs.def());
2935 this->clear();
2936 this->options = std::move(rhs.options);
2937 rhs.options.clear();
2938 return *this;
2939 }

References DynamicConfig(), clear(), and def().

Here is the call graph for this function:

◆ operator==()

bool Slic3r::DynamicConfig::operator== ( const DynamicConfig & rhs) const
1696{
1697 auto it1 = this->options.begin();
1698 auto it1_end = this->options.end();
1699 auto it2 = rhs.options.begin();
1700 auto it2_end = rhs.options.end();
1701 for (; it1 != it1_end && it2 != it2_end; ++ it1, ++ it2)
1702 if (it1->first != it2->first || *it1->second != *it2->second)
1703 // key or value differ
1704 return false;
1705 return it1 == it1_end && it2 == it2_end;
1706}

References DynamicConfig(), and options.

Here is the call graph for this function:

◆ opt() [1/2]

template<class T>
const T * Slic3r::DynamicConfig::opt ( const t_config_option_key & opt_key) const
inline
3010 { return dynamic_cast<const T*>(this->option(opt_key)); }

References Slic3r::ConfigBase::option().

Here is the call graph for this function:

◆ opt() [2/2]

template<class T>
T * Slic3r::DynamicConfig::opt ( const t_config_option_key & opt_key,
bool create = false )
inline
3008 { return dynamic_cast<T*>(this->option(opt_key, create)); }

References Slic3r::ConfigBase::option().

Referenced by Slic3r::apply_to_print_region_config(), Slic3r::GUI::Sidebar::build_filament_ams_list(), Slic3r::GUI::PublishSettingsDialog::build_option_model(), Slic3r::GUI::CalibUtils::calib_pa_pattern(), Slic3r::PrinterPresetCollection::default_preset_for(), Slic3r::GUI::PartPlateList::delete_plate(), Slic3r::GUI::Bed3D::detect_type(), Slic3r::GUI::anonymous_namespace{PublishSettingsDialog.cpp}::filament_color_hex(), Slic3r::GUI::filament_color_picker_value(), Slic3r::gcode_add_line_number(), Slic3r::get_bed_excluded_regions_by_extruder(), Slic3r::get_bed_shape(), Slic3r::DynamicPrintConfig::get_filament_type(), Slic3r::GUI::Materials::get_filament_type(), Slic3r::DynamicPrintConfig::get_filament_vendor(), Slic3r::GUI::Materials::get_filament_vendor(), Slic3r::GUI::Materials::get_material_type(), Slic3r::GUI::Materials::get_material_vendor(), Slic3r::get_real_skirt_dist(), Slic3r::GUI::get_string_value(), Slic3r::GUI::GLCanvas3D::get_wipe_tower_info(), Slic3r::PrintConfigDef::handle_legacy_composite(), Slic3r::handle_legacy_sla(), Slic3r::has_bed_exclude_volumes(), Slic3r::GUI::GCodeViewer::init(), Slic3r::is_XL_printer(), keys(), Slic3r::PresetBundle::load_config_file_config(), Slic3r::GUI::Plater::priv::load_files(), Slic3r::GUI::PublishSettingsDialog::make_mixed_visual_spec(), Slic3r::make_publish_universal(), Slic3r::GUI::anonymous_namespace{PublishSettingsDialog.cpp}::material_identity(), Slic3r::GUI::anonymous_namespace{PublishSettingsDialog.cpp}::mixed_filament_blend_color(), Slic3r::GUI::anonymous_namespace{PublishSettingsDialog.cpp}::mixed_filament_chip_bitmap(), Slic3r::GUI::anonymous_namespace{PublishSettingsDialog.cpp}::mixed_filament_label(), Slic3r::GUI::anonymous_namespace{PublishSettingsDialog.cpp}::mixed_filament_tab_bitmap(), Slic3r::GUI::anonymous_namespace{PublishSettingsDialog.cpp}::mixed_slot_components(), Slic3r::DynamicPrintConfig::normalize_fdm(), Slic3r::DynamicPrintConfig::normalize_fdm_1(), optptr(), Slic3r::GUI::ArrangeJob::prepare_belt_regions(), Slic3r::GUI::CalibUtils::process_and_store_3mf(), Slic3r::GCodeProcessor::process_file(), Slic3r::GUI::anonymous_namespace{PublishSettingsDialog.cpp}::project_used_filament_slots(), Slic3r::ImexArrangeInput::read_config(), Slic3r::GUI::DesignCanvas::refresh_bed(), Slic3r::GUI::GCodeViewer::render_markers(), Slic3r::run_post_process_scripts(), Slic3r::GUI::set_arrange_polygon_bed_exclusion_extruders(), Slic3r::GUI::Plater::set_bed_shape(), Slic3r::GUI::PartPlateList::set_default_wipe_tower_pos_for_plate(), set_key_value(), Slic3r::DynamicPrintConfig::set_num_extruders(), Slic3r::DynamicPrintConfig::set_num_filaments(), Slic3r::GUI::sync_loaded_project_filament_config(), Slic3r::PresetUtils::system_printer_model(), Slic3r::GUI::anonymous_namespace{HintNotification.cpp}::tag_check_material(), Slic3r::DynamicPrintConfig::update_diff_values_to_child_config(), Slic3r::DynamicPrintConfig::update_non_diff_values_to_base_config(), Slic3r::GUI::DiffPresetDialog::update_tree(), Slic3r::GUI::UnsavedChangesDialog::update_tree(), Slic3r::DynamicPrintConfig::update_values_from_multi_to_multi(), Slic3r::DynamicPrintConfig::update_values_from_multi_to_multi_2(), Slic3r::DynamicPrintConfig::update_values_from_single_to_multi(), Slic3r::DynamicPrintConfig::update_values_to_printer_extruders(), and Slic3r::DynamicPrintConfig::validate().

Here is the call graph for this function:

◆ opt_bool() [1/2]

bool Slic3r::DynamicConfig::opt_bool ( const t_config_option_key & opt_key) const
inline
3072{ return this->option<ConfigOptionBool>(opt_key)->value != 0; }

References Slic3r::ConfigBase::option().

Referenced by Slic3r::_BBS_3MF_Exporter::_add_slice_info_config_file_to_archive(), Slic3r::GUI::ConfigOptionsGroup::get_config_value(), Slic3r::GUI::ConfigOptionsGroup::get_config_value2(), Slic3r::GUI::PartPlate::get_extruders(), Slic3r::GUI::PartPlate::get_extruders_under_cli(), Slic3r::GUI::OrientJob::get_orient_mesh(), Slic3r::GUI::GLGizmoFdmSupports::get_selection_support_threshold_angle(), Slic3r::GUI::PartPlate::get_spiral_vase_mode(), Slic3r::GUI::get_string_value(), Slic3r::PresetBundle::load_config_file_config(), Slic3r::GUI::MenuFactory::load_handy_model(), Slic3r::GUI::CalibrateFilamentComboBox::load_tray(), Slic3r::GUI::PartPlateList::notify_instance_update(), Slic3r::GUI::pad_combo_value_for_config(), Slic3r::GUI::ArrangeJob::prepare_belt_regions(), Slic3r::GUI::ArrangeJob::process(), Slic3r::GUI::FillBedJob::process(), Slic3r::GUI::anonymous_namespace{PublishSettingsDialog.cpp}::project_used_filament_slots(), Slic3r::GUI::Sidebar::should_show_SEMM_buttons(), anonymous_namespace{OrcaSlicer_profile_validator.cpp}::slice_all_printers(), anonymous_namespace{OrcaSlicer_profile_validator.cpp}::slice_two_color_cube_and_export(), Slic3r::GUI::support_combo_value_for_config(), Slic3r::GUI::ConfigManipulation::toggle_print_fff_options(), Slic3r::GUI::ConfigManipulation::toggle_print_sla_options(), and Slic3r::GUI::ConfigManipulation::update_print_fff_config().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ opt_bool() [2/2]

bool Slic3r::DynamicConfig::opt_bool ( const t_config_option_key & opt_key,
unsigned int idx ) const
2116 {
2117 if (const ConfigOptionBools *opts = dynamic_cast<const ConfigOptionBools *>(this->option(opt_key))) {
2118 return opts->get_at(idx) != 0;
2119 }
2120 else {
2121 const ConfigOptionBoolsNullable *opt_s = dynamic_cast<const ConfigOptionBoolsNullable *>(this->option(opt_key));
2122 assert(opt_s != nullptr);
2123 return opt_s->get_at(idx) != 0;
2124 }
2125}
ConfigOptionBoolsTempl< true > ConfigOptionBoolsNullable
Definition Config.hpp:2067
ConfigOptionBoolsTempl< false > ConfigOptionBools
Definition Config.hpp:2066

References Slic3r::ConfigOptionBoolsTempl< NULLABLE >::get_at(), and Slic3r::ConfigBase::option().

Here is the call graph for this function:

◆ opt_bool_nullable()

bool Slic3r::DynamicConfig::opt_bool_nullable ( const t_config_option_key & opt_key,
unsigned int idx ) const
inline
3074{ return dynamic_cast<const ConfigOptionBoolsNullable*>(this->option(opt_key))->get_at(idx);}

References Slic3r::ConfigBase::option().

Referenced by Slic3r::GUI::ConfigManipulation::toggle_print_fff_options().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ opt_enum() [1/2]

template<typename ENUM>
ENUM Slic3r::DynamicConfig::opt_enum ( const t_config_option_key & opt_key) const
inline
3066{ return static_cast<ENUM>(this->option(opt_key)->getInt()); }
virtual int getInt() const
Definition Config.hpp:294

References Slic3r::ConfigOption::getInt(), and Slic3r::ConfigBase::option().

Referenced by Slic3r::_BBS_3MF_Exporter::_add_slice_info_config_file_to_archive(), Slic3r::active_bed_exclude_volume_mode(), Slic3r::append_bed_exclude_volumes(), Slic3r::BackgroundSlicingProcess::apply(), Slic3r::GUI::PartPlateList::check_all_plate_local_bed_type(), Slic3r::GUI::collect_imex_warnings(), Slic3r::get_bed_excluded_regions_by_extruder(), Slic3r::GUI::PartPlate::get_bed_type(), Slic3r::get_instance_arrange_poly(), Slic3r::GLVolumeCollection::get_selection_support_normal_z(), Slic3r::GUI::GLGizmoFdmSupports::get_selection_support_threshold_angle(), Slic3r::has_bed_exclude_volumes(), Slic3r::GUI::PartPlateList::notify_instance_update(), Slic3r::GUI::Plater::on_config_change(), Slic3r::GUI::GLGizmoBrimEars::on_render_input_window(), Slic3r::GUI::GLGizmoFuzzySkin::on_render_input_window(), Slic3r::GUI::Plater::priv::on_select_bed_type(), Slic3r::GUI::ArrangeJob::prepare_belt_regions(), Slic3r::GUI::PartPlate::render_logo(), Slic3r::GUI::PartPlate::set_bed_type(), Slic3r::Model::setExtruderParams(), Slic3r::GUI::TabFilament::toggle_options(), Slic3r::GUI::ConfigManipulation::toggle_print_fff_options(), Slic3r::GUI::TabPrintPlate::update_custom_dirty(), Slic3r::GUI::TabPrintModel::update_model_config(), and Slic3r::GUI::ConfigManipulation::update_print_fff_config().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ opt_enum() [2/2]

int Slic3r::DynamicConfig::opt_enum ( const t_config_option_key & opt_key,
unsigned int idx ) const
inline
3068{ return dynamic_cast<const ConfigOptionEnumsGeneric*>(this->option(opt_key))->get_at(idx); }
ConfigOptionEnumsGenericTempl< false > ConfigOptionEnumsGeneric
Definition Config.hpp:2311

References Slic3r::ConfigBase::option().

Here is the call graph for this function:

◆ opt_enum_nullable()

int Slic3r::DynamicConfig::opt_enum_nullable ( const t_config_option_key & opt_key,
unsigned int idx ) const
inline
3069{ return dynamic_cast<const ConfigOptionEnumsGenericNullable*>(this->option(opt_key))->get_at(idx); }
ConfigOptionEnumsGenericTempl< true > ConfigOptionEnumsGenericNullable
Definition Config.hpp:2312

References Slic3r::ConfigBase::option().

Here is the call graph for this function:

◆ opt_float() [1/4]

double & Slic3r::DynamicConfig::opt_float ( const t_config_option_key & opt_key)
inline
3047{ return this->option<ConfigOptionFloat>(opt_key)->value; }

References Slic3r::ConfigBase::option().

Referenced by Slic3r::GUI::change_opt_value(), Slic3r::GUI::ConfigManipulation::check_filament_max_volumetric_speed(), Slic3r::GUI::ConfigManipulation::check_layer_height(), Slic3r::GUI::ensure_belt_purge_tower(), Slic3r::GUI::ConfigOptionsGroup::get_config_value(), Slic3r::GUI::ConfigOptionsGroup::get_config_value2(), Slic3r::GUI::get_max_layer_height(), Slic3r::GUI::get_min_layer_height(), Slic3r::get_real_skirt_dist(), Slic3r::GUI::get_string_value(), Slic3r::Slicing::max_layer_height_from_nozzle(), Slic3r::Slicing::min_layer_height_from_nozzle(), Slic3r::GUI::GLCanvas3D::CenterOfMass::model_markers(), anonymous_namespace{OrcaSlicer_profile_validator.cpp}::place_wipe_tower(), Slic3r::GUI::ArrangeJob::prepare_belt_regions(), Slic3r::GUI::CalibUtils::process_and_store_3mf(), Slic3r::ImexArrangeInput::read_config(), Slic3r::CLI::run(), Slic3r::GUI::Selection::scale_to_fit_print_volume(), anonymous_namespace{OrcaSlicer_profile_validator.cpp}::slice_two_color_cube_and_export(), Slic3r::GUI::ConfigManipulation::toggle_print_fff_options(), Slic3r::PresetBundle::update_compatible(), Slic3r::GUI::ConfigManipulation::update_print_fff_config(), and Slic3r::GUI::ConfigManipulation::update_print_sla_config().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ opt_float() [2/4]

const double & Slic3r::DynamicConfig::opt_float ( const t_config_option_key & opt_key) const
inline
3048{ return dynamic_cast<const ConfigOptionFloat*>(this->option(opt_key))->value; }

References Slic3r::ConfigBase::option().

Here is the call graph for this function:

◆ opt_float() [3/4]

double & Slic3r::DynamicConfig::opt_float ( const t_config_option_key & opt_key,
unsigned int idx )
2094{
2095 if (ConfigOptionFloats *opt_floats = dynamic_cast<ConfigOptionFloats *>(this->option(opt_key))) {
2096 return opt_floats->get_at(idx);
2097 } else {
2098 ConfigOptionFloatsNullable *opt_floats_nullable = dynamic_cast<ConfigOptionFloatsNullable *>(this->option(opt_key));
2099 assert(opt_floats_nullable != nullptr);
2100 return opt_floats_nullable->get_at(idx);
2101 }
2102}
ConfigOptionFloatsTempl< true > ConfigOptionFloatsNullable
Definition Config.hpp:1016

References Slic3r::ConfigOptionVector< double >::get_at(), and Slic3r::ConfigBase::option().

Here is the call graph for this function:

◆ opt_float() [4/4]

const double & Slic3r::DynamicConfig::opt_float ( const t_config_option_key & opt_key,
unsigned int idx ) const
2104{
2105 if (const ConfigOptionFloats *opt_floats = dynamic_cast<const ConfigOptionFloats *>(this->option(opt_key))) {
2106 return opt_floats->get_at(idx);
2107 } else if (const ConfigOptionFloatsNullable *opt_floats_nullable = dynamic_cast<const ConfigOptionFloatsNullable *>(this->option(opt_key))) {
2108 return opt_floats_nullable->get_at(idx);
2109 } else {
2110 assert(false);
2111 static const double zero = 0.0;
2112 return zero;
2113 }
2114}

References Slic3r::ConfigBase::option().

Here is the call graph for this function:

◆ opt_float_nullable() [1/2]

double & Slic3r::DynamicConfig::opt_float_nullable ( const t_config_option_key & opt_key,
unsigned int idx )
inline
3051{ return this->option<ConfigOptionFloatsNullable>(opt_key)->get_at(idx); }

References Slic3r::ConfigBase::option().

Referenced by Slic3r::GUI::CalibUtils::calib_flowrate(), Slic3r::Model::setPrintSpeedTable(), and Slic3r::GUI::ConfigManipulation::toggle_print_fff_options().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ opt_float_nullable() [2/2]

const double & Slic3r::DynamicConfig::opt_float_nullable ( const t_config_option_key & opt_key,
unsigned int idx ) const
inline
3052{ return dynamic_cast<const ConfigOptionFloatsNullable *>(this->option(opt_key))->get_at(idx); }

References Slic3r::ConfigBase::option().

Here is the call graph for this function:

◆ opt_float_or_percent_nullable() [1/2]

FloatOrPercent & Slic3r::DynamicConfig::opt_float_or_percent_nullable ( const t_config_option_key & opt_key,
unsigned int idx )
inline
3053{ return this->option<ConfigOptionFloatsOrPercentsNullable>(opt_key)->get_at(idx); }

References Slic3r::ConfigBase::option().

Here is the call graph for this function:

◆ opt_float_or_percent_nullable() [2/2]

const FloatOrPercent & Slic3r::DynamicConfig::opt_float_or_percent_nullable ( const t_config_option_key & opt_key,
unsigned int idx ) const
inline
3054{ return dynamic_cast<const ConfigOptionFloatsOrPercentsNullable *>(this->option(opt_key))->get_at(idx); }
ConfigOptionFloatsOrPercentsTempl< true > ConfigOptionFloatsOrPercentsNullable
Definition Config.hpp:1532

References Slic3r::ConfigBase::option().

Here is the call graph for this function:

◆ opt_int() [1/4]

int & Slic3r::DynamicConfig::opt_int ( const t_config_option_key & opt_key)
inline
3056{ return this->option<ConfigOptionInt>(opt_key)->value; }

References Slic3r::ConfigBase::option().

Referenced by Slic3r::GUI::ConfigManipulation::check_nozzle_temperature_initial_layer_range(), Slic3r::GUI::ConfigManipulation::check_nozzle_temperature_range(), Slic3r::GUI::ConfigOptionsGroup::get_config_value(), Slic3r::GUI::ConfigOptionsGroup::get_config_value2(), Slic3r::GUI::PartPlate::get_extruders(), Slic3r::GUI::PartPlate::get_extruders_under_cli(), Slic3r::get_instance_arrange_poly(), Slic3r::GUI::PartPlate::get_object_filament_extruders(), Slic3r::GUI::OrientJob::get_orient_mesh(), Slic3r::get_real_skirt_dist(), Slic3r::GLVolumeCollection::get_selection_support_normal_z(), Slic3r::GUI::GLGizmoFdmSupports::get_selection_support_threshold_angle(), Slic3r::GUI::get_string_value(), Slic3r::GUI::ConfigManipulation::get_temperature_range(), Slic3r::GUI::PresetComboBox::get_tooltip(), Slic3r::GUI::is_same_nozzle_type(), Slic3r::GUI::PartPlateList::notify_instance_update(), Slic3r::GUI::anonymous_namespace{PublishSettingsDialog.cpp}::project_used_filament_slots(), Slic3r::Model::setExtruderParams(), Slic3r::GUI::ConfigManipulation::toggle_print_fff_options(), Slic3r::GLVolumeCollection::update_colors_by_extruder(), and Slic3r::GUI::ConfigManipulation::update_print_fff_config().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ opt_int() [2/4]

int Slic3r::DynamicConfig::opt_int ( const t_config_option_key & opt_key) const
inline
3057{ return dynamic_cast<const ConfigOptionInt*>(this->option(opt_key))->value; }

References Slic3r::ConfigBase::option().

Here is the call graph for this function:

◆ opt_int() [3/4]

int & Slic3r::DynamicConfig::opt_int ( const t_config_option_key & opt_key,
unsigned int idx )
inline
3058{ return this->option<ConfigOptionInts>(opt_key)->get_at(idx); }

References Slic3r::ConfigBase::option().

Here is the call graph for this function:

◆ opt_int() [4/4]

int Slic3r::DynamicConfig::opt_int ( const t_config_option_key & opt_key,
unsigned int idx ) const
inline
3059{ return dynamic_cast<const ConfigOptionInts*>(this->option(opt_key))->get_at(idx); }
ConfigOptionIntsTempl< false > ConfigOptionInts
Definition Config.hpp:1154

References Slic3r::ConfigBase::option().

Here is the call graph for this function:

◆ opt_int_nullable() [1/2]

int & Slic3r::DynamicConfig::opt_int_nullable ( const t_config_option_key & opt_key,
unsigned int idx )
inline
3060{ return this->option<ConfigOptionIntsNullable>(opt_key)->get_at(idx);}

References Slic3r::ConfigBase::option().

Here is the call graph for this function:

◆ opt_int_nullable() [2/2]

const int & Slic3r::DynamicConfig::opt_int_nullable ( const t_config_option_key & opt_key,
unsigned int idx ) const
inline
3061{ return dynamic_cast<const ConfigOptionIntsNullable*>(this->option(opt_key))->get_at(idx);}
ConfigOptionIntsTempl< true > ConfigOptionIntsNullable
Definition Config.hpp:1155

References Slic3r::ConfigBase::option().

Here is the call graph for this function:

◆ opt_serialize()

std::string Slic3r::ConfigBase::opt_serialize ( const t_config_option_key & opt_key) const
inherited
567{
568 const ConfigOption* opt = this->option(opt_key);
569 assert(opt != nullptr);
570 return opt->serialize();
571}

References option().

Referenced by Slic3r::_3MF_Exporter::_add_print_config_file_to_archive(), Slic3r::_BBS_3MF_Exporter::_add_print_config_file_to_archive(), Slic3r::GCode::_do_export(), Slic3r::GCode::append_full_config(), Slic3r::config_value_or_none(), Slic3r::GUI::Plater::export_published_3mf(), and save().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ opt_string() [1/4]

const std::string & Slic3r::DynamicConfig::opt_string ( const t_config_option_key & opt_key) const
inline
3043{ return const_cast<DynamicConfig*>(this)->opt_string(opt_key); }
std::string & opt_string(const t_config_option_key &opt_key, bool create=false)
Definition Config.hpp:3042

References DynamicConfig(), and opt_string().

Referenced by opt_string().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ opt_string() [2/4]

std::string & Slic3r::DynamicConfig::opt_string ( const t_config_option_key & opt_key,
bool create = false )
inline
3042{ return this->option<ConfigOptionString>(opt_key, create)->value; }

References Slic3r::ConfigBase::option().

Referenced by Slic3r::_BBS_3MF_Exporter::_add_custom_gcode_per_print_z_file_to_archive(), Slic3r::GUI::PresetComboBox::add_connected_printers(), Slic3r::append_printer_bed_assets(), Slic3r::GUI::ConfigOptionsGroup::back_to_config_value(), Slic3r::anonymous_namespace{SnapmakerPrinterAgent.cpp}::find_closest_color_preset_by_vendor_and_type(), Slic3r::GUI::Plater::force_filament_colors_update(), Slic3r::GUI::gcode(), Slic3r::GUI::PresetComboBox::get_bmp(), Slic3r::GUI::ConfigOptionsGroup::get_config_value(), Slic3r::GUI::ConfigOptionsGroup::get_config_value2(), Slic3r::PresetBundle::get_custom_vendor_models(), Slic3r::ElegooLink::get_print_host_webui(), Slic3r::PrintHost::get_print_host_webui(), Slic3r::GUI::CalibrationPresetPage::get_print_preset(), Slic3r::PresetBundle::get_similar_printer_preset(), Slic3r::GUI::get_string_value(), Slic3r::PrintConfigDef::handle_legacy_composite(), Slic3r::GUI::ObjectTablePanel::init_filaments_and_colors(), Slic3r::GUI::is_same_nozzle_type(), Slic3r::PresetBundle::load_config_file_config(), Slic3r::GUI::Plater::priv::load_files(), Slic3r::PhysicalPrinterCollection::load_printers_from_presets(), Slic3r::PresetBundle::load_selections(), Slic3r::GUI::CalibrateFilamentComboBox::load_tray(), Slic3r::anonymous_namespace{ElegooLink.cpp}::lookup_cc2_serial(), Slic3r::PrintBase::output_filename(), Slic3r::anonymous_namespace{PresetBundle.cpp}::printer_kept_bed_paths(), Slic3r::GUI::CalibUtils::process_and_store_3mf(), Slic3r::PresetBundle::resolve_vendor_preset(), Slic3r::CLI::run(), Slic3r::GUI::GUI_App::select_machine(), anonymous_namespace{OrcaSlicer_profile_validator.cpp}::select_printer_default_presets(), Slic3r::Model::setExtruderParams(), anonymous_namespace{OrcaSlicer_profile_validator.cpp}::slice_all_printers(), anonymous_namespace{OrcaSlicer_profile_validator.cpp}::slice_two_color_cube_and_export(), Slic3r::GUI::Sidebar::priv::switch_diameter_to(), Slic3r::GUI::GUI_App::switch_printer_agent(), Slic3r::GUI::TabSLAMaterial::toggle_options(), Slic3r::GUI::ConfigManipulation::toggle_print_fff_options(), Slic3r::GUI::PlaterPresetComboBox::update(), Slic3r::GLVolumeCollection::update_colors_by_extruder(), Slic3r::PresetBundle::update_compatible(), Slic3r::GUI::Tab::update_preset_description_line(), Slic3r::GUI::Sidebar::update_presets(), and Slic3r::GUI::Sidebar::update_printer_thumbnail().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ opt_string() [3/4]

std::string & Slic3r::DynamicConfig::opt_string ( const t_config_option_key & opt_key,
unsigned int idx )
inline
3044{ return this->option<ConfigOptionStrings>(opt_key)->get_at(idx); }

References Slic3r::ConfigBase::option().

Here is the call graph for this function:

◆ opt_string() [4/4]

const std::string & Slic3r::DynamicConfig::opt_string ( const t_config_option_key & opt_key,
unsigned int idx ) const
inline
3045{ return const_cast<DynamicConfig*>(this)->opt_string(opt_key, idx); }

References DynamicConfig(), and opt_string().

Referenced by opt_string().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ option() [1/3]

const ConfigOption * Slic3r::ConfigOptionResolver::option ( const t_config_option_key & opt_key) const
inlineinherited
2699{ return this->optptr(opt_key); }

◆ option() [2/3]

template<typename TYPE>
TYPE * Slic3r::ConfigBase::option ( const t_config_option_key & opt_key,
bool create = false )
inlineinherited
2773 {
2774 ConfigOption* opt = this->optptr(opt_key, create);
2775 if (opt != nullptr && opt->type() != TYPE::static_type()) {
2776 BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << ": attempt to access option with wrong type: " << opt_key;
2777 return nullptr;
2778 }
2779 return static_cast<TYPE*>(opt);
2780 }

References optptr().

Here is the call graph for this function:

◆ option() [3/3]

ConfigOption * Slic3r::ConfigBase::option ( const t_config_option_key & opt_key,
bool create = false )
inlineinherited
2769 { return this->optptr(opt_key, create); }

References optptr().

Referenced by Slic3r::DynamicConfig::DynamicConfig(), Slic3r::Flashforge::Flashforge(), Slic3r::_BBS_3MF_Exporter::_add_model_config_file_to_archive(), Slic3r::_BBS_3MF_Exporter::_add_slice_info_config_file_to_archive(), Slic3r::_BBS_3MF_Importer::_extract_project_config_from_archive(), Slic3r::_BBS_3MF_Importer::_extract_project_embedded_presets_from_archive(), Slic3r::GUI::GLCanvas3D::_render_arrange_menu(), Slic3r::active_capability_config(), Slic3r::GUI::PresetComboBox::add_ams_filaments(), Slic3r::GUI::ObjectList::add_category_to_settings_from_frequent(), Slic3r::GUI::ObjectList::add_category_to_settings_from_selection(), Slic3r::add_correct_opts_to_diff(), Slic3r::GUI::ObjectSettings::add_missed_options(), Slic3r::GUI::ObjectTableSettings::add_missed_options(), Slic3r::append_bed_exclude_volumes(), Slic3r::GCode::append_full_config(), Slic3r::GUI::MenuFactory::append_menu_items_flush_options(), Slic3r::Search::SettingsIndex::append_options(), Slic3r::WipeTowerIntegration::append_tcr(), Slic3r::GUI::ConfigManipulation::apply(), Slic3r::Print::apply(), Slic3r::SLAPrint::apply(), Slic3r::GCodeProcessor::apply_config(), Slic3r::GUI::ConfigWizard::priv::apply_config(), Slic3r::PlaceholderParser::apply_config(), Slic3r::apply_first_layer_order(), Slic3r::GUI::ConfigManipulation::apply_null_fff_config(), apply_only(), Slic3r::PlaceholderParser::apply_only(), Slic3r::GUI::GLCanvas3D::WipeTowerInfo::apply_wipe_tower(), Slic3r::GUI::ConfigOptionsGroup::back_to_config_value(), Slic3r::GUI::PartPlate::belt_open_y(), Slic3r::GUI::PartPlate::build_imex_cache_key(), Slic3r::GUI::SelectMachineDialog::build_nozzles_info(), Slic3r::GUI::SyncAmsInfoDialog::build_nozzles_info(), Slic3r::GUI::PublishSettingsDialog::build_option_model(), Slic3r::GUI::build_plate_tilt_up_direction(), Slic3r::GUI::TabPrinter::cache_extruder_cnt(), Slic3r::GUI::PartPlate::calc_imex_zones(), Slic3r::GUI::CalibUtils::calib_flowrate(), Slic3r::GUI::CalibUtils::calib_max_vol_speed(), Slic3r::GUI::CalibUtils::calib_pa_pattern(), Slic3r::cfg_bool(), Slic3r::cfg_float(), Slic3r::Search::change_opt_key(), Slic3r::GUI::change_opt_value(), Slic3r::GUI::ConfigManipulation::check_adaptive_pressure_advance_model(), Slic3r::GUI::Plater::priv::check_ams_status_impl(), Slic3r::GUI::ConfigManipulation::check_chamber_minimal_temperature(), Slic3r::GUI::ConfigManipulation::check_chamber_temperature(), Slic3r::GUI::ConfigManipulation::check_filament_ironing_spacing(), Slic3r::check_filaments_printable(), Slic3r::GUI::ConfigManipulation::check_nozzle_recommended_temperature_range(), Slic3r::PresetBundle::check_preset_references(), Slic3r::GUI::collect_imex_warnings(), collect_plugin_manifest(), Slic3r::Preset::compatible_printers_condition(), Slic3r::Preset::compatible_prints_condition(), Slic3r::compute_filament_override_value(), Slic3r::compute_imex_zone_layout(), Slic3r::PresetBundle::config_from_gcode(), Slic3r::GUI::construct_extruder_unprintable_error(), Slic3r::PresetBundle::construct_full_config(), Slic3r::GUI::ObjectGridTable::construct_object_configs(), Slic3r::GUI::CreateFilamentPresetDialog::create_filament_preset_item(), Slic3r::GUI::GLGizmoRotate3D::data_changed(), Slic3r::deep_diff(), Slic3r::GUI::Bed3D::detect_type(), diff(), Slic3r::GUI::GLCanvas3D::do_move(), Slic3r::effective_physical_extruder_map(), Slic3r::GUI::ensure_belt_purge_tower(), Slic3r::ensure_process_variant_columns(), equal(), equals(), Slic3r::GUI::Plater::export_3mf(), Slic3r::extend_default_config_length(), Slic3r::extend_extruder_variant(), Slic3r::WipeTower2::extract_wipe_volumes(), Slic3r::GUI::extruder_supports_tpu_high_flow(), Slic3r::GUI::GUI_App::extruders_cnt(), Slic3r::GUI::GUI_App::extruders_edited_cnt(), Slic3r::filter_published_config(), Slic3r::find_fixed_mixed_filament(), Slic3r::find_imex_mode(), Slic3r::CalibPressureAdvance::find_optimal_PA_speed(), Slic3r::anonymous_namespace{PluginResolver.cpp}::find_option_for_capability(), Slic3r::PresetBundle::full_fff_config(), Slic3r::full_print_config_diffs(), Slic3r::PresetBundle::full_sla_config(), Slic3r::GUI::SyncAmsInfoDialog::generate_override_fix_ams_list(), Slic3r::GUI::CreatePrinterPresetDialog::generate_process_presets_data(), get_abs_value(), get_abs_value(), get_abs_value_at(), Slic3r::GUI::NewCalibrationHistoryDialog::get_all_filaments(), Slic3r::GUI::ExtrusionCalibration::get_bed_temp(), Slic3r::anonymous_namespace{SL1.cpp}::get_cfg_value(), Slic3r::GUI::get_config_json(), Slic3r::GUI::GLGizmoBrimEars::get_config_options(), Slic3r::GUI::ConfigOptionsGroup::get_config_value(), Slic3r::ModelObject::get_config_value(), Slic3r::GUI::ConfigOptionsGroup::get_config_value2(), Slic3r::GUI::Plater::get_enable_wrapping_detection(), Slic3r::DynamicPrintConfig::get_extruder_nozzle_volume_count(), Slic3r::get_extruder_supported_nozzle_volume_types(), Slic3r::GUI::Tab::get_extruder_sync_enable_state(), Slic3r::GUI::PartPlate::get_extruders(), Slic3r::GUI::PartPlate::get_extruders_under_cli(), Slic3r::GUI::get_filament_compatible_printer(), Slic3r::GUI::CreateFilamentPresetDialog::get_filament_preset_choices(), Slic3r::GUI::CreateFilamentPresetDialog::get_filament_presets_by_machine(), Slic3r::PresetBundle::get_filament_presets_for_machine(), Slic3r::DynamicPrintConfig::get_filament_type(), Slic3r::DynamicPrintConfig::get_filament_type(), Slic3r::PresetBundle::get_filament_variant_index(), Slic3r::DynamicPrintConfig::get_filament_vendor(), Slic3r::GUI::get_flow_ratio(), Slic3r::GUI::get_formatted_tooltip_text(), Slic3r::GUI::get_full_label(), Slic3r::DynamicPrintConfig::get_index_for_extruder(), Slic3r::get_instance_arrange_poly(), Slic3r::GUI::get_min_flush_volumes(), Slic3r::GUI::PartPlate::get_object_filament_extruders(), Slic3r::GUI::OrientJob::get_orient_mesh(), Slic3r::DynamicPrintConfig::get_parameter_size(), Slic3r::GUI::PartPlate::get_physical_extruder_by_filament_id(), Slic3r::GUI::PartPlate::get_plate_wrapping_detection_area(), Slic3r::PresetCollection::get_preset_differed_for_save(), Slic3r::GUI::get_preset_info(), Slic3r::PrintHost::get_print_host(), Slic3r::PrintHost::get_print_host_webui(), Slic3r::PresetBundle::get_printer_extruder_count(), get_printer_technology(), Slic3r::anonymous_namespace{SL1.cpp}::get_raster_params(), Slic3r::GUI::PartPlate::get_real_filament_map_mode(), Slic3r::GUI::PartPlate::get_real_filament_maps(), Slic3r::GUI::PartPlate::get_real_filament_volume_maps(), Slic3r::get_real_skirt_dist(), Slic3r::GUI::Plater::get_selected_printer_name_in_combox(), Slic3r::GUI::GLGizmoFdmSupports::get_selection_support_threshold_angle(), Slic3r::anonymous_namespace{SL1.cpp}::get_slice_params(), Slic3r::GUI::get_string_from_enum(), Slic3r::GUI::get_string_value(), Slic3r::GUI::PresetComboBox::get_tooltip(), Slic3r::GUI::CreatePresetForPrinterDialog::get_visible_printer_and_compatible_filament_presets(), Slic3r::GUI::ObjectGridTable::get_volume_config_value(), Slic3r::GUI::getExtruderNozzleCount(), Slic3r::GUI::getExtruderNozzleCountTotal(), Slic3r::PrintConfigDef::handle_legacy_composite(), Slic3r::handle_legacy_project_loaded(), Slic3r::PresetBundle::has_errors(), Slic3r::GUI::PartPlate::has_imex_multimaterial_conflict(), Slic3r::DynamicPrintConfig::has_multi_variant_filament(), Slic3r::has_skirt(), Slic3r::imex_cfg_bool(), Slic3r::imex_cfg_enum(), Slic3r::imex_cfg_float(), Slic3r::imex_cfg_int(), Slic3r::imex_mode_table(), Slic3r::GUI::PartPlate::imex_wipe_tower_hull(), Slic3r::PresetBundle::import_json_presets(), Slic3r::Preset::inherits(), Slic3r::GUI::ObjectTablePanel::init_filaments_and_colors(), Slic3r::GUI::init_multi_extruder_params_for_cali(), Slic3r::plugin_hooks::anonymous_namespace{PluginHooks.cpp}::install_slicing_pipeline_hook(), Slic3r::is_compatible_with_parent_printer(), Slic3r::is_compatible_with_print(), Slic3r::is_compatible_with_printer(), Slic3r::is_compatible_with_printer(), Slic3r::GUI::CalibrationPresetPage::is_filament_in_blacklist(), Slic3r::is_printable_filament_changed(), Slic3r::GUI::is_soluble_filament(), Slic3r::GUI::is_support_filament(), Slic3r::DynamicPrintConfig::is_using_different_extruders(), Slic3r::StaticConfig::keys(), legacy_bed_exclude_area_points(), Slic3r::GUI::MainFrame::load_config(), Slic3r::GUI::Tab::load_config(), Slic3r::PresetBundle::load_config_file_config(), Slic3r::GUI::Tab::load_current_preset(), load_default_gcodes_to_config(), Slic3r::PresetCollection::load_external_preset(), Slic3r::GUI::Plater::priv::load_files(), load_from_json(), Slic3r::GUI::MenuFactory::load_handy_model(), Slic3r::load_mixed_filament_settings(), Slic3r::PresetCollection::load_project_embedded_presets(), Slic3r::PresetBundle::load_selections(), Slic3r::GUI::ObjectList::load_shape_object(), Slic3r::PresetCollection::load_user_preset(), Slic3r::GCodeThumbnails::make_and_check_thumbnail_list(), Slic3r::GUI::manuallySetNozzleCount(), Slic3r::GUI::IMEXModesCtrl::matches_config(), Slic3r::min_object_distance(), Slic3r::GUI::mixed_gradient_curve(), Slic3r::GUI::mixed_gradient_ramp(), Slic3r::GUI::anonymous_namespace{GLGizmoTextureDisplacement.cpp}::mixed_slot_signature(), Slic3r::normalize_compatible_field(), Slic3r::DynamicPrintConfig::normalize_fdm(), Slic3r::DynamicPrintConfig::normalize_fdm_1(), Slic3r::DynamicPrintConfig::normalize_fdm_2(), Slic3r::normalize_filament_values_to_variants(), Slic3r::GUI::PartPlateList::notify_instance_update(), Slic3r::GUI::FlowRateWizard::on_cali_start(), Slic3r::GUI::Plater::on_filament_change(), Slic3r::GUI::TabPrinter::on_preset_loaded(), Slic3r::GUI::CalibrationPresetPage::on_recommend_input_value(), Slic3r::GUI::GLGizmoBrimEars::on_render_input_window(), Slic3r::GUI::GLGizmoFuzzySkin::on_render_input_window(), Slic3r::GUI::AMSMaterialsSetting::on_select_filament(), Slic3r::GUI::Plater::priv::on_select_preset(), Slic3r::GUI::Tab::on_value_change(), Slic3r::GUI::Plater::open_filament_map_setting_dialog(), Slic3r::DynamicConfig::opt(), Slic3r::DynamicConfig::opt(), Slic3r::DynamicConfig::opt_bool(), Slic3r::DynamicConfig::opt_bool(), Slic3r::DynamicConfig::opt_bool_nullable(), Slic3r::DynamicConfig::opt_enum(), Slic3r::DynamicConfig::opt_enum(), Slic3r::DynamicConfig::opt_enum_nullable(), Slic3r::DynamicConfig::opt_float(), Slic3r::DynamicConfig::opt_float(), Slic3r::DynamicConfig::opt_float(), Slic3r::DynamicConfig::opt_float(), Slic3r::DynamicConfig::opt_float_nullable(), Slic3r::DynamicConfig::opt_float_nullable(), Slic3r::DynamicConfig::opt_float_or_percent_nullable(), Slic3r::DynamicConfig::opt_float_or_percent_nullable(), Slic3r::DynamicConfig::opt_int(), Slic3r::DynamicConfig::opt_int(), Slic3r::DynamicConfig::opt_int(), Slic3r::DynamicConfig::opt_int(), Slic3r::DynamicConfig::opt_int_nullable(), Slic3r::DynamicConfig::opt_int_nullable(), opt_serialize(), Slic3r::DynamicConfig::opt_string(), Slic3r::DynamicConfig::opt_string(), Slic3r::option_of(), Slic3r::opts_equal(), Slic3r::GUI::anonymous_namespace{Plater.cpp}::parse_mixed_gradient_slots(), Slic3r::GUI::ObjectList::paste_settings_into_list(), anonymous_namespace{OrcaSlicer_profile_validator.cpp}::place_wipe_tower(), Slic3r::GUI::AMSMaterialsSetting::Popup(), Slic3r::GUI::FillBedJob::prepare(), Slic3r::GUI::ArrangeJob::prepare_all(), Slic3r::GUI::ArrangeJob::prepare_partplate(), Slic3r::BackgroundSlicingProcess::prepare_upload(), Slic3r::GUI::ArrangeJob::prepare_wipe_tower(), anonymous_namespace{OrcaSlicer_profile_validator.cpp}::preset_templates(), Slic3r::prime_tower_is_printed(), Slic3r::print_config_diffs(), anonymous_namespace{OrcaSlicer_profile_validator.cpp}::printable_area_center(), Slic3r::PhysicalPrinter::printer_technology(), Slic3r::Preset::printer_technology(), Slic3r::Preset::printer_technology_ref(), Slic3r::GUI::ArrangeJob::process(), Slic3r::GUI::CalibUtils::process_and_store_3mf(), Slic3r::BackgroundSlicingProcess::process_sla(), Slic3r::anonymous_namespace{PrintConfig.cpp}::project_bed_material_keepouts(), Slic3r::prune_stale_plugin_overrides(), Slic3r::DynamicConfig::read_cli(), Slic3r::ImexArrangeInput::read_config(), Slic3r::GUI::recompute_mixed_slot_colors(), Slic3r::referenced_capabilities(), Slic3r::GUI::PartPlate::refresh_imex_icon(), Slic3r::refresh_missing_plugins(), Slic3r::GUI::PartPlate::register_raycasters_for_picking(), Slic3r::PresetBundle::reload_local_bundle(), Slic3r::GUI::ObjectGridTable::reload_object_data(), Slic3r::GUI::GLCanvas3D::reload_scene(), Slic3r::GUI::PartPlate::render_icons(), Slic3r::GUI::SelectMachineDialog::reset_and_sync_ams_list(), Slic3r::GUI::SyncAmsInfoDialog::reset_and_sync_ams_list(), Slic3r::PresetBundle::reset_default_nozzle_volume_type(), Slic3r::PresetBundle::reset_project_embedded_presets(), Slic3r::GUI::IMEXModesCtrl::reset_row_to_parent(), Slic3r::resize_mixed_filament_metadata(), Slic3r::GUI::PartPlate::resolve_active_mode_tools(), Slic3r::PresetCollection::resolve_user_preset(), Slic3r::PresetBundle::resolve_vendor_preset(), Slic3r::resolve_wipe_tower_type(), Slic3r::GUI::IMEXModesCtrl::row_differs_from_parent(), Slic3r::GUI::IMEXModesCtrl::row_has_parent_counterpart(), Slic3r::CLI::run(), Slic3r::GUI::s_get_slicing_extuder_nozzles(), Slic3r::anonymous_namespace{Flashforge.cpp}::safe_config_string(), Slic3r::Preset::save(), Slic3r::GUI::CalibrationWizard::save_preset_with_index(), save_to_json(), Slic3r::GUI::Selection::scale_to_fit_print_volume(), Slic3r::GUI::sCheckFilamentInfo(), Slic3r::GUI::seedExtruderNozzleStats(), Slic3r::GUI::Tab::select_preset(), anonymous_namespace{OrcaSlicer_profile_validator.cpp}::select_printer_default_presets(), Slic3r::GUI::Plater::send_gcode_legacy(), Slic3r::PresetBundle::set_calibrate_printer(), Slic3r::GUI::set_config_values(), Slic3r::GUI::PartPlateList::set_default_wipe_tower_pos_for_plate(), Slic3r::StaticConfig::set_defaults(), set_deserialize_raw(), Slic3r::set_filament_dev_options(), Slic3r::GUI::CalibUtils::set_for_auto_pa_model_and_config(), Slic3r::DynamicPrintConfig::set_num_extruders(), Slic3r::DynamicPrintConfig::set_num_filaments(), Slic3r::GUI::PartPlate::set_shape(), Slic3r::GUI::PartPlate::set_vase_mode_related_object_config(), anonymous_namespace{OrcaSlicer_profile_validator.cpp}::slice_config(), Slic3r::DynamicPrintConfig::support_different_extruders(), Slic3r::GUI::support_nozzle_volume(), Slic3r::GUI::Sidebar::priv::switch_diameter(), Slic3r::GUI::Sidebar::priv::switch_diameter_to(), Slic3r::GUI::Tab::switch_excluder(), Slic3r::GUI::SendMultiMachinePage::sync_ams_list(), Slic3r::GUI::Sidebar::sync_ams_list(), Slic3r::GUI::PlaterPresetComboBox::sync_colour_config(), Slic3r::GUI::Tab::sync_excluder(), Slic3r::GUI::Sidebar::priv::sync_extruder_list(), Slic3r::GUI::Plater::priv::take_snapshot(), Slic3r::GUI::ConfigManipulation::toggle_print_fff_options(), Slic3r::GUI::Plater::priv::undo_redo_to(), Slic3r::GUI::PlaterPresetComboBox::update(), Slic3r::GUI::PresetComboBox::update_ams_color(), Slic3r::GLVolumeCollection::update_colors_by_extruder(), Slic3r::GUI::CalibrationPresetPage::update_combobox_filaments(), Slic3r::PresetBundle::update_compatible(), Slic3r::PresetCollection::update_compatible_internal(), Slic3r::GUI::ObjectTableSettings::update_config_values(), Slic3r::GUI::update_custom_filaments(), Slic3r::DynamicPrintConfig::update_diff_values_to_child_config(), Slic3r::GUI::Plater::update_filament_colors_in_full_config(), Slic3r::DynamicPrintConfig::update_filament_config_values_for_multiple_extruders(), Slic3r::GUI::TabFilament::update_filament_overrides_page(), Slic3r::GUI::Plater::update_flush_volume_matrix(), Slic3r::GUI::TabPrintModel::update_model_config(), Slic3r::DynamicPrintConfig::update_non_diff_values_to_base_config(), update_plugin_manifest(), Slic3r::GUI::Tab::update_preset_description_line(), Slic3r::GUI::Sidebar::update_presets(), Slic3r::GUI::ConfigManipulation::update_print_fff_config(), Slic3r::update_static_print_config_from_dynamic(), Slic3r::GUI::UnsavedChangesDialog::update_tree(), Slic3r::GUI::UnsavedChangesDialog::update_tree(), Slic3r::DynamicPrintConfig::update_values_from_multi_to_multi(), Slic3r::DynamicPrintConfig::update_values_from_multi_to_multi_2(), Slic3r::DynamicPrintConfig::update_values_from_single_to_multi(), Slic3r::DynamicPrintConfig::update_values_to_printer_extruders(), Slic3r::DynamicPrintConfig::update_values_to_printer_extruders_for_multiple_filaments(), Slic3r::GUI::updateNozzleCountDisplay(), Slic3r::DynamicPrintConfig::validate(), Slic3r::GUI::Tab::validate_filament_temperature_pairs(), Slic3r::PresetBundle::validate_presets(), Slic3r::GUI::variant_keys(), and Slic3r::GUI::zero_pressure_advance_where_disabled().

Here is the call graph for this function:

◆ option_throw() [1/3]

const ConfigOption * Slic3r::ConfigOptionResolver::option_throw ( const t_config_option_key & opt_key) const
inlineinherited
2709 {
2710 const ConfigOption* opt = this->optptr(opt_key);
2711 if (opt == nullptr)
2712 throw UnknownOptionException(opt_key);
2713 return opt;
2714 }

◆ option_throw() [2/3]

template<typename TYPE>
TYPE * Slic3r::ConfigBase::option_throw ( const t_config_option_key & opt_key,
bool create = false )
inlineinherited
2792 {
2793 ConfigOption *opt = this->option_throw(opt_key, create);
2794 if (opt->type() != TYPE::static_type())
2795 throw BadOptionTypeException("Conversion to a wrong type");
2796 return static_cast<TYPE*>(opt);
2797 }
ConfigOption * option_throw(const t_config_option_key &opt_key, bool create=false)
Definition Config.hpp:2782

References option_throw().

Here is the call graph for this function:

◆ option_throw() [3/3]

ConfigOption * Slic3r::ConfigBase::option_throw ( const t_config_option_key & opt_key,
bool create = false )
inlineinherited
2783 {
2784 ConfigOption *opt = this->optptr(opt_key, create);
2785 if (opt == nullptr)
2786 throw UnknownOptionException(opt_key);
2787 return opt;
2788 }

References optptr().

Referenced by option_throw(), set(), set(), set(), set(), and set().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ optptr() [1/2]

const ConfigOption * Slic3r::DynamicConfig::optptr ( const t_config_option_key & opt_key) const
overridevirtual

Reimplemented from Slic3r::ConfigBase.

1745{
1746 auto it = options.find(opt_key);
1747 return (it == options.end()) ? nullptr : it->second.get();
1748}

References options.

Referenced by Slic3r::apply_mixed_config_relocations(), Slic3r::apply_receiver_mix_relocations(), Slic3r::GUI::get_string_value(), Slic3r::client::MyContext::new_old_variable(), and Slic3r::client::MyContext::resolve_output_symbol().

Here is the caller graph for this function:

◆ optptr() [2/2]

ConfigOption * Slic3r::DynamicConfig::optptr ( const t_config_option_key & opt_key,
bool create = false )
overridevirtual

Implements Slic3r::ConfigBase.

1722{
1723 auto it = options.find(opt_key);
1724 if (it != options.end())
1725 // Option was found.
1726 return it->second.get();
1727 if (! create)
1728 // Option was not found and a new option shall not be created.
1729 return nullptr;
1730 // Try to create a new ConfigOption.
1731 const ConfigDef *def = this->def();
1732 if (def == nullptr)
1733 throw NoDefinitionException(opt_key);
1734 const ConfigOptionDef *optdef = def->get(opt_key);
1735 if (optdef == nullptr)
1736// throw ConfigurationError(std::string("Invalid option name: ") + opt_key);
1737 // Let the parent decide what to do if the opt_key is not defined by this->def().
1738 return nullptr;
1739 ConfigOption *opt = optdef->create_default_option();
1740 this->options.emplace_hint(it, opt_key, std::unique_ptr<ConfigOption>(opt));
1741 return opt;
1742}

References Slic3r::ConfigOptionDef::create_default_option(), def(), opt(), and options.

Here is the call graph for this function:

◆ read_cli()

bool Slic3r::DynamicConfig::read_cli ( int argc,
const char *const argv[],
t_config_option_keys * extra,
t_config_option_keys * keys = nullptr )
1781{
1782 // cache the CLI option => opt_key mapping
1783 std::map<std::string,std::string> opts;
1784 for (const auto &oit : this->def()->options)
1785 for (const std::string &t : oit.second.cli_args(oit.first))
1786 opts[t] = oit.first;
1787
1788 bool parse_options = true;
1789 for (int i = 1; i < argc; ++ i) {
1790 std::string token = argv[i];
1791 // Store non-option arguments in the provided vector.
1792 if (! parse_options || ! boost::starts_with(token, "-")) {
1793 extra->push_back(token);
1794 continue;
1795 }
1796#ifdef __APPLE__
1797 if (boost::starts_with(token, "-psn_"))
1798 // OSX launcher may add a "process serial number", for example "-psn_0_989382" to the command line.
1799 // While it is supposed to be dropped since OSX 10.9, we will rather ignore it.
1800 continue;
1801#endif /* __APPLE__ */
1802 // Stop parsing tokens as options when -- is supplied.
1803 if (token == "--") {
1804 parse_options = false;
1805 continue;
1806 }
1807 // Remove leading dashes (one or two).
1808 token.erase(token.begin(), token.begin() + (boost::starts_with(token, "--") ? 2 : 1));
1809 // Read value when supplied in the --key=value form.
1810 std::string value;
1811 {
1812 size_t equals_pos = token.find("=");
1813 if (equals_pos != std::string::npos) {
1814 value = token.substr(equals_pos+1);
1815 token.erase(equals_pos);
1816 }
1817 }
1818 // Look for the cli -> option mapping.
1819 auto it = opts.find(token);
1820 bool no = false;
1821 if (it == opts.end()) {
1822 //BBS: don't use 'no-' for boolean options
1823 boost::nowide::cerr << "Invalid option --" << token.c_str() << std::endl;
1824 return false;
1825 /* Remove the "no-" prefix used to negate boolean options.
1826 std::string yes_token;
1827 if (boost::starts_with(token, "no-")) {
1828 yes_token = token.substr(3);
1829 it = opts.find(yes_token);
1830 no = true;
1831 }
1832 if (it == opts.end()) {
1833 boost::nowide::cerr << "Invalid option --" << token.c_str() << std::endl;
1834 return false;
1835 }
1836 if (no)
1837 token = yes_token;*/
1838 }
1839
1840 const t_config_option_key &opt_key = it->second;
1841 const ConfigOptionDef &optdef = this->def()->options.at(opt_key);
1842
1843 // If the option type expects a value and it was not already provided,
1844 // look for it in the next token.
1845 if (value.empty() && optdef.type != coBool && optdef.type != coBools) {
1846 if (i == argc-1) {
1847 boost::nowide::cerr << "Need values for option --" << token.c_str() << std::endl;
1848 return false;
1849 }
1850 value = argv[++ i];
1851 }
1852
1853 /*if (no) {
1854 assert(optdef.type == coBool || optdef.type == coBools);
1855 if (! value.empty()) {
1856 boost::nowide::cerr << "Boolean options negated by the --no- prefix cannot have a value." << std::endl;
1857 return false;
1858 }
1859 }*/
1860
1861 // Store the option value.
1862 const bool existing = this->has(opt_key);
1863 if (keys != nullptr && ! existing) {
1864 // Save the order of detected keys.
1865 keys->push_back(opt_key);
1866 }
1867 ConfigOption *opt_base = this->option(opt_key, true);
1868 ConfigOptionVectorBase *opt_vector = opt_base->is_vector() ? static_cast<ConfigOptionVectorBase*>(opt_base) : nullptr;
1869 if (opt_vector) {
1870 if (! existing)
1871 // remove the default values
1872 opt_vector->clear();
1873 // Vector values will be chained. Repeated use of a parameter will append the parameter or parameters
1874 // to the end of the value.
1875 if (opt_base->type() == coBools && value.empty())
1876 static_cast<ConfigOptionBools*>(opt_base)->values.push_back(!no);
1877 else {
1878 // Deserialize any other vector value (ConfigOptionInts, Floats, Percents, Points) the same way
1879 // they get deserialized from an .ini file. For ConfigOptionStrings, that means that the C-style unescape
1880 // will be applied for values enclosed in quotes, while values non-enclosed in quotes are left to be
1881 // unescaped by the calling shell.
1882 const std::string vector_value = opt_base->type() == coBools ? normalize_cli_bool_value(value) : value;
1883 bool deserialized = false;
1884 try {
1885 deserialized = opt_vector->deserialize(vector_value, true);
1886 } catch (const std::exception &ex) {
1887 // e.g. "nil" deserialized into a non-nullable vector option throws instead of
1888 // returning false - treat that the same as any other invalid value here.
1889 deserialized = false;
1890 }
1891 if (! deserialized) {
1892 boost::nowide::cerr << "Invalid value for option --" << token.c_str() << std::endl;
1893 return false;
1894 }
1895 }
1896 } else if (opt_base->type() == coBool) {
1897 if (value.empty())
1898 static_cast<ConfigOptionBool*>(opt_base)->value = !no;
1899 else if (! opt_base->deserialize(normalize_cli_bool_value(value))) {
1900 boost::nowide::cerr << "Invalid value for option --" << token.c_str() << std::endl;
1901 return false;
1902 }
1903 } else if (opt_base->type() == coString) {
1904 // Do not unescape single string values, the unescaping is left to the calling shell.
1905 static_cast<ConfigOptionString*>(opt_base)->value = value;
1906 } else {
1907 // Just bail out if the configuration value is not understood.
1908 ConfigSubstitutionContext context(ForwardCompatibilitySubstitutionRule::Disable);
1909 // Any scalar value of a type different from Bool and String.
1910 if (! this->set_deserialize_nothrow(opt_key, value, context, false)) {
1911 boost::nowide::cerr << "Invalid value for option --" << token.c_str() << std::endl;
1912 return false;
1913 }
1914 }
1915 }
1916 return true;
1917}
bool set_deserialize_nothrow(const t_config_option_key &opt_key_src, const std::string &value_src, ConfigSubstitutionContext &substitutions, bool append=false)
Definition Config.cpp:596
t_optiondef_map options
Definition Config.hpp:2658
bool has(const t_config_option_key &opt_key) const
Definition Config.hpp:2697
static std::string normalize_cli_bool_value(const std::string &value)
Definition Config.cpp:1754
zaa_minimize_perimeter_height ConfigOptionString
Definition PrintConfig.hpp:1702
@ coString
Definition Config.hpp:192
@ coBools
Definition Config.hpp:212

References Slic3r::ConfigOptionVectorBase::clear(), Slic3r::coBool, Slic3r::coBools, Slic3r::coString, def(), Slic3r::ConfigOption::deserialize(), Slic3r::Disable, Slic3r::ConfigOptionResolver::has(), Slic3r::ConfigOption::is_vector(), keys(), Slic3r::normalize_cli_bool_value(), Slic3r::ConfigBase::option(), Slic3r::ConfigDef::options, options, Slic3r::ConfigBase::set_deserialize_nothrow(), Slic3r::ConfigOption::type(), and Slic3r::ConfigOptionDef::type.

Here is the call graph for this function:

◆ remove_nil_options()

size_t Slic3r::DynamicConfig::remove_nil_options ( )
1710{
1711 size_t cnt_removed = 0;
1712 for (auto it = options.begin(); it != options.end();)
1713 if (it->second->is_nil()) {
1714 it = options.erase(it);
1715 ++ cnt_removed;
1716 } else
1717 ++ it;
1718 return cnt_removed;
1719}

References options.

◆ save()

void Slic3r::ConfigBase::save ( const std::string & file) const
inherited
1604{
1605 boost::nowide::ofstream c;
1606 c.open(file, std::ios::out | std::ios::trunc);
1607 c << "# " << Slic3r::header_slic3r_generated() << std::endl;
1608 for (const std::string &opt_key : this->keys())
1609 c << opt_key << " = " << this->opt_serialize(opt_key) << std::endl;
1610 c.close();
1611
1612 BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ":" <<__LINE__ << boost::format(", saved config to %1%\n")%file;
1613}
std::string opt_serialize(const t_config_option_key &opt_key) const
Definition Config.cpp:566
std::string header_slic3r_generated()
Definition utils.cpp:1470

References Slic3r::header_slic3r_generated(), keys(), and opt_serialize().

Here is the call graph for this function:

◆ save_plugin_collection()

void Slic3r::ConfigBase::save_plugin_collection ( const std::string & opt_key,
const ConfigOption * opt,
std::vector< std::string > & plugin_refs ) const
privateinherited
1626 {
1627 // Full plugin capability references ("name;uuid;capability") can only be derived through the
1628 // resolver registered by the GUI once plugins are loaded. In non-GUI/headless contexts (e.g.
1629 // the CLI) it stays null, so skip silently rather than calling an empty std::function.
1631 return;
1632
1633 // A plugin-backed option declares its capability type via ConfigOptionDef::plugin_type (the same
1634 // metadata PluginResolver::find_option_for_capability scans). Deriving off the def rather than a
1635 // per-key branch keeps this generic across every plugin-backed option.
1636 const ConfigDef* def = this->def();
1637 const ConfigOptionDef* opt_def = def ? def->get(opt_key) : nullptr;
1638 if (opt_def == nullptr || !opt_def->is_plugin_backed())
1639 return;
1640 const std::string& type = opt_def->plugin_type;
1641
1642 // Resolve a single bare capability value into its full reference and append it, skipping unset
1643 // values, capabilities that could not be resolved (resolver returns ""), and duplicates already
1644 // collected (preserving insertion order).
1645 const auto append_ref = [&plugin_refs, &type](const std::string& capability_value) {
1646 if (capability_value.empty())
1647 return;
1648 std::string ref = resolve_capability_fn(capability_value, type);
1649 if (!ref.empty() && std::find(plugin_refs.begin(), plugin_refs.end(), ref) == plugin_refs.end())
1650 plugin_refs.emplace_back(std::move(ref));
1651 };
1652
1653 // Scalar options carry a single capability name; vector options carry a list. Same scalar/vector
1654 // dispatch as PluginResolver::find_option_for_capability.
1655 if (const auto* string_option = dynamic_cast<const ConfigOptionString*>(opt))
1656 append_ref(string_option->value);
1657 else if (const auto* vector_option = dynamic_cast<const ConfigOptionVectorBase*>(opt))
1658 for (const std::string& val : vector_option->vserialize())
1659 append_ref(val);
1660}

References def(), Slic3r::ConfigOptionDef::is_plugin_backed(), Slic3r::ConfigOptionDef::plugin_type, and resolve_capability_fn.

Referenced by collect_plugin_manifest().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ save_to_json() [1/2]

void Slic3r::ConfigBase::save_to_json ( const std::string & file,
const std::string & name,
const std::string & from,
const std::string & version ) const
inherited
1543{
1544 // Serialize first: if that throws (invalid UTF-8), the existing file stays untouched.
1545 std::ostringstream ss;
1546 this->save_to_json(ss, name, from, version);
1547 if (const std::error_code ec = write_file_atomically(file, ss.str()))
1548 BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(": failed to save config to %1%: %2%") % file % ec.message();
1549 else
1550 BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ":" <<__LINE__ << boost::format(", saved config to %1%\n")%file;
1551}
void save_to_json(const std::string &file, const std::string &name, const std::string &from, const std::string &version) const
Definition Config.cpp:1542
std::error_code write_file_atomically(const std::string &path, std::initializer_list< std::string_view > chunks, bool binary)
Definition utils.cpp:796

References save_to_json(), and Slic3r::write_file_atomically().

Referenced by Slic3r::_BBS_3MF_Exporter::_add_project_config_file_to_archive(), Slic3r::_BBS_3MF_Exporter::_add_project_embedded_presets_to_archive(), Slic3r::PresetBundle::export_current_configs(), Slic3r::Preset::save(), and save_to_json().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ save_to_json() [2/2]

void Slic3r::ConfigBase::save_to_json ( std::ostream & os,
const std::string & name,
const std::string & from,
const std::string & version,
bool replace_invalid_utf8 = false ) const
inherited
1554{
1555 json j;
1556 //record the headers
1557 j[BBL_JSON_KEY_VERSION] = version;
1558 j[BBL_JSON_KEY_NAME] = name;
1559 j[BBL_JSON_KEY_FROM] = from;
1560
1561 //record all the key-values
1562 for (const std::string &opt_key : this->keys())
1563 {
1564 const ConfigOption* opt = this->option(opt_key);
1565 if ( opt->is_scalar() ) {
1566 if (opt->type() == coString && (opt_key != "bed_custom_texture" && opt_key != "bed_custom_model"))
1567 //keep \n, \r, \t
1568 j[opt_key] = (dynamic_cast<const ConfigOptionString *>(opt))->value;
1569 else
1570 j[opt_key] = opt->serialize();
1571 }
1572 else {
1573 const ConfigOptionVectorBase* vec = static_cast<const ConfigOptionVectorBase*>(opt);
1574 //if (!vec->empty())
1575 std::vector<std::string> string_values = vec->vserialize();
1576
1577 /*for (int i = 0; i < string_values.size(); i++)
1578 {
1579 std::string string_value = escape_string_cstyle(string_values[i]);
1580 j[opt_key][i] = string_value;
1581 }*/
1582
1583 json j_array(string_values);
1584 j[opt_key] = j_array;
1585 }
1586 }
1587
1588 // Serialize the top-level "plugins" manifest: the individual plugin-backed options keep bare
1589 // capability names; the full "name;uuid;capability" references are derived here (same helper as
1590 // update_plugin_manifest). Only with a resolver (GUI); without one (CLI/headless) leave whatever
1591 // the "plugins" option already serialized above, so a round-trip never drops the manifest.
1593 std::vector<std::string> unique_refs = this->collect_plugin_manifest();
1594 if (unique_refs.empty())
1595 j.erase("plugins");
1596 else
1597 j["plugins"] = unique_refs;
1598 }
1599
1600 os << j.dump(1, '\t', false, replace_invalid_utf8 ? json::error_handler_t::replace : json::error_handler_t::strict) << std::endl;
1601}
std::vector< std::string > collect_plugin_manifest() const
Definition Config.cpp:1662

References BBL_JSON_KEY_FROM, BBL_JSON_KEY_NAME, BBL_JSON_KEY_VERSION, collect_plugin_manifest(), Slic3r::coString, keys(), option(), resolve_capability_fn, and Slic3r::ConfigOptionVectorBase::vserialize().

Here is the call graph for this function:

◆ serialize()

template<class Archive>
void Slic3r::DynamicConfig::serialize ( Archive & ar)
inlineprivate
3122{ ar(options); }

References options.

◆ set() [1/5]

void Slic3r::ConfigBase::set ( const std::string & opt_key,
bool value,
bool create = false )
inlineinherited
2823 { this->option_throw<ConfigOptionBool>(opt_key, create)->value = value; }

References option_throw().

Referenced by Slic3r::Print::apply(), Slic3r::extract_profile(), Slic3r::import_sla_archive(), Slic3r::CLI::run(), and Slic3r::GUI::CreatePrinterPresetDialog::save_printable_area_config().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set() [2/5]

void Slic3r::ConfigBase::set ( const std::string & opt_key,
const char * value,
bool create = false )
inlineinherited
2827 { this->option_throw<ConfigOptionString>(opt_key, create)->value = value; }

References option_throw().

Here is the call graph for this function:

◆ set() [3/5]

void Slic3r::ConfigBase::set ( const std::string & opt_key,
const std::string & value,
bool create = false )
inlineinherited
2829 { this->option_throw<ConfigOptionString>(opt_key, create)->value = value; }

References option_throw().

Here is the call graph for this function:

◆ set() [4/5]

void Slic3r::ConfigBase::set ( const std::string & opt_key,
double value,
bool create = false )
inherited
586{
587 ConfigOption *opt = this->option_throw(opt_key, create);
588 switch (opt->type()) {
589 case coFloat: static_cast<ConfigOptionFloat*>(opt)->value = value; break;
590 case coFloatOrPercent: static_cast<ConfigOptionFloatOrPercent*>(opt)->value = value; static_cast<ConfigOptionFloatOrPercent*>(opt)->percent = false; break;
591 case coString: static_cast<ConfigOptionString*>(opt)->value = float_to_string_decimal_point(value); break;
592 default: throw BadOptionTypeException("Configbase::set() - conversion from float not possible");
593 }
594}
std::string float_to_string_decimal_point(double value, int precision)
Definition LocalesUtils.cpp:108

References Slic3r::coFloat, Slic3r::coFloatOrPercent, Slic3r::coString, Slic3r::float_to_string_decimal_point(), and option_throw().

Here is the call graph for this function:

◆ set() [5/5]

void Slic3r::ConfigBase::set ( const std::string & opt_key,
int value,
bool create = false )
inherited
574{
575 ConfigOption *opt = this->option_throw(opt_key, create);
576 switch (opt->type()) {
577 case coInt: static_cast<ConfigOptionInt*>(opt)->value = value; break;
578 case coFloat: static_cast<ConfigOptionFloat*>(opt)->value = value; break;
579 case coFloatOrPercent: static_cast<ConfigOptionFloatOrPercent*>(opt)->value = value; static_cast<ConfigOptionFloatOrPercent*>(opt)->percent = false; break;
580 case coString: static_cast<ConfigOptionString*>(opt)->value = std::to_string(value); break;
581 default: throw BadOptionTypeException("Configbase::set() - conversion from int not possible");
582 }
583}

References Slic3r::coFloat, Slic3r::coFloatOrPercent, Slic3r::coInt, Slic3r::coString, and option_throw().

Here is the call graph for this function:

◆ set_deserialize() [1/2]

void Slic3r::ConfigBase::set_deserialize ( const t_config_option_key & opt_key,
const std::string & str,
ConfigSubstitutionContext & config_substitutions,
bool append = false )
inherited
615{
616 if (! this->set_deserialize_nothrow(opt_key_src, value_src, substitutions_ctxt, append))
617 throw BadOptionValueException(format(_u8L("Invalid value provided for parameter %1%: %2%"), opt_key_src, value_src));
618}
void append(std::vector< T, Alloc > &dest, const std::vector< T, Alloc2 > &src)
Definition libslic3r.h:157

References _u8L, Slic3r::append(), Slic3r::format(), and set_deserialize_nothrow().

Referenced by construct_assemble_list(), load(), load_from_gcode_file(), load_from_gcode_string_legacy(), load_from_json(), load_string_map(), set_deserialize(), set_deserialize_strict(), and set_deserialize_strict().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_deserialize() [2/2]

void Slic3r::ConfigBase::set_deserialize ( std::initializer_list< SetDeserializeItem > items,
ConfigSubstitutionContext & substitutions )
inherited
621{
622 for (const SetDeserializeItem &item : items)
623 this->set_deserialize(item.opt_key, item.opt_value, substitutions_ctxt, item.append);
624}
Definition Config.hpp:2838

References set_deserialize().

Here is the call graph for this function:

◆ set_deserialize_nothrow()

bool Slic3r::ConfigBase::set_deserialize_nothrow ( const t_config_option_key & opt_key_src,
const std::string & value_src,
ConfigSubstitutionContext & substitutions,
bool append = false )
inherited
597{
598 t_config_option_key opt_key = opt_key_src;
599 std::string value = value_src;
600 // Both opt_key and value may be modified by handle_legacy().
601 // If the opt_key is no more valid in this version of Slic3r, opt_key is cleared by handle_legacy().
602 this->handle_legacy(opt_key, value);
603 if (opt_key.empty()) {
604 // Ignore the option.
605 //BBS: record these options, keep only one repeated opt_key
606 auto iter = std::find(substitutions_ctxt.unrecogized_keys.begin(), substitutions_ctxt.unrecogized_keys.end(), opt_key_src);
607 if (iter == substitutions_ctxt.unrecogized_keys.end())
608 substitutions_ctxt.unrecogized_keys.push_back(opt_key_src);
609 return true;
610 }
611 return this->set_deserialize_raw(opt_key, value, substitutions_ctxt, append);
612}
bool set_deserialize_raw(const t_config_option_key &opt_key_src, const std::string &value, ConfigSubstitutionContext &substitutions, bool append)
Definition Config.cpp:626

References Slic3r::append(), handle_legacy(), set_deserialize_raw(), and Slic3r::ConfigSubstitutionContext::unrecogized_keys.

Referenced by Slic3r::DynamicConfig::read_cli(), and set_deserialize().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_deserialize_raw()

bool Slic3r::ConfigBase::set_deserialize_raw ( const t_config_option_key & opt_key_src,
const std::string & value,
ConfigSubstitutionContext & substitutions,
bool append )
privateinherited
627{
628 t_config_option_key opt_key = opt_key_src;
629 // Try to deserialize the option by its name.
630 const ConfigDef *def = this->def();
631 if (def == nullptr)
632 throw NoDefinitionException(opt_key);
633 const ConfigOptionDef *optdef = def->get(opt_key);
634 if (optdef == nullptr) {
635 // If we didn't find an option, look for any other option having this as an alias.
636 for (const auto &opt : def->options) {
637 for (const t_config_option_key &opt_key2 : opt.second.aliases) {
638 if (opt_key2 == opt_key) {
639 opt_key = opt.first;
640 optdef = &opt.second;
641 break;
642 }
643 }
644 if (optdef != nullptr)
645 break;
646 }
647 if (optdef == nullptr)
648 throw UnknownOptionException(opt_key);
649 }
650
651 if (! optdef->shortcut.empty()) {
652 // Aliasing for example "solid_layers" to "top_shell_layers" and "bottom_shell_layers".
653 for (const t_config_option_key &shortcut : optdef->shortcut)
654 // Recursive call.
655 if (! this->set_deserialize_raw(shortcut, value, substitutions_ctxt, append))
656 return false;
657 return true;
658 }
659
660 ConfigOption *opt = this->option(opt_key, true);
661 assert(opt != nullptr);
662 bool success = false;
663 bool substituted = false;
664 if (optdef->type == coBools && substitutions_ctxt.rule != ForwardCompatibilitySubstitutionRule::Disable) {
665 //FIXME Special handling of vectors of bools, quick and not so dirty solution before PrusaSlicer 2.3.2 release.
666 bool nullable = opt->nullable();
668 if (optdef->default_value) {
669 // Default value for vectors of booleans used in a "per extruder" context, thus the default contains just a single value.
670 assert(dynamic_cast<const ConfigOptionVector<unsigned char>*>(optdef->default_value.get()));
671 auto &values = static_cast<const ConfigOptionVector<unsigned char>*>(optdef->default_value.get())->values;
672 if (values.size() == 1 && values.front() == 1)
674 }
675 auto result = nullable ?
676 static_cast<ConfigOptionBoolsNullable*>(opt)->deserialize_with_substitutions(value, append, default_value) :
677 static_cast<ConfigOptionBools*>(opt)->deserialize_with_substitutions(value, append, default_value);
680 } else {
681 //bool test = (opt_key == "filament_end_gcode");
682 success = opt->deserialize(value, append);
683 if (! success && substitutions_ctxt.rule != ForwardCompatibilitySubstitutionRule::Disable &&
684 // Only allow substitutions of an enum value by another enum value or a boolean value with an enum value.
685 // That means, we expect enum values being added in the future and possibly booleans being converted to enums.
686 (optdef->type == coEnum || optdef->type == coEnums || optdef->type == coBool) /*&& ConfigHelpers::looks_like_enum_value(value)*/) {
687 // Deserialize failed, try to substitute with a default value.
688 //assert(substitutions_ctxt.rule == ForwardCompatibilitySubstitutionRule::Enable || substitutions_ctxt.rule == ForwardCompatibilitySubstitutionRule::EnableSilent);
689 if (optdef->type == coBool)
690 static_cast<ConfigOptionBool*>(opt)->value = ConfigHelpers::enum_looks_like_true_value(value);
691 else
692 // Just use the default of the option.
693 opt->set(optdef->default_value.get());
694 success = true;
695 substituted = true;
696 }
697 }
698
699 if (substituted && (substitutions_ctxt.rule == ForwardCompatibilitySubstitutionRule::Enable ||
701 // Log the substitution.
702 ConfigSubstitution config_substitution;
703 config_substitution.opt_def = optdef;
704 config_substitution.old_value = value;
705 config_substitution.new_value = ConfigOptionUniquePtr(opt->clone());
706 substitutions_ctxt.substitutions.emplace_back(std::move(config_substitution));
707 }
708 return success;
709}
DeserializationSubstitution
Definition Config.hpp:123
@ Substituted
Definition Config.hpp:131
bool enum_looks_like_true_value(std::string value)
Definition Config.hpp:118
@ EnableSystemSilent
Definition Config.hpp:249
@ Enable
Definition Config.hpp:245
std::unique_ptr< ConfigOption, ConfigOptionDeleter > ConfigOptionUniquePtr
Definition Config.hpp:258
@ coEnum
Definition Config.hpp:214
@ coEnums
Definition Config.hpp:216

References Slic3r::append(), Slic3r::coBool, Slic3r::coBools, Slic3r::coEnum, Slic3r::coEnums, def(), Slic3r::ConfigOptionDef::default_value, Slic3r::ConfigHelpers::DefaultsToFalse, Slic3r::ConfigHelpers::DefaultsToTrue, Slic3r::Disable, Slic3r::Enable, Slic3r::EnableSystemSilent, Slic3r::ConfigHelpers::enum_looks_like_true_value(), Slic3r::ConfigHelpers::Failed, Slic3r::ConfigSubstitution::new_value, Slic3r::ConfigSubstitution::old_value, Slic3r::ConfigSubstitution::opt_def, option(), Slic3r::ConfigSubstitutionContext::rule, set_deserialize_raw(), Slic3r::ConfigOptionDef::shortcut, Slic3r::ConfigHelpers::Substituted, Slic3r::ConfigSubstitutionContext::substitutions, Slic3r::ConfigOptionDef::type, and Slic3r::ConfigOptionVector< T >::values.

Referenced by set_deserialize_nothrow(), and set_deserialize_raw().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_deserialize_strict() [1/2]

void Slic3r::ConfigBase::set_deserialize_strict ( const t_config_option_key & opt_key,
const std::string & str,
bool append = false )
inlineinherited
2837 { ConfigSubstitutionContext ctxt{ ForwardCompatibilitySubstitutionRule::Disable }; this->set_deserialize(opt_key, str, ctxt, append); }

References Slic3r::append(), Slic3r::Disable, and set_deserialize().

Referenced by Slic3r::GUI::Tab::apply_preset_config_values().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_deserialize_strict() [2/2]

void Slic3r::ConfigBase::set_deserialize_strict ( std::initializer_list< SetDeserializeItem > items)
inlineinherited
2854 { ConfigSubstitutionContext ctxt{ ForwardCompatibilitySubstitutionRule::Disable }; this->set_deserialize(items, ctxt); }

References Slic3r::Disable, and set_deserialize().

Here is the call graph for this function:

◆ set_key_value()

bool Slic3r::DynamicConfig::set_key_value ( const std::string & opt_key,
ConfigOption * opt )
inline
3023 {
3024 auto it = this->options.find(opt_key);
3025 if (it == this->options.end()) {
3026 this->options[opt_key].reset(opt);
3027 return true;
3028 } else {
3029 it->second.reset(opt);
3030 return false;
3031 }
3032 }

References opt().

Referenced by Slic3r::GUI::Plater::_calib_pa_pattern(), Slic3r::append_bed_exclude_volumes(), Slic3r::WipeTowerIntegration::append_tcr(), Slic3r::WipeTowerIntegration::append_tcr2(), Slic3r::GUI::ConfigManipulation::apply(), Slic3r::Print::apply(), Slic3r::GUI::PageBedShape::apply_custom_config(), Slic3r::GUI::PageDiameters::apply_custom_config(), Slic3r::GUI::PageFirmware::apply_custom_config(), Slic3r::GUI::ConfigManipulation::apply_null_fff_config(), Slic3r::GUI::TabPrinter::build_fff(), Slic3r::GUI::Sidebar::build_filament_ams_list(), Slic3r::GUI::TabPrinter::build_unregular_pages(), Slic3r::GUI::CalibUtils::calib_flowrate(), Slic3r::GUI::CalibUtils::calib_generic_auto_pa_cali(), Slic3r::GUI::CalibUtils::calib_generic_PA(), Slic3r::GUI::CalibUtils::calib_max_vol_speed(), Slic3r::GUI::CalibUtils::calib_pa_pattern(), Slic3r::GUI::CalibUtils::calib_retraction(), Slic3r::GUI::CalibUtils::calib_temptue(), Slic3r::GUI::CalibUtils::calib_VFA(), Slic3r::GUI::change_opt_value(), Slic3r::GUI::ConfigManipulation::check_chamber_minimal_temperature(), Slic3r::GUI::ConfigManipulation::check_filament_ironing_spacing(), Slic3r::GUI::ConfigManipulation::check_filament_max_volumetric_speed(), Slic3r::GUI::ConfigManipulation::check_layer_height(), Slic3r::compute_filament_override_value(), Slic3r::PresetBundle::config_from_gcode(), Slic3r::PresetBundle::construct_full_config(), Slic3r::GUI::CreateFilamentPresetDialog::create_dialog_buttons(), Slic3r::GUI::CreatePresetForPrinterDialog::create_dialog_buttons(), Slic3r::ProcessLayer::emit_custom_gcode_per_print_z(), Slic3r::GUI::empty_tray_config(), Slic3r::GCodeProcessor::export_config_for_render(), Slic3r::extend_extruder_variant(), Slic3r::CrealityPrintAgent::fetch_filament_info(), Slic3r::filter_published_config(), Slic3r::PresetBundle::full_fff_config(), Slic3r::PresetBundle::full_sla_config(), Slic3r::PresetBundle::get_filament_presets_for_machine(), Slic3r::PrintConfigDef::handle_legacy_composite(), Slic3r::is_compatible_with_printer(), Slic3r::GUI::ConfigManipulation::layer_height_out_of_range_dialog(), cereal::load(), Slic3r::load_enum_option(), Slic3r::GUI::Plater::load_gcode(), Slic3r::GUI::MenuFactory::load_handy_model(), Slic3r::PresetCollection::load_user_preset(), Slic3r::GUI::FlowRateWizard::on_cali_start(), Slic3r::GUI::GLGizmoBrimEars::on_render_input_window(), Slic3r::GUI::GLGizmoFuzzySkin::on_render_input_window(), Slic3r::GUI::Plater::priv::on_select_bed_type(), Slic3r::GUI::Tab::on_value_change(), Slic3r::PrintBase::output_filename(), Slic3r::GCode::process_layer(), Slic3r::prune_stale_plugin_overrides(), Slic3r::read_config(), Slic3r::PresetBundle::reload_local_bundle(), Slic3r::CLI::run(), Slic3r::Preset::save(), Slic3r::GUI::CalibrationWizard::save_preset(), Slic3r::GUI::CreatePrinterPresetDialog::save_printable_area_config(), Slic3r::PresetBundle::set_calibrate_printer(), Slic3r::GUI::Tab::set_custom_gcode(), Slic3r::GUI::TabFilament::set_custom_gcode(), Slic3r::GCode::set_extruder(), Slic3r::GUI::CalibUtils::set_for_auto_pa_model_and_config(), Slic3r::GUI::PartPlate::set_vase_mode_related_object_config(), anonymous_namespace{OrcaSlicer_profile_validator.cpp}::slice_config(), anonymous_namespace{OrcaSlicer_profile_validator.cpp}::slice_two_color_cube_and_export(), Slic3r::client::MyContext::store_new_variable(), Slic3r::GUI::PlaterPresetComboBox::sync_colour_config(), Slic3r::GUI::Tab::sync_excluder(), Slic3r::GUI::TabPrinter::toggle_options(), Slic3r::GUI::ConfigManipulation::toggle_print_fff_options(), Slic3r::GUI::PresetComboBox::update_ams_color(), Slic3r::PresetCollection::update_compatible_internal(), Slic3r::GUI::CalibrationPresetPage::update_filament_combobox(), Slic3r::GUI::TabPrinter::update_input_shaper_menu(), Slic3r::PrintBase::update_object_placeholders(), Slic3r::update_preset_name_option(), Slic3r::GUI::ConfigManipulation::update_print_fff_config(), and Slic3r::GUI::ConfigManipulation::update_print_sla_config().

Here is the call graph for this function:

◆ set_resolve_capability_fn()

void Slic3r::ConfigBase::set_resolve_capability_fn ( std::function< std::string(std::string, std::string)> fn)
inlinestaticinherited
2893{ resolve_capability_fn = fn; }

References resolve_capability_fn.

Referenced by Slic3r::plugin_hooks::anonymous_namespace{PluginHooks.cpp}::install_capability_resolver(), and Slic3r::plugin_hooks::uninstall().

Here is the caller graph for this function:

◆ setenv_()

void Slic3r::ConfigBase::setenv_ ( ) const
inherited
808{
809 t_config_option_keys opt_keys = this->keys();
810 for (t_config_option_keys::const_iterator it = opt_keys.begin(); it != opt_keys.end(); ++it) {
811 // prepend the SLIC3R_ prefix
812 std::ostringstream ss;
813 ss << "SLIC3R_";
814 ss << *it;
815 std::string envname = ss.str();
816
817 // capitalize environment variable name
818 for (size_t i = 0; i < envname.size(); ++i)
819 envname[i] = (envname[i] <= 'z' && envname[i] >= 'a') ? envname[i]-('a'-'A') : envname[i];
820
821 boost::nowide::setenv(envname.c_str(), this->opt_serialize(*it).c_str(), 1);
822 }
823}

References keys().

Referenced by Slic3r::run_post_process_scripts().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ size()

size_t Slic3r::DynamicConfig::size ( ) const
inline

◆ swap()

void Slic3r::DynamicConfig::swap ( DynamicConfig & other)
inline
2983 {
2984 std::swap(this->options, other.options);
2985 }

References DynamicConfig(), and options.

Here is the call graph for this function:

◆ update_plugin_manifest()

void Slic3r::ConfigBase::update_plugin_manifest ( )
inherited
1678{
1679 // Writes the derived manifest back into this config's "plugins" option (save_to_json writes the
1680 // same manifest into a JSON document instead), so an in-memory backend config carries a resolved
1681 // manifest even when the source preset was never serialized (picked-but-unsaved). Without a
1682 // resolver (CLI/headless) leave whatever manifest was loaded from disk untouched.
1684 return;
1685 if (auto* manifest = this->option<ConfigOptionStrings>("plugins", true))
1686 manifest->values = this->collect_plugin_manifest();
1687}

References collect_plugin_manifest(), option(), and resolve_capability_fn.

Here is the call graph for this function:

◆ cereal::access

friend class cereal::access
friend

References cereal::access.

Referenced by cereal::access.

Member Data Documentation

◆ options

◆ resolve_capability_fn

std::function< std::string(std::string, std::string)> Slic3r::ConfigBase::resolve_capability_fn = nullptr
staticprivateinherited

The documentation for this class was generated from the following files:
  • /home/runner/work/OrcaSlicer/OrcaSlicer/src/libslic3r/Config.hpp
  • /home/runner/work/OrcaSlicer/OrcaSlicer/src/libslic3r/Config.cpp