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

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

Inheritance diagram for Slic3r::DynamicPrintConfig:
Collaboration diagram for Slic3r::DynamicPrintConfig:

Public Member Functions

 DynamicPrintConfig ()
 DynamicPrintConfig (const DynamicPrintConfig &rhs)
 DynamicPrintConfig (DynamicPrintConfig &&rhs) noexcept
 DynamicPrintConfig (const StaticPrintConfig &rhs)
 DynamicPrintConfig (const ConfigBase &rhs)
DynamicPrintConfig & operator= (const DynamicPrintConfig &rhs)
DynamicPrintConfig & operator= (DynamicPrintConfig &&rhs) noexcept
const ConfigDef * def () const override
void normalize_fdm (int used_filaments=0)
void normalize_fdm_1 ()
t_config_option_keys normalize_fdm_2 (int num_objects, int used_filaments=0)
size_t get_parameter_size (const std::string &param_name, size_t extruder_nums)
void set_num_extruders (unsigned int num_extruders)
void set_num_filaments (unsigned int num_filaments)
std::map< std::string, std::string > validate (bool under_cli=false)
void handle_legacy (t_config_option_key &opt_key, std::string &value) const override
void handle_legacy_composite () override
std::string get_filament_type (std::string &displayed_filament_type, int id=0)
bool is_using_different_extruders ()
bool support_different_extruders (int &extruder_count) const
bool has_multi_variant_filament () const
int get_extruder_nozzle_volume_count (int extruder_count, std::vector< std::vector< NozzleVolumeType > > &nozzle_volume_types) const
int get_index_for_extruder (int extruder_or_filament_id, std::string id_name, ExtruderType extruder_type, NozzleVolumeType nozzle_volume_type, std::string variant_name, unsigned int stride=1) const
std::vector< int > update_values_to_printer_extruders (DynamicPrintConfig &printer_config, int extruder_count, int extruder_nozzle_volume_count, std::vector< std::vector< NozzleVolumeType > > &nv_types, std::set< std::string > &key_set, std::string id_name, std::string variant_name, unsigned int stride=1, unsigned int extruder_id=0, NozzleVolumeType filament_nvt=nvtStandard)
void update_values_to_printer_extruders_for_multiple_filaments (DynamicPrintConfig &printer_config, int extruder_count, int extruder_nozzle_volume_count, std::set< std::string > &key_set, std::string id_name, std::string variant_name)
void update_filament_config_values_for_multiple_extruders (DynamicPrintConfig &printer_config, const std::unordered_map< int, std::vector< FilamentVariantUse > > &filament_variant_uses, int extruder_count, int extruder_nozzle_volume_count, std::set< std::string > &key_set, std::string id_name, std::string variant_name, std::vector< int > *slot_machine_indices=nullptr)
void update_non_diff_values_to_base_config (DynamicPrintConfig &new_config, const t_config_option_keys &keys, const std::set< std::string > &different_keys, std::string extruder_id_name, std::string extruder_variant_name, std::set< std::string > &key_set1, std::set< std::string > &key_set2)
void update_diff_values_to_child_config (DynamicPrintConfig &new_config, std::string extruder_id_name, std::string extruder_variant_name, std::set< std::string > &key_set1, std::set< std::string > &key_set2)
int update_values_from_single_to_multi (DynamicPrintConfig &multi_config, std::set< std::string > &key_set, std::string id_name, std::string variant_name)
int update_values_from_multi_to_multi (DynamicPrintConfig &new_config, std::set< std::string > &key_set, std::string id_name, std::string variant_name, std::vector< std::string > &extruder_variants)
int update_values_from_multi_to_multi_2 (const std::vector< std::string > &src_extruder_variants, const std::vector< std::string > &dst_extruder_variants, const DynamicPrintConfig &dst_config, const std::set< std::string > &key_sets)
std::string get_filament_vendor () const
std::string get_filament_type () const
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 ()
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).
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
virtual bool apply_to (ConfigBase &) const
ConfigOption * 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)
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)
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 DynamicPrintConfig full_print_config ()
static DynamicPrintConfig * new_from_defaults_keys (const std::vector< std::string > &keys)
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)

Private Member Functions

template<class Archive>
void serialize (Archive &ar)

Private Attributes

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

Detailed Description

Constructor & Destructor Documentation

◆ DynamicPrintConfig() [1/5]

◆ DynamicPrintConfig() [2/5]

Slic3r::DynamicPrintConfig::DynamicPrintConfig ( const DynamicPrintConfig & rhs)
inline
918: DynamicConfig(rhs) {}

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

Here is the call graph for this function:

◆ DynamicPrintConfig() [3/5]

Slic3r::DynamicPrintConfig::DynamicPrintConfig ( DynamicPrintConfig && rhs)
inlinenoexcept
919: DynamicConfig(std::move(rhs)) {}

References DynamicPrintConfig().

Here is the call graph for this function:

◆ DynamicPrintConfig() [4/5]

Slic3r::DynamicPrintConfig::DynamicPrintConfig ( const StaticPrintConfig & rhs)
explicit
10307 : DynamicConfig(rhs, rhs.keys_ref())
10308{
10309}

References Slic3r::DynamicConfig::DynamicConfig().

Here is the call graph for this function:

◆ DynamicPrintConfig() [5/5]

Slic3r::DynamicPrintConfig::DynamicPrintConfig ( const ConfigBase & rhs)
inlineexplicit
921: DynamicConfig(rhs) {}

References Slic3r::DynamicConfig::DynamicConfig().

Here is the call graph for this function:

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
std::string t_config_option_key
Definition Config.hpp:96

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
inlineinherited
3080{ return options.cbegin(); }
std::map< t_config_option_key, std::unique_ptr< ConfigOption > > options
Definition Config.hpp:3119

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
inlineinherited
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 ( )
inlineinherited
2988 {
2989 this->options.clear();
2990 }

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

Here is the caller graph for this function:

◆ def()

◆ 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
inherited
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
inherited

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
inlineinherited
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
inherited
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
inherited
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)
inlineinherited
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:

◆ full_print_config()

DynamicPrintConfig Slic3r::DynamicPrintConfig::full_print_config ( )
static
10303{
10304 return DynamicPrintConfig((const PrintRegionConfig&)FullPrintConfig::defaults());
10305}
DynamicPrintConfig()
Definition PrintConfig.hpp:917
zaa_minimize_perimeter_height PrintRegionConfig
Definition PrintConfig.hpp:2183

References DynamicPrintConfig(), and Slic3r::PrintRegionConfig.

Here is the call 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:

◆ get_extruder_nozzle_volume_count()

int Slic3r::DynamicPrintConfig::get_extruder_nozzle_volume_count ( int extruder_count,
std::vector< std::vector< NozzleVolumeType > > & nozzle_volume_types ) const
11605{
11606 int count = extruder_count;
11607 auto opt_extruder_nozzle_stats = dynamic_cast<const ConfigOptionStrings*>(this->option("extruder_nozzle_stats"));
11608 nozzle_volume_types.resize(extruder_count, std::vector<NozzleVolumeType>{});
11609 if (opt_extruder_nozzle_stats && (int(opt_extruder_nozzle_stats->values.size()) == extruder_count)) {
11610 std::vector<std::map<NozzleVolumeType, int>> extruder_nozzle_counts = get_extruder_nozzle_stats(opt_extruder_nozzle_stats->values);
11611 count = 0;
11612 for (int i = 0; i < extruder_count; i++)
11613 {
11614 count += extruder_nozzle_counts[i].size();
11615 // std::map iteration order gives the canonical slot order: ascending NozzleVolumeType
11616 for (auto& iter : extruder_nozzle_counts[i])
11617 nozzle_volume_types[i].push_back(iter.first);
11618 }
11619 }
11620 return count;
11621}
static unsigned int count
Definition AuxiliaryDataViewModel.cpp:246
std::vector< std::map< NozzleVolumeType, int > > get_extruder_nozzle_stats(const std::vector< std::string > &strs)
Definition PrintConfig.cpp:940

References count, Slic3r::get_extruder_nozzle_stats(), Slic3r::ConfigBase::option(), and Slic3r::ConfigOptionVector< T >::resize().

Referenced by Slic3r::PresetBundle::construct_full_config(), and Slic3r::PresetBundle::full_fff_config().

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

◆ get_filament_type() [1/2]

std::string Slic3r::DynamicPrintConfig::get_filament_type ( ) const
11594{
11595 const ConfigOptionStrings* opt = dynamic_cast<const ConfigOptionStrings*> (option("filament_type"));
11596 if (opt && !opt->values.empty())
11597 {
11598 return opt->values[0];
11599 }
11600
11601 return std::string();
11602}
T * opt(const t_config_option_key &opt_key, bool create=false)
Definition Config.hpp:3007

References Slic3r::DynamicConfig::opt(), and Slic3r::ConfigBase::option().

Here is the call graph for this function:

◆ get_filament_type() [2/2]

std::string Slic3r::DynamicPrintConfig::get_filament_type ( std::string & displayed_filament_type,
int id = 0 )
10726{
10727 auto* filament_id = dynamic_cast<const ConfigOptionStrings*>(this->option("filament_id"));
10728 auto* filament_type = dynamic_cast<const ConfigOptionStrings*>(this->option("filament_type"));
10729 auto* filament_is_support = dynamic_cast<const ConfigOptionBools*>(this->option("filament_is_support"));
10730
10731 // get_at() on an empty vector option is undefined behavior (.front() of an empty vector),
10732 // and e.g. filament_id is never populated on a CLI from-scratch slice - treat an empty
10733 // option the same as a missing one.
10734 if (filament_id && filament_id->values.empty())
10735 filament_id = nullptr;
10736 if (filament_is_support && filament_is_support->values.empty())
10737 filament_is_support = nullptr;
10738
10739 if (!filament_type || filament_type->values.empty())
10740 return "";
10741
10742 if (!filament_is_support) {
10743 if (filament_type) {
10744 displayed_filament_type = filament_type->get_at(id);
10745 return filament_type->get_at(id);
10746 }
10747 else {
10748 displayed_filament_type = "";
10749 return "";
10750 }
10751 }
10752 else {
10753 bool is_support = filament_is_support ? filament_is_support->get_at(id) : false;
10754 if (is_support) {
10755 if (filament_id) {
10756 if (filament_id->get_at(id) == "GFS00") {
10757 displayed_filament_type = "Sup.PLA";
10758 return "PLA-S";
10759 }
10760 else if (filament_id->get_at(id) == "GFS01") {
10761 displayed_filament_type = "Sup.PA";
10762 return "PA-S";
10763 }
10764 else {
10765 if (filament_type->get_at(id) == "PLA") {
10766 displayed_filament_type = "Sup.PLA";
10767 return "PLA-S";
10768 }
10769 else if (filament_type->get_at(id) == "PA") {
10770 displayed_filament_type = "Sup.PA";
10771 return "PA-S";
10772 }
10773 else {
10774 displayed_filament_type = filament_type->get_at(id);
10775 return filament_type->get_at(id);
10776 }
10777 }
10778 }
10779 else {
10780 if (filament_type->get_at(id) == "PLA") {
10781 displayed_filament_type = "Sup.PLA";
10782 return "PLA-S";
10783 } else if (filament_type->get_at(id) == "PA") {
10784 displayed_filament_type = "Sup.PA";
10785 return "PA-S";
10786 } else {
10787 displayed_filament_type = filament_type->get_at(id);
10788 return filament_type->get_at(id);
10789 }
10790 }
10791 }
10792 else {
10793 displayed_filament_type = filament_type->get_at(id);
10794 return filament_type->get_at(id);
10795 }
10796 }
10797 return "PLA";
10798}
zaa_minimize_perimeter_height filament_type((ConfigOptionBools, filament_soluble))((ConfigOptionStrings
ConfigOptionBoolsTempl< false > ConfigOptionBools
Definition Config.hpp:2066
bool is_support(ExtrusionRole role)
Definition ExtrusionEntity.hpp:113

References Slic3r::filament_type(), Slic3r::is_support(), and Slic3r::ConfigBase::option().

Referenced by Slic3r::GUI::_collect_filament_info(), Slic3r::GUI::Sidebar::collect_physical_filament_info(), Slic3r::GUI::Plater::export_3mf(), Slic3r::GUI::filament_type_for_color_decompose(), Slic3r::GUI::SyncAmsInfoDialog::generate_override_fix_ams_list(), Slic3r::PresetBundle::get_used_tpu_filaments(), Slic3r::GUI::SelectMachineDialog::reset_and_sync_ams_list(), Slic3r::GUI::SyncAmsInfoDialog::reset_and_sync_ams_list(), Slic3r::GUI::Plater::send_gcode_legacy(), and Slic3r::GUI::SendMultiMachinePage::sync_ams_list().

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

◆ get_filament_vendor()

std::string Slic3r::DynamicPrintConfig::get_filament_vendor ( ) const
11581{
11582 const ConfigOptionStrings* opt = dynamic_cast<const ConfigOptionStrings*> (option("filament_vendor"));
11583 if (opt && !opt->values.empty())
11584 {
11585 return opt->values[0];
11586 }
11587
11588 return std::string();
11589}

References Slic3r::DynamicConfig::opt(), and Slic3r::ConfigBase::option().

Referenced by Slic3r::GUI::_collect_filament_info().

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

◆ get_index_for_extruder()

int Slic3r::DynamicPrintConfig::get_index_for_extruder ( int extruder_or_filament_id,
std::string id_name,
ExtruderType extruder_type,
NozzleVolumeType nozzle_volume_type,
std::string variant_name,
unsigned int stride = 1 ) const
10860{
10861 int ret = -1;
10862
10863 auto variant_opt = dynamic_cast<const ConfigOptionStrings*>(this->option(variant_name));
10864 const ConfigOptionInts* id_opt = id_name.empty()?nullptr: dynamic_cast<const ConfigOptionInts*>(this->option(id_name));
10865 const ConfigOptionStrings* extruder_variant_list_opt = dynamic_cast<const ConfigOptionStrings*>(this->option("extruder_variant_list"));
10866 auto generated_extruder_id = [extruder_variant_list_opt](int target_index) {
10867 if (!extruder_variant_list_opt)
10868 return 0;
10869
10870 int variant_index = 0;
10871 for (int extruder_index = 0; extruder_index < int(extruder_variant_list_opt->values.size()); ++extruder_index) {
10872 std::vector<std::string> variants_list;
10873 boost::split(variants_list, extruder_variant_list_opt->get_at(extruder_index), boost::is_any_of(","), boost::token_compress_on);
10874 for (std::string variant : variants_list) {
10875 boost::trim(variant);
10876 if (variant.empty())
10877 continue;
10878 if (variant_index == target_index)
10879 return extruder_index + 1;
10880 ++variant_index;
10881 }
10882 }
10883 return 0;
10884 };
10885
10886 if (variant_opt != nullptr) {
10887 int v_size = variant_opt->values.size();
10888 const bool has_complete_id_map = id_opt && int(id_opt->values.size()) >= v_size;
10889 // nvtHybrid not supported in presets, switch to nvtStandard to match the preset values
10892 std::string extruder_variant = get_extruder_variant_string(extruder_type, nozzle_volume_type);
10893 for (int index = 0; index < v_size; index++)
10894 {
10895 const std::string variant = variant_opt->get_at(index);
10896 if (extruder_variant == variant) {
10897 if (id_opt) {
10898 const int id = has_complete_id_map ? id_opt->get_at(index) : generated_extruder_id(index);
10899 if (id == extruder_or_filament_id) {
10900 ret = index * stride;
10901 break;
10902 }
10903 }
10904 else {
10905 ret = index * stride;
10906 break;
10907 }
10908
10909 }
10910 }
10911 }
10912 return ret;
10913}
@ nvtHybrid
Definition PrintConfig.hpp:621
@ nvtStandard
Definition PrintConfig.hpp:619
std::string get_extruder_variant_string(ExtruderType extruder_type, NozzleVolumeType nozzle_volume_type)
Definition PrintConfig.cpp:777
ConfigOptionIntsTempl< false > ConfigOptionInts
Definition Config.hpp:1154
zaa_minimize_perimeter_height nozzle_volume_type((ConfigOptionStrings, extruder_ams_count))((ConfigOptionStrings

References Slic3r::ConfigOptionVector< T >::get_at(), Slic3r::ConfigOptionVector< int >::get_at(), Slic3r::get_extruder_variant_string(), Slic3r::nozzle_volume_type(), Slic3r::nvtHybrid, Slic3r::nvtStandard, Slic3r::ConfigBase::option(), Slic3r::ConfigOptionVector< T >::values, and Slic3r::ConfigOptionVector< int >::values.

Referenced by Slic3r::PresetBundle::get_filament_variant_index(), Slic3r::get_index_for_extruder_parameter(), update_filament_config_values_for_multiple_extruders(), update_values_to_printer_extruders(), and update_values_to_printer_extruders_for_multiple_filaments().

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

◆ get_parameter_size()

size_t Slic3r::DynamicPrintConfig::get_parameter_size ( const std::string & param_name,
size_t extruder_nums )
10599{
10600 constexpr size_t default_param_length = 1;
10601 size_t filament_variant_length = default_param_length;
10602 size_t process_variant_length = default_param_length;
10603 size_t machine_variant_length = default_param_length;
10604
10605 if (this->has("filament_extruder_variant"))
10606 filament_variant_length = this->option<ConfigOptionStrings>("filament_extruder_variant")->size();
10607 if (this->has("print_extruder_variant"))
10608 process_variant_length = this->option<ConfigOptionStrings>("print_extruder_variant")->size();
10609 if (this->has("printer_extruder_variant"))
10610 machine_variant_length = this->option<ConfigOptionStrings>("printer_extruder_variant")->size();
10611
10612 if (printer_options_with_variant_1.count(param_name) > 0) {
10613 return machine_variant_length;
10614 }
10615 else if (printer_options_with_variant_2.count(param_name) > 0) {
10616 return machine_variant_length * 2;
10617 }
10618 else if (filament_options_with_variant.count(param_name) > 0) {
10619 return filament_variant_length;
10620 }
10621 else if (print_options_with_variant.count(param_name) > 0) {
10622 return process_variant_length;
10623 }
10624 return extruder_nums;
10625}
bool has(const t_config_option_key &opt_key) const
Definition Config.hpp:2697
std::set< std::string > printer_options_with_variant_1
Definition PrintConfig.cpp:10236
std::set< std::string > printer_options_with_variant_2
Definition PrintConfig.cpp:10270
std::set< std::string > filament_options_with_variant
Definition PrintConfig.cpp:10150
std::set< std::string > print_options_with_variant
Definition PrintConfig.cpp:10102

References Slic3r::filament_options_with_variant, Slic3r::ConfigOptionResolver::has(), Slic3r::ConfigBase::option(), Slic3r::print_options_with_variant, and Slic3r::printer_options_with_variant_2.

Referenced by Slic3r::extend_extruder_variant(), and set_num_extruders().

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

◆ handle_legacy()

void Slic3r::DynamicPrintConfig::handle_legacy ( t_config_option_key & opt_key,
std::string & value ) const
inlineoverridevirtual

Reimplemented from Slic3r::ConfigBase.

952 { PrintConfigDef::handle_legacy(opt_key, value); }
static void handle_legacy(t_config_option_key &opt_key, std::string &value)
Definition PrintConfig.cpp:9745

References Slic3r::PrintConfigDef::handle_legacy().

Here is the call graph for this function:

◆ handle_legacy_composite()

void Slic3r::DynamicPrintConfig::handle_legacy_composite ( )
inlineoverridevirtual

Reimplemented from Slic3r::ConfigBase.

static void handle_legacy_composite(DynamicPrintConfig &config)
Definition PrintConfig.cpp:10043

References Slic3r::PrintConfigDef::handle_legacy_composite().

Here is the call 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:

◆ has_multi_variant_filament()

bool Slic3r::DynamicPrintConfig::has_multi_variant_filament ( ) const
10830{
10831 auto variants = dynamic_cast<const ConfigOptionStrings*>(this->option("filament_extruder_variant"));
10832 auto diameters = dynamic_cast<const ConfigOptionFloats*>(this->option("filament_diameter"));
10833 return variants && diameters && variants->size() > diameters->size();
10834}
size_t size() const override
Definition Config.hpp:722

References Slic3r::ConfigBase::option().

Referenced by Slic3r::PresetBundle::construct_full_config(), and Slic3r::PresetBundle::full_fff_config().

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

◆ is_using_different_extruders()

bool Slic3r::DynamicPrintConfig::is_using_different_extruders ( )
10801{
10802 bool ret = false;
10803
10804 auto nozzle_diameters_opt = dynamic_cast<const ConfigOptionFloats*>(this->option("nozzle_diameter"));
10805 if (nozzle_diameters_opt != nullptr) {
10806 int size = nozzle_diameters_opt->size();
10807 if (size > 1) {
10808 auto extruder_type_opt = dynamic_cast<const ConfigOptionEnumsGeneric*>(this->option("extruder_type"));
10809 auto nozzle_volume_type_opt = dynamic_cast<const ConfigOptionEnumsGeneric*>(this->option("nozzle_volume_type"));
10810 if (extruder_type_opt && nozzle_volume_type_opt) {
10811 ExtruderType extruder_type = (ExtruderType)(extruder_type_opt->get_at(0));
10812 NozzleVolumeType nozzle_volume_type = (NozzleVolumeType)(nozzle_volume_type_opt->get_at(0));
10813 for (int index = 1; index < size; index++)
10814 {
10815 ExtruderType extruder_type_1 = (ExtruderType)(extruder_type_opt->get_at(index));
10816 NozzleVolumeType nozzle_volume_type_1 = (NozzleVolumeType)(nozzle_volume_type_opt->get_at(index));
10817 if ((extruder_type_1 != extruder_type) || (nozzle_volume_type_1 != nozzle_volume_type)) {
10818 ret = true;
10819 break;
10820 }
10821 }
10822 }
10823 }
10824 }
10825
10826 return ret;
10827}
size_t size() const
Definition Config.hpp:3082
NozzleVolumeType
Definition PrintConfig.hpp:618
ConfigOptionEnumsGenericTempl< false > ConfigOptionEnumsGeneric
Definition Config.hpp:2311
ExtruderType
Definition PrintConfig.hpp:612

References Slic3r::nozzle_volume_type(), Slic3r::ConfigBase::option(), and Slic3r::DynamicConfig::size().

Here is the call graph for this function:

◆ keys()

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

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_config_option_keys keys() const override
Definition Config.cpp:1919

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:

◆ new_from_defaults_keys()

DynamicPrintConfig * Slic3r::DynamicPrintConfig::new_from_defaults_keys ( const std::vector< std::string > & keys)
static
10312{
10313 auto *out = new DynamicPrintConfig();
10314 out->apply_only(FullPrintConfig::defaults(), keys);
10315 return out;
10316}

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

Referenced by Slic3r::GUI::ConfigWizard::ConfigWizard(), Slic3r::GUI::ObjectList::add_category_to_settings_from_frequent(), Slic3r::GUI::ObjectList::add_category_to_settings_from_selection(), Slic3r::GUI::GLGizmoBrimEars::get_config_options(), and Slic3r::GUI::ObjectList::merge().

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

◆ normalize_fdm()

void Slic3r::DynamicPrintConfig::normalize_fdm ( int used_filaments = 0)
10346{
10347 if (this->has("extruder")) {
10348 int extruder = this->option("extruder")->getInt();
10349 this->erase("extruder");
10350 if (extruder != 0) {
10351 if (!this->has("sparse_infill_filament_id") || this->option("sparse_infill_filament_id")->getInt() == 0)
10352 this->option("sparse_infill_filament_id", true)->setInt(extruder);
10353 if (!this->has("outer_wall_filament_id") || this->option("outer_wall_filament_id")->getInt() == 0)
10354 this->option("outer_wall_filament_id", true)->setInt(extruder);
10355 if (!this->has("inner_wall_filament_id") || this->option("inner_wall_filament_id")->getInt() == 0)
10356 this->option("inner_wall_filament_id", true)->setInt(extruder);
10357 if (!this->has("internal_solid_filament_id") || this->option("internal_solid_filament_id")->getInt() == 0)
10358 this->option("internal_solid_filament_id", true)->setInt(extruder);
10359 if (!this->has("top_surface_filament_id") || this->option("top_surface_filament_id")->getInt() == 0)
10360 this->option("top_surface_filament_id", true)->setInt(extruder);
10361 if (!this->has("bottom_surface_filament_id") || this->option("bottom_surface_filament_id")->getInt() == 0)
10362 this->option("bottom_surface_filament_id", true)->setInt(extruder);
10363 // Don't propagate the current extruder to support.
10364 // For non-soluble supports, the default "0" extruder means to use the active extruder,
10365 // for soluble supports one certainly does not want to set the extruder to non-soluble.
10366 // if (!this->has("support_filament"))
10367 // this->option("support_filament", true)->setInt(extruder);
10368 // if (!this->has("support_interface_filament"))
10369 // this->option("support_interface_filament", true)->setInt(extruder);
10370 }
10371 }
10372
10373 if (this->has("sparse_infill_filament_id")) {
10374 int sparse_infill_filament_id = this->option("sparse_infill_filament_id")->getInt();
10375 if (sparse_infill_filament_id > 0 && (!this->has("internal_solid_filament_id") || this->option("internal_solid_filament_id")->getInt() == 0))
10376 this->option("internal_solid_filament_id", true)->setInt(sparse_infill_filament_id);
10377 }
10378
10379 const int internal_solid = this->has("internal_solid_filament_id") ? this->option("internal_solid_filament_id")->getInt() : 0;
10380 const int top_surface = this->has("top_surface_filament_id") ? this->option("top_surface_filament_id")->getInt() : 0;
10381 const int bottom_surface = this->has("bottom_surface_filament_id") ? this->option("bottom_surface_filament_id")->getInt() : 0;
10382
10383 if (internal_solid == 0 && top_surface > 0)
10384 this->option("internal_solid_filament_id", true)->setInt(top_surface);
10385 if (internal_solid == 0 && bottom_surface > 0)
10386 this->option("internal_solid_filament_id", true)->setInt(bottom_surface);
10387 if (top_surface == 0 && internal_solid > 0)
10388 this->option("top_surface_filament_id", true)->setInt(internal_solid);
10389 if (bottom_surface == 0 && internal_solid > 0)
10390 this->option("bottom_surface_filament_id", true)->setInt(internal_solid);
10391
10392 if (this->has("spiral_mode") && this->opt<ConfigOptionBool>("spiral_mode", true)->value) {
10393 {
10394 // this should be actually done only on the spiral layers instead of all
10395 auto* opt = this->opt<ConfigOptionBools>("retract_when_changing_layer", true);
10396 opt->values.assign(opt->values.size(), false); // set all values to false
10397 // Disable retract on layer change also for filament overrides.
10398 auto* opt_n = this->opt<ConfigOptionBoolsNullable>("filament_retract_when_changing_layer", true);
10399 opt_n->values.assign(opt_n->values.size(), false); // Set all values to false.
10400 }
10401 {
10402 this->opt<ConfigOptionInt>("wall_loops", true)->value = 1;
10403 this->opt<ConfigOptionBool>("alternate_extra_wall", true)->value = false;
10404 this->opt<ConfigOptionInt>("top_shell_layers", true)->value = 0;
10405 this->opt<ConfigOptionPercent>("sparse_infill_density", true)->value = 0;
10406 }
10407 }
10408
10409 if (auto *opt_gcode_resolution = this->opt<ConfigOptionFloat>("resolution", false); opt_gcode_resolution)
10410 // Resolution will be above 1um.
10411 opt_gcode_resolution->value = std::max(opt_gcode_resolution->value, 0.001);
10412
10413 // BBS
10414 ConfigOptionBool* ept_opt = this->option<ConfigOptionBool>("enable_prime_tower");
10415 if (used_filaments > 0 && ept_opt != nullptr) {
10416 ConfigOptionBool* islh_opt = this->option<ConfigOptionBool>("independent_support_layer_height", true);
10417 //ConfigOptionBool* alh_opt = this->option<ConfigOptionBool>("adaptive_layer_height");
10418 ConfigOptionEnum<PrintSequence>* ps_opt = this->option<ConfigOptionEnum<PrintSequence>>("print_sequence");
10419
10420 ConfigOptionEnum<TimelapseType>* timelapse_opt = this->option<ConfigOptionEnum<TimelapseType>>("timelapse_type");
10421 bool is_smooth_timelapse = timelapse_opt != nullptr && timelapse_opt->value == TimelapseType::tlSmooth;
10422 if (!is_smooth_timelapse && (used_filaments == 1 || ps_opt->value == PrintSequence::ByObject)) {
10423 ept_opt->value = false;
10424 }
10425
10426 if (ept_opt->value) {
10427 if (islh_opt)
10428 islh_opt->value = false;
10429 //if (alh_opt)
10430 // alh_opt->value = false;
10431 }
10432 /* BBS: MusangKing - not sure if this is still valid, just comment it out cause "Independent support layer height" is re-opened.
10433 else {
10434 if (islh_opt)
10435 islh_opt->value = true;
10436 }
10437 */
10438 }
10439}
const ConfigOption * option(const t_config_option_key &opt_key) const
Definition Config.hpp:2699
virtual int getInt() const
Definition Config.hpp:294
virtual void setInt(int)
Definition Config.hpp:297
bool erase(const t_config_option_key &opt_key)
Definition Config.hpp:2992
sparse_infill_filament_id((ConfigOptionFloatOrPercent, sparse_infill_line_width))((ConfigOptionPercent
@ tlSmooth
Definition PrintConfig.hpp:470
@ ByObject
Definition PrintConfig.hpp:312

References Slic3r::ByObject, Slic3r::DynamicConfig::erase(), Slic3r::ConfigOption::getInt(), Slic3r::ConfigOptionResolver::has(), Slic3r::DynamicConfig::opt(), Slic3r::ConfigBase::option(), Slic3r::ConfigOption::setInt(), Slic3r::sparse_infill_filament_id(), Slic3r::tlSmooth, and Slic3r::ConfigOptionSingle< T >::value.

Referenced by Slic3r::PrintObject::object_config_from_model_object().

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

◆ normalize_fdm_1()

void Slic3r::DynamicPrintConfig::normalize_fdm_1 ( )
10443{
10444 if (this->has("extruder")) {
10445 int extruder = this->option("extruder")->getInt();
10446 this->erase("extruder");
10447 if (extruder != 0) {
10448 if (!this->has("sparse_infill_filament_id") || this->option("sparse_infill_filament_id")->getInt() == 0)
10449 this->option("sparse_infill_filament_id", true)->setInt(extruder);
10450 if (!this->has("outer_wall_filament_id") || this->option("outer_wall_filament_id")->getInt() == 0)
10451 this->option("outer_wall_filament_id", true)->setInt(extruder);
10452 if (!this->has("inner_wall_filament_id") || this->option("inner_wall_filament_id")->getInt() == 0)
10453 this->option("inner_wall_filament_id", true)->setInt(extruder);
10454 if (!this->has("internal_solid_filament_id") || this->option("internal_solid_filament_id")->getInt() == 0)
10455 this->option("internal_solid_filament_id", true)->setInt(extruder);
10456 if (!this->has("top_surface_filament_id") || this->option("top_surface_filament_id")->getInt() == 0)
10457 this->option("top_surface_filament_id", true)->setInt(extruder);
10458 if (!this->has("bottom_surface_filament_id") || this->option("bottom_surface_filament_id")->getInt() == 0)
10459 this->option("bottom_surface_filament_id", true)->setInt(extruder);
10460 // Don't propagate the current extruder to support.
10461 // For non-soluble supports, the default "0" extruder means to use the active extruder,
10462 // for soluble supports one certainly does not want to set the extruder to non-soluble.
10463 // if (!this->has("support_filament"))
10464 // this->option("support_filament", true)->setInt(extruder);
10465 // if (!this->has("support_interface_filament"))
10466 // this->option("support_interface_filament", true)->setInt(extruder);
10467 }
10468 }
10469
10470 if (this->has("sparse_infill_filament_id")) {
10471 int sparse_infill_filament_id = this->option("sparse_infill_filament_id")->getInt();
10472 if (sparse_infill_filament_id > 0 && (!this->has("internal_solid_filament_id") || this->option("internal_solid_filament_id")->getInt() == 0))
10473 this->option("internal_solid_filament_id", true)->setInt(sparse_infill_filament_id);
10474 }
10475
10476 const int internal_solid = this->has("internal_solid_filament_id") ? this->option("internal_solid_filament_id")->getInt() : 0;
10477 const int top_surface = this->has("top_surface_filament_id") ? this->option("top_surface_filament_id")->getInt() : 0;
10478 const int bottom_surface = this->has("bottom_surface_filament_id") ? this->option("bottom_surface_filament_id")->getInt() : 0;
10479
10480 if (internal_solid == 0 && top_surface > 0)
10481 this->option("internal_solid_filament_id", true)->setInt(top_surface);
10482 if (internal_solid == 0 && bottom_surface > 0)
10483 this->option("internal_solid_filament_id", true)->setInt(bottom_surface);
10484 if (top_surface == 0 && internal_solid > 0)
10485 this->option("top_surface_filament_id", true)->setInt(internal_solid);
10486 if (bottom_surface == 0 && internal_solid > 0)
10487 this->option("bottom_surface_filament_id", true)->setInt(internal_solid);
10488
10489 if (this->has("spiral_mode") && this->opt<ConfigOptionBool>("spiral_mode", true)->value) {
10490 {
10491 // this should be actually done only on the spiral layers instead of all
10492 auto* opt = this->opt<ConfigOptionBools>("retract_when_changing_layer", true);
10493 opt->values.assign(opt->values.size(), false); // set all values to false
10494 // Disable retract on layer change also for filament overrides.
10495 auto* opt_n = this->opt<ConfigOptionBoolsNullable>("filament_retract_when_changing_layer", true);
10496 opt_n->values.assign(opt_n->values.size(), false); // Set all values to false.
10497 }
10498 {
10499 this->opt<ConfigOptionInt>("wall_loops", true)->value = 1;
10500 this->opt<ConfigOptionBool>("alternate_extra_wall", true)->value = false;
10501 this->opt<ConfigOptionInt>("top_shell_layers", true)->value = 0;
10502 this->opt<ConfigOptionPercent>("sparse_infill_density", true)->value = 0;
10503 }
10504 }
10505
10506 if (auto *opt_gcode_resolution = this->opt<ConfigOptionFloat>("resolution", false); opt_gcode_resolution)
10507 // Resolution will be above 1um.
10508 opt_gcode_resolution->value = std::max(opt_gcode_resolution->value, 0.001);
10509
10510 return;
10511}

References Slic3r::DynamicConfig::erase(), Slic3r::ConfigOption::getInt(), Slic3r::ConfigOptionResolver::has(), Slic3r::DynamicConfig::opt(), Slic3r::ConfigBase::option(), Slic3r::ConfigOption::setInt(), and Slic3r::sparse_infill_filament_id().

Referenced by Slic3r::Print::apply().

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

◆ normalize_fdm_2()

t_config_option_keys Slic3r::DynamicPrintConfig::normalize_fdm_2 ( int num_objects,
int used_filaments = 0 )
10514{
10515 t_config_option_keys changed_keys;
10516 ConfigOptionBool* ept_opt = this->option<ConfigOptionBool>("enable_prime_tower");
10517 if (used_filaments > 0 && ept_opt != nullptr) {
10518 ConfigOptionBool* islh_opt = this->option<ConfigOptionBool>("independent_support_layer_height", true);
10519 //ConfigOptionBool* alh_opt = this->option<ConfigOptionBool>("adaptive_layer_height");
10520 ConfigOptionEnum<PrintSequence>* ps_opt = this->option<ConfigOptionEnum<PrintSequence>>("print_sequence");
10521
10522 ConfigOptionEnum<TimelapseType>* timelapse_opt = this->option<ConfigOptionEnum<TimelapseType>>("timelapse_type");
10523 bool is_smooth_timelapse = timelapse_opt != nullptr && timelapse_opt->value == TimelapseType::tlSmooth;
10524
10525 ConfigOptionBool *enable_wrapping_opt = this->option<ConfigOptionBool>("enable_wrapping_detection");
10526 bool enable_wrapping = enable_wrapping_opt != nullptr && enable_wrapping_opt->value;
10527
10528 bool has_mixed_filament = false;
10529 {
10530 auto *mixed_opt = this->option<ConfigOptionBools>("filament_is_mixed");
10531 if (mixed_opt)
10532 has_mixed_filament = has_any_mixed_filament(mixed_opt->values);
10533 }
10534 if (!is_smooth_timelapse && !enable_wrapping
10535 && ( (used_filaments == 1 && !has_mixed_filament)
10536 || (ps_opt->value == PrintSequence::ByObject && num_objects > 1))) {
10537 if (ept_opt->value) {
10538 ept_opt->value = false;
10539 changed_keys.push_back("enable_prime_tower");
10540 }
10541 //ept_opt->value = false;
10542 }
10543
10544 if (ept_opt->value) {
10545 if (islh_opt) {
10546 if (islh_opt->value) {
10547 islh_opt->value = false;
10548 changed_keys.push_back("independent_support_layer_height");
10549 }
10550 //islh_opt->value = false;
10551 }
10552 //if (alh_opt) {
10553 // if (alh_opt->value) {
10554 // alh_opt->value = false;
10555 // changed_keys.push_back("adaptive_layer_height");
10556 // }
10557 // //alh_opt->value = false;
10558 //}
10559 }
10560 /* BBS:MusangKing - use "global->support->Independent support layer height" widget to replace previous assignment
10561 else {
10562 if (islh_opt) {
10563 if (!islh_opt->value) {
10564 islh_opt->value = true;
10565 changed_keys.push_back("independent_support_layer_height");
10566 }
10567 //islh_opt->value = true;
10568 }
10569 }
10570 */
10571 }
10572
10573 return changed_keys;
10574}
bool has_any_mixed_filament(const std::vector< unsigned char > &is_mixed)
Definition FilamentMixer.cpp:486

References Slic3r::ByObject, Slic3r::has_any_mixed_filament(), Slic3r::ConfigBase::option(), Slic3r::tlSmooth, and Slic3r::ConfigOptionSingle< T >::value.

Referenced by Slic3r::Print::apply().

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
inlineinherited
2980{ return ! (*this == rhs); }

References DynamicConfig().

Here is the call graph for this function:

◆ operator+=() [1/2]

DynamicConfig & Slic3r::DynamicConfig::operator+= ( const DynamicConfig & rhs)
inlineinherited
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)
inlineinherited
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]

DynamicPrintConfig & Slic3r::DynamicPrintConfig::operator= ( const DynamicPrintConfig & rhs)
inline
923{ DynamicConfig::operator=(rhs); return *this; }
DynamicConfig & operator=(const DynamicConfig &rhs)
Definition Config.hpp:2921

References DynamicPrintConfig(), and Slic3r::DynamicConfig::operator=().

Here is the call graph for this function:

◆ operator=() [2/2]

DynamicPrintConfig & Slic3r::DynamicPrintConfig::operator= ( DynamicPrintConfig && rhs)
inlinenoexcept
924{ DynamicConfig::operator=(std::move(rhs)); return *this; }

References DynamicPrintConfig(), and Slic3r::DynamicConfig::operator=().

Here is the call graph for this function:

◆ operator==()

bool Slic3r::DynamicConfig::operator== ( const DynamicConfig & rhs) const
inherited
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
inlineinherited
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 )
inlineinherited
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
inlineinherited
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
inherited
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

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
inlineinherited
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
inlineinherited
3066{ return static_cast<ENUM>(this->option(opt_key)->getInt()); }

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
inlineinherited
3068{ return dynamic_cast<const ConfigOptionEnumsGeneric*>(this->option(opt_key))->get_at(idx); }

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
inlineinherited
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)
inlineinherited
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
inlineinherited
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 )
inherited
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
inherited
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 )
inlineinherited
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
inlineinherited
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 )
inlineinherited
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
inlineinherited
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)
inlineinherited
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
inlineinherited
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 )
inlineinherited
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
inlineinherited
3059{ return dynamic_cast<const ConfigOptionInts*>(this->option(opt_key))->get_at(idx); }

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 )
inlineinherited
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
inlineinherited
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
inlineinherited
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 )
inlineinherited
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 )
inlineinherited
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
inlineinherited
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/2]

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

◆ option() [2/2]

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/2]

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/2]

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
overridevirtualinherited

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 )
overridevirtualinherited

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 )
inherited
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
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 ( )
inherited
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_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
static std::function< std::string(std::string, std::string)> resolve_capability_fn
Definition Config.hpp:2904

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)
inlineprivateinherited
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; }
ConfigOption * option_throw(const t_config_option_key &opt_key, bool create=false)
Definition Config.hpp:2782

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_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 )
inlineinherited
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_num_extruders()

void Slic3r::DynamicPrintConfig::set_num_extruders ( unsigned int num_extruders)
10670{
10671 extend_extruder_variant(*this, num_extruders);
10672
10673 const auto &defaults = FullPrintConfig::defaults();
10674 for (const std::string &key : print_config_def.extruder_option_keys()) {
10675 if (key == "default_filament_profile")
10676 // Don't resize this field, as it is presented to the user at the "Dependencies" page of the Printer profile and we don't want to present
10677 // empty fields there, if not defined by the system profile.
10678 continue;
10679 auto *opt = this->option(key, false);
10680 assert(opt != nullptr);
10681 assert(opt->is_vector());
10682 if (opt != nullptr && opt->is_vector()) {
10683 static_cast<ConfigOptionVectorBase*>(opt)->resize(get_parameter_size(key, num_extruders), defaults.option(key));
10684 }
10685 }
10686}
size_t get_parameter_size(const std::string &param_name, size_t extruder_nums)
Definition PrintConfig.cpp:10598
const std::vector< std::string > & extruder_option_keys() const
Definition PrintConfig.hpp:851
static void extend_extruder_variant(DynamicPrintConfig &config, const unsigned int num_extruders)
Definition PrintConfig.cpp:10630

References Slic3r::extend_extruder_variant(), get_parameter_size(), Slic3r::DynamicConfig::opt(), Slic3r::ConfigBase::option(), and Slic3r::print_config_def.

Referenced by Slic3r::Preset::set_num_extruders().

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

◆ set_num_filaments()

void Slic3r::DynamicPrintConfig::set_num_filaments ( unsigned int num_filaments)
10690{
10691 const auto& defaults = FullPrintConfig::defaults();
10692 for (const std::string& key : print_config_def.filament_option_keys()) {
10693 if (key == "default_filament_profile")
10694 // Don't resize this field, as it is presented to the user at the "Dependencies" page of the Printer profile and we don't want to present
10695 // empty fields there, if not defined by the system profile.
10696 continue;
10697 auto* opt = this->option(key, false);
10698 assert(opt != nullptr);
10699 assert(opt->is_vector());
10700 if (opt != nullptr && opt->is_vector())
10701 static_cast<ConfigOptionVectorBase*>(opt)->resize(num_filaments, defaults.option(key));
10702 }
10703}
const std::vector< std::string > & filament_option_keys() const
Definition PrintConfig.hpp:858

References Slic3r::DynamicConfig::opt(), Slic3r::ConfigBase::option(), and Slic3r::print_config_def.

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
inlineinherited

◆ support_different_extruders()

bool Slic3r::DynamicPrintConfig::support_different_extruders ( int & extruder_count) const
10837{
10838 std::set<std::string> variant_set;
10839
10840 auto nozzle_diameters_opt = dynamic_cast<const ConfigOptionFloats*>(this->option("nozzle_diameter"));
10841 if (nozzle_diameters_opt != nullptr) {
10842 int size = nozzle_diameters_opt->size();
10843 extruder_count = size;
10844 auto extruder_variant_opt = dynamic_cast<const ConfigOptionStrings*>(this->option("extruder_variant_list"));
10845 if (extruder_variant_opt != nullptr) {
10846 for (int index = 0; index < size; index++) {
10847 std::string variant = extruder_variant_opt->get_at(index);
10848 std::vector<std::string> variants_list;
10849 boost::split(variants_list, variant, boost::is_any_of(","), boost::token_compress_on);
10850 if (!variants_list.empty())
10851 variant_set.insert(variants_list.begin(), variants_list.end());
10852 }
10853 }
10854 }
10855
10856 return (variant_set.size() > 1);
10857}

References Slic3r::ConfigBase::option(), and Slic3r::DynamicConfig::size().

Referenced by Slic3r::PresetBundle::construct_full_config(), Slic3r::PresetBundle::full_fff_config(), and Slic3r::PresetBundle::support_different_extruders().

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

◆ swap()

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

References DynamicConfig(), and options.

Here is the call graph for this function:

◆ update_diff_values_to_child_config()

void Slic3r::DynamicPrintConfig::update_diff_values_to_child_config ( DynamicPrintConfig & new_config,
std::string extruder_id_name,
std::string extruder_variant_name,
std::set< std::string > & key_set1,
std::set< std::string > & key_set2 )
12299{
12300 std::vector<int> cur_extruder_ids, target_extruder_ids, variant_index;
12301 std::vector<std::string> cur_extruder_variants, target_extruder_variants;
12302
12303 if (!extruder_id_name.empty()) {
12304 if (this->option(extruder_id_name))
12305 cur_extruder_ids = this->option<ConfigOptionInts>(extruder_id_name)->values;
12306 if (new_config.option(extruder_id_name))
12307 target_extruder_ids = new_config.option<ConfigOptionInts>(extruder_id_name)->values;
12308 }
12309 if (this->option(extruder_variant_name))
12310 cur_extruder_variants = this->option<ConfigOptionStrings>(extruder_variant_name, true)->values;
12311 if (new_config.option(extruder_variant_name))
12312 target_extruder_variants = new_config.option<ConfigOptionStrings>(extruder_variant_name, true)->values;
12313
12314 int cur_variant_count = cur_extruder_variants.size();
12315 int target_variant_count = target_extruder_variants.size();
12316
12317 if (cur_variant_count > 0)
12318 variant_index.resize(cur_variant_count, -1);
12319 else
12320 variant_index.resize(1, 0);
12321
12322 // A parent variant the child does not list (the parent gained it after the child was saved, or the
12323 // child lists none) takes the child's first variant of the same extruder, as slicing does.
12324 // Left unmatched, the parent's value would silently replace the user's.
12325 if (target_variant_count == 0) {
12326 // The child's one value belongs to the extruder of the parent's first variant.
12327 if (cur_variant_count > 0)
12328 variant_index = map_variant_indices(cur_extruder_variants, cur_extruder_ids, {},
12329 cur_extruder_ids.empty() ? std::vector<int>() : std::vector<int>{cur_extruder_ids[0]});
12330 }
12331 else if ((cur_extruder_ids.size() > 0) && cur_variant_count != cur_extruder_ids.size()){
12332 //should not happen
12333 BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(" size of %1% = %2%, not equal to size of %3% = %4%")
12334 %extruder_variant_name %cur_variant_count %extruder_id_name %cur_extruder_ids.size();
12335 }
12336 else if ((target_extruder_ids.size() > 0) && target_variant_count != target_extruder_ids.size()){
12337 //should not happen
12338 BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(" size of %1% = %2%, not equal to size of %3% = %4%")
12339 %extruder_variant_name %target_variant_count %extruder_id_name %target_extruder_ids.size();
12340 }
12341 else if (cur_variant_count > 0) {
12342 variant_index = map_variant_indices(cur_extruder_variants, cur_extruder_ids, target_extruder_variants, target_extruder_ids);
12343 }
12344
12345 const t_config_option_keys &keys = new_config.keys();
12346 for (auto& opt : keys) {
12347 if ((opt == extruder_id_name) || (opt == extruder_variant_name))
12348 continue;
12349 ConfigOption *opt_src = this->option(opt);
12350 const ConfigOption *opt_target = new_config.option(opt);
12351 if (opt_src && opt_target && (*opt_src != *opt_target)) {
12352 BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << boost::format(" change key %1% from base_value %2% to child's value %3%")
12353 %opt %(opt_src->serialize()) %(opt_target->serialize());
12354 if (opt_target->is_scalar()
12355 || ((key_set1.find(opt) == key_set1.end()) && (key_set2.empty() || (key_set2.find(opt) == key_set2.end())))) {
12356 //nothing to do, keep the original one
12357 opt_src->set(opt_target);
12358 }
12359 else {
12360 ConfigOptionVectorBase* opt_vec_src = static_cast<ConfigOptionVectorBase*>(opt_src);
12361 const ConfigOptionVectorBase* opt_vec_dest = static_cast<const ConfigOptionVectorBase*>(opt_target);
12362 int stride = 1;
12363 if (key_set2.find(opt) != key_set2.end())
12364 stride = 2;
12365 // set_only_diff() requires the base vector length to equal variant_index.size()*stride, where
12366 // variant_index is sized from the parent's printer_extruder_variant list (or 1 when it has none).
12367 // Legacy / multi-extruder / multi-variant presets can violate this in either direction when a key's
12368 // stored length and the variant-list length were sized inconsistently - e.g. a Snapmaker U1 base
12369 // (4 nozzles) whose stride-2 machine limits were length-extended to nozzles*2 while its
12370 // printer_extruder_variant list is empty (variant_index == 1), so base length != variant_index*stride.
12371 // Rather than throw (which is caught upstream and DELETES the user preset file), fall back to the
12372 // child's explicit value, which is authoritative for its own extruder/variant layout.
12373 if (opt_vec_src->size() != variant_index.size() * size_t(stride)) {
12374 opt_src->set(opt_target);
12375 }
12376 else
12377 // An override's nil means "disabled" and is the child's value; every other nil column inherits.
12378 opt_vec_src->set_only_diff(opt_vec_dest, variant_index, stride, is_filament_extruder_override_key(opt));
12379 }
12380 }
12381 }
12382 return;
12383}
bool is_filament_extruder_override_key(const std::string &opt_key)
Definition PrintConfig.cpp:130
std::vector< int > map_variant_indices(const std::vector< std::string > &variants, const std::vector< int > &ids, const std::vector< std::string > &from_variants, const std::vector< int > &from_ids)
Definition PrintConfig.cpp:817

References DynamicPrintConfig(), Slic3r::is_filament_extruder_override_key(), Slic3r::ConfigOption::is_scalar(), Slic3r::DynamicConfig::keys(), Slic3r::map_variant_indices(), Slic3r::DynamicConfig::opt(), Slic3r::ConfigBase::option(), Slic3r::ConfigOption::serialize(), Slic3r::ConfigOption::set(), Slic3r::ConfigOptionVectorBase::set_only_diff(), and Slic3r::ConfigOptionVectorBase::size().

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

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

◆ update_filament_config_values_for_multiple_extruders()

void Slic3r::DynamicPrintConfig::update_filament_config_values_for_multiple_extruders ( DynamicPrintConfig & printer_config,
const std::unordered_map< int, std::vector< FilamentVariantUse > > & filament_variant_uses,
int extruder_count,
int extruder_nozzle_volume_count,
std::set< std::string > & key_set,
std::string id_name,
std::string variant_name,
std::vector< int > * slot_machine_indices = nullptr )
12001{
12002 BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(", Line %1%: extruder_count %2%, extruder_nozzle_volume_count %3%")%__LINE__ %extruder_count %extruder_nozzle_volume_count;
12003
12004 auto opt_filament_map = printer_config.option<ConfigOptionInts>("filament_map");
12005 if (!opt_filament_map) {
12006 BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << boost::format(", Line %1%: filament_map option not found, skipping")%__LINE__;
12007 return;
12008 }
12009 std::vector<int> filament_maps = opt_filament_map->values;
12010 size_t filament_count = filament_maps.size();
12011 auto opt_extruder_type = dynamic_cast<const ConfigOptionEnumsGeneric*>(printer_config.option("extruder_type"));
12012 auto opt_nozzle_volume_type = dynamic_cast<const ConfigOptionEnumsGeneric*>(printer_config.option("nozzle_volume_type"));
12013 if (!opt_extruder_type || !opt_nozzle_volume_type) {
12014 BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << boost::format(", Line %1%: extruder_type or nozzle_volume_type option not found, skipping")%__LINE__;
12015 return;
12016 }
12017
12018 auto opt_filament_volume_maps = dynamic_cast<const ConfigOptionInts*>(printer_config.option("filament_volume_map"));
12019 std::vector<int> filament_volume_maps;
12020 // Orca: same sizing guard as the single-slot rebuild above — honour the per-filament volume
12021 // map only when a producer sized it to the filament count.
12022 if (opt_filament_volume_maps && opt_filament_volume_maps->values.size() == filament_count)
12023 filament_volume_maps = opt_filament_volume_maps->values;
12024 auto opt_ids = id_name.empty() ? nullptr : dynamic_cast<const ConfigOptionInts*>(this->option(id_name));
12025
12026 std::vector<int> slot_param_indices;
12027 slot_param_indices.reserve(filament_count * 2);
12028 if (slot_machine_indices) {
12029 slot_machine_indices->clear();
12030 slot_machine_indices->reserve(filament_count * 2);
12031 }
12032
12033 auto resolve_slot = [&](int f_index, ExtruderType extruder_type, NozzleVolumeType nozzle_volume_type, int extruder_id_1based) {
12034 int param_index = get_index_for_extruder(f_index + 1, id_name, extruder_type, nozzle_volume_type, variant_name);
12035 if (param_index < 0) {
12036 BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(", Line %1%: could not found extruder_type %2%, nozzle_volume_type %3%, filament_index %4%, extruder index %5%")
12037 %__LINE__ %s_keys_names_ExtruderType[extruder_type] % s_keys_names_NozzleVolumeType[nozzle_volume_type] % (f_index+1) %extruder_id_1based;
12038 assert(false);
12039 //for some updates happens in a invalid state(caused by popup window)
12040 //we need to avoid crash
12041 param_index = 0;
12042 if (opt_ids) {
12043 for (int i = 0; i < opt_ids->values.size(); i++)
12044 if (opt_ids->values[i] == (f_index + 1)) {
12045 param_index = i;
12046 break;
12047 }
12048 }
12049 }
12050 slot_param_indices.push_back(param_index);
12051 if (slot_machine_indices) {
12052 // Orca: key each output slot to the machine slot of its own variant (the same
12053 // derivation the per-filament slot map uses), so the retract-override nil fallback
12054 // stays aligned when a filament occupies more than one slot.
12055 int machine_index = printer_config.get_index_for_extruder(extruder_id_1based, "print_extruder_id", extruder_type, nozzle_volume_type, "print_extruder_variant");
12056 slot_machine_indices->push_back(std::max(machine_index, 0));
12057 }
12058 };
12059
12060 for (int f_index = 0; f_index < static_cast<int>(filament_count); f_index++) {
12061 auto uses_it = filament_variant_uses.find(f_index);
12062 if (uses_it != filament_variant_uses.end() && !uses_it->second.empty()) {
12063 for (const FilamentVariantUse &use : uses_it->second)
12064 resolve_slot(f_index, use.extruder_type, use.nozzle_volume_type, use.extruder_id + 1);
12065 }
12066 else {
12067 ExtruderType extruder_type = (ExtruderType)(opt_extruder_type->get_at(filament_maps[f_index] - 1));
12068 NozzleVolumeType nozzle_volume_type = (NozzleVolumeType)(opt_nozzle_volume_type->get_at(filament_maps[f_index] - 1));
12069 if ((extruder_nozzle_volume_count > extruder_count || nozzle_volume_type == nvtHybrid) && !filament_volume_maps.empty())
12070 nozzle_volume_type = (NozzleVolumeType)(filament_volume_maps[f_index]);
12071 resolve_slot(f_index, extruder_type, nozzle_volume_type, filament_maps[f_index]);
12072 }
12073 }
12074
12075 const ConfigDef *config_def = this->def();
12076 if (!config_def) {
12077 BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(", Line %1%: can not find config define")%__LINE__;
12078 return;
12079 }
12080 bool has_id_key = !id_name.empty() && key_set.count(id_name) > 0;
12081 for (auto &key : key_set) {
12082 if (has_id_key && key == id_name)
12083 continue;
12084 const ConfigOptionDef *optdef = config_def->get(key);
12085 if (!optdef) {
12086 BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << boost::format(", Line %1%: can not find opt define for %2%")%__LINE__%key;
12087 continue;
12088 }
12089 switch (optdef->type) {
12090 case coStrings: gather_option_values<ConfigOptionStrings, std::string>(__FUNCTION__, key, this->option<ConfigOptionStrings>(key), slot_param_indices); break;
12091 case coInts: gather_option_values<ConfigOptionInts, int>(__FUNCTION__, key, this->option<ConfigOptionInts>(key), slot_param_indices); break;
12092 case coFloats: gather_option_values<ConfigOptionFloats, double>(__FUNCTION__, key, this->option<ConfigOptionFloats>(key), slot_param_indices); break;
12093 case coPercents: gather_option_values<ConfigOptionPercents, double>(__FUNCTION__, key, this->option<ConfigOptionPercents>(key), slot_param_indices); break;
12095 case coBools: gather_option_values<ConfigOptionBools, unsigned char>(__FUNCTION__, key, this->option<ConfigOptionBools>(key), slot_param_indices); break;
12096 case coEnums: gather_option_values<ConfigOptionEnumsGeneric, int>(__FUNCTION__, key, this->option<ConfigOptionEnumsGeneric>(key), slot_param_indices); break;
12097 default:
12098 BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << boost::format(", Line %1%: unsupported option type for %2%")%__LINE__%key;
12099 break;
12100 }
12101 }
12102 // Orca: also require a non-empty id list; get_at on an empty vector is undefined.
12103 if (has_id_key && opt_ids && !opt_ids->values.empty()) {
12104 // remap the id list itself last: the slot resolution above still needs the original ids
12105 std::vector<int> new_values;
12106 new_values.reserve(slot_param_indices.size());
12107 for (int idx : slot_param_indices)
12108 new_values.push_back(opt_ids->get_at(idx));
12109 const_cast<ConfigOptionInts*>(opt_ids)->values = std::move(new_values);
12110 }
12111}
std::vector< int > values
Definition Config.hpp:418
int get_index_for_extruder(int extruder_or_filament_id, std::string id_name, ExtruderType extruder_type, NozzleVolumeType nozzle_volume_type, std::string variant_name, unsigned int stride=1) const
Definition PrintConfig.cpp:10859
const ConfigDef * def() const override
Definition PrintConfig.hpp:930
static void gather_option_values(const char *caller, const std::string &key, OptType *opt, const std::vector< int > &slot_param_indices)
Definition PrintConfig.cpp:11865
@ coPercents
Definition Config.hpp:198
@ coInts
Definition Config.hpp:190
@ coEnums
Definition Config.hpp:216

References DynamicPrintConfig(), Slic3r::coBools, Slic3r::coEnums, Slic3r::coFloats, Slic3r::coFloatsOrPercents, Slic3r::coInts, Slic3r::coPercents, Slic3r::coStrings, def(), Slic3r::FilamentVariantUse::extruder_id, Slic3r::FilamentVariantUse::extruder_type, Slic3r::gather_option_values(), Slic3r::ConfigDef::get(), get_index_for_extruder(), Slic3r::FilamentVariantUse::nozzle_volume_type, Slic3r::nozzle_volume_type(), Slic3r::nvtHybrid, Slic3r::ConfigBase::option(), and Slic3r::ConfigOptionDef::type.

Here is the call graph for this function:

◆ update_non_diff_values_to_base_config()

void Slic3r::DynamicPrintConfig::update_non_diff_values_to_base_config ( DynamicPrintConfig & new_config,
const t_config_option_keys & keys,
const std::set< std::string > & different_keys,
std::string extruder_id_name,
std::string extruder_variant_name,
std::set< std::string > & key_set1,
std::set< std::string > & key_set2 )
12170{
12171 std::vector<int> cur_extruder_ids, target_extruder_ids, variant_index;
12172 std::vector<std::string> cur_extruder_variants, target_extruder_variants;
12173
12174 if (!extruder_id_name.empty()) {
12175 if (this->option(extruder_id_name))
12176 cur_extruder_ids = this->option<ConfigOptionInts>(extruder_id_name)->values;
12177 if (new_config.option(extruder_id_name))
12178 target_extruder_ids = new_config.option<ConfigOptionInts>(extruder_id_name)->values;
12179 }
12180 if (this->option(extruder_variant_name))
12181 cur_extruder_variants = this->option<ConfigOptionStrings>(extruder_variant_name, true)->values;
12182 if (new_config.option(extruder_variant_name))
12183 target_extruder_variants = new_config.option<ConfigOptionStrings>(extruder_variant_name, true)->values;
12184
12185 int cur_variant_count = cur_extruder_variants.size();
12186 int target_variant_count = target_extruder_variants.size();
12187
12188 // A base variant this config does not list (the base gained it after the config was saved, or the
12189 // config lists none) takes this config's first variant of the same extruder, as a user preset's
12190 // values do in update_diff_values_to_child_config. Left unmatched, the base's value would silently
12191 // replace the user's.
12192 variant_index.resize(target_variant_count, -1);
12193 if (cur_variant_count == 0) {
12194 // Defensive: target_variant_count may be 0 if the preset doesn't carry extruder_variant_name.
12195 // In that case keep variant_index empty and let the downstream size checks produce a useful error.
12196 if (!variant_index.empty())
12197 // This config's one value belongs to the extruder of the base's first variant.
12198 variant_index = map_variant_indices(target_extruder_variants, target_extruder_ids, {},
12199 target_extruder_ids.empty() ? std::vector<int>() : std::vector<int>{target_extruder_ids[0]});
12200 }
12201 else if ((cur_extruder_ids.size() > 0) && cur_variant_count != cur_extruder_ids.size()){
12202 //should not happen
12203 BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(" size of %1% = %2%, not equal to size of %3% = %4%")
12204 %extruder_variant_name %cur_variant_count %extruder_id_name %cur_extruder_ids.size();
12205 }
12206 else if ((target_extruder_ids.size() > 0) && target_variant_count != target_extruder_ids.size()){
12207 //should not happen
12208 BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(" size of %1% = %2%, not equal to size of %3% = %4%")
12209 %extruder_variant_name %target_variant_count %extruder_id_name %target_extruder_ids.size();
12210 }
12211 else {
12212 variant_index = map_variant_indices(target_extruder_variants, target_extruder_ids, cur_extruder_variants, cur_extruder_ids);
12213 }
12214
12215 for (auto& opt : keys) {
12216 ConfigOption *opt_src = this->option(opt);
12217 const ConfigOption *opt_target = new_config.option(opt);
12218 if (opt_src && opt_target && (*opt_src != *opt_target)) {
12219 BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << boost::format(" change key %1% from old_value %2% to inherit's value %3%")
12220 %opt %(opt_src->serialize()) %(opt_target->serialize());
12221 if (different_keys.find(opt) == different_keys.end()) {
12222 opt_src->set(opt_target);
12223 }
12224 else {
12225 if (opt_target->is_scalar()
12226 || ((key_set1.find(opt) == key_set1.end()) && (key_set2.empty() || (key_set2.find(opt) == key_set2.end())))) {
12227 //nothing to do, keep the original one
12228 }
12229 else {
12230 // Guard: set_with_restore is parent-shaped and would truncate the child's
12231 // vector when the child has more extruders than the parent (e.g. an IDEX
12232 // preset inheriting from a single-nozzle base). The child's saved value is
12233 // authoritative for its own extruder count, so skip the merge for this key.
12234 if (cur_variant_count > target_variant_count)
12235 continue;
12236
12237 // The variant lists are the base's layout itself, which every other value is
12238 // carried onto: a variant this config lacks keeps its own name and id.
12239 if (opt == extruder_id_name || opt == extruder_variant_name) {
12240 opt_src->set(opt_target);
12241 continue;
12242 }
12243
12244 int stride = 1;
12245 if (key_set2.find(opt) != key_set2.end())
12246 stride = 2;
12247
12248 const size_t restore_n = variant_index.size();
12249 const size_t expected_size = restore_n * size_t(stride);
12250
12251 if (stride == 2) {
12252 // Options in key_set2 are machine limits stored as (normal,silent) pairs per printer variant.
12253 if (opt_src->type() != coFloats || opt_target->type() != coFloats)
12254 throw ConfigurationError((boost::format("%1%: key '%2%' is expected to be ConfigOptionFloats for stride=2.") % __FUNCTION__ % opt).str());
12255
12256 auto *src_f = static_cast<ConfigOptionFloats*>(opt_src);
12257 ConfigOptionFloats rhs_tmp(*static_cast<const ConfigOptionFloats*>(opt_target));
12258
12259 const size_t src_size = src_f->values.size();
12260 const size_t dest_size = rhs_tmp.values.size();
12261 if (src_size != expected_size || dest_size != expected_size)
12262 log_normalize_legacy_vector_size(__FUNCTION__, opt, stride, src_size, dest_size, expected_size, restore_n, cur_variant_count,
12263 target_variant_count, cur_extruder_ids.size(), target_extruder_ids.size(), opt_src, opt_target);
12264
12265 // Normalize src in-place so backup_values indexing is safe, normalize rhs via a temporary copy.
12266 normalize_stride2_floats(*src_f, expected_size);
12267 normalize_stride2_floats(rhs_tmp, expected_size);
12268 src_f->set_with_restore(&rhs_tmp, variant_index, stride);
12269 } else {
12270 ConfigOptionVectorBase* opt_vec_src = static_cast<ConfigOptionVectorBase*>(opt_src);
12271
12272 const size_t src_size = opt_vec_src->size();
12273 const size_t dest_size = static_cast<const ConfigOptionVectorBase*>(opt_target)->size();
12274 if (src_size != expected_size || dest_size != expected_size)
12275 log_normalize_legacy_vector_size(__FUNCTION__, opt, stride, src_size, dest_size, expected_size, restore_n, cur_variant_count,
12276 target_variant_count, cur_extruder_ids.size(), target_extruder_ids.size(), opt_src, opt_target);
12277
12278 if (opt_vec_src->size() != expected_size)
12279 opt_vec_src->resize(expected_size, opt_target);
12280
12281 // Normalize rhs via a cloned temporary (rhs itself is const).
12282 ConfigOptionUniquePtr rhs_owner(opt_target->clone());
12283 ConfigOptionVectorBase *rhs_vec = dynamic_cast<ConfigOptionVectorBase*>(rhs_owner.get());
12284 if (rhs_vec == nullptr)
12285 throw ConfigurationError((boost::format("%1%: key '%2%' is expected to be a vector option.") % __FUNCTION__ % opt).str());
12286 if (rhs_vec->size() != expected_size)
12287 rhs_vec->resize(expected_size, opt_target);
12288
12289 opt_vec_src->set_with_restore(rhs_vec, variant_index, stride);
12290 }
12291 }
12292 }
12293 }
12294 }
12295 return;
12296}
static void log_normalize_legacy_vector_size(const char *fn, const std::string &key, int stride, size_t src_size, size_t dest_size, size_t expected_size, size_t restore_n, int cur_variant_count, int target_variant_count, size_t cur_ids, size_t target_ids, const ConfigOption *opt_src, const ConfigOption *opt_target)
Definition PrintConfig.cpp:12156
static void normalize_stride2_floats(ConfigOptionFloats &opt, size_t expected_size)
Definition PrintConfig.cpp:12116
std::unique_ptr< ConfigOption, ConfigOptionDeleter > ConfigOptionUniquePtr
Definition Config.hpp:258

References DynamicPrintConfig(), Slic3r::ConfigOption::clone(), Slic3r::coFloats, Slic3r::ConfigOption::is_scalar(), Slic3r::DynamicConfig::keys(), Slic3r::map_variant_indices(), Slic3r::DynamicConfig::opt(), Slic3r::ConfigBase::option(), Slic3r::ConfigOptionVectorBase::resize(), Slic3r::ConfigOption::serialize(), Slic3r::ConfigOption::set(), Slic3r::ConfigOptionVectorBase::set_with_restore(), Slic3r::ConfigOptionVectorBase::size(), Slic3r::DynamicConfig::size(), Slic3r::ConfigOption::type(), and Slic3r::ConfigOptionVector< double >::values.

Referenced by Slic3r::Preset::load_external_config().

Here is the call graph for this function:
Here is the caller 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:

◆ update_values_from_multi_to_multi()

int Slic3r::DynamicPrintConfig::update_values_from_multi_to_multi ( DynamicPrintConfig & new_config,
std::set< std::string > & key_set,
std::string id_name,
std::string variant_name,
std::vector< std::string > & extruder_variants )
11085{
11086 int new_extruder_count = new_extruder_variants.size();
11087 std::vector<int> new_variant_indices(new_extruder_count, -1);
11088
11089 auto print_variant_opt = dynamic_cast<const ConfigOptionStrings*>(this->option(variant_name));
11090 auto new_variant_opt = dynamic_cast<const ConfigOptionStrings*>(new_config.option(variant_name));
11091 auto new_print_id_opt = dynamic_cast<const ConfigOptionInts*>(new_config.option(id_name));
11092 if (!print_variant_opt || !new_variant_opt || !new_print_id_opt) {
11093 BOOST_LOG_TRIVIAL(error) << boost::format("%1%:%2%, can not get variant %3%, id %4% from config")%__FUNCTION__ %__LINE__ % variant_name % id_name;
11094 return -1;
11095 }
11096 int variant_count = print_variant_opt->size(), new_variant_count = new_variant_opt->size();
11097
11098 std::vector<std::vector<int>> extruder_variant_indices;
11099 for (int i = 0; i < new_extruder_count; i++)
11100 {
11101 std::vector<int> variant_indices;
11102 for (int j = 0; j < variant_count; j++)
11103 {
11104 if (new_extruder_variants[i] == print_variant_opt->values[j]) {
11105 variant_indices.push_back(j);
11106 }
11107 }
11108
11109 if (variant_indices.empty())
11110 {
11111 //can not find any
11112 variant_indices.resize(variant_count, 0);
11113 for (int j = 0; j < variant_count; j++)
11114 variant_indices[j] = j;
11115 }
11116 extruder_variant_indices.emplace_back(variant_indices);
11117 }
11118
11119 for (int i = 0; i < new_extruder_count; i++)
11120 {
11121 for (int j = 0; j < new_variant_count; j++)
11122 {
11123 if ((i+1 == new_print_id_opt->values[j]) && (new_extruder_variants[i] == new_variant_opt->values[j])) {
11124 new_variant_indices[i] = j;
11125 break;
11126 }
11127 }
11128 }
11129
11130 const ConfigDef* config_def = this->def();
11131 if (!config_def) {
11132 BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(", Line %1%: can not find config define") % __LINE__;
11133 return -1;
11134 }
11135 for (auto& key : key_set)
11136 {
11137 const ConfigOptionDef* optdef = config_def->get(key);
11138 if (!optdef) {
11139 BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << boost::format(", Line %1%: can not find opt define for %2%") % __LINE__ % key;
11140 continue;
11141 }
11142 switch (optdef->type) {
11143 case coStrings:
11144 {
11145 ConfigOptionStrings* src_opt = new_config.option<ConfigOptionStrings>(key);
11146 if (src_opt) {
11147 ConfigOptionStrings* opt = this->option<ConfigOptionStrings>(key, true);
11148
11149 //assert(variant_count == opt->size());
11150 opt->values = src_opt->values;
11151 }
11152 break;
11153 }
11154 case coInts:
11155 {
11156 ConfigOptionInts* src_opt = new_config.option<ConfigOptionInts>(key);
11157 if (src_opt) {
11158 ConfigOptionInts* opt = this->option<ConfigOptionInts>(key, true);
11159
11160 //assert(variant_count == opt->size());
11161 opt->values = src_opt->values;
11162 }
11163 break;
11164 }
11165 case coFloats:
11166 {
11167 ConfigOptionFloats* src_opt = new_config.option<ConfigOptionFloats>(key);
11168 if (src_opt) {
11170
11171 std::vector<double> old_values = opt->values;
11172 int old_count = old_values.size();
11173 int new_count = src_opt->values.size();
11174
11175 assert(variant_count == old_count);
11176 assert(new_variant_count == new_count);
11177 opt->values = src_opt->values;
11178
11179 for (int i = 0; i < new_extruder_count; i++)
11180 {
11181 std::vector<int>& variant_indices = extruder_variant_indices[i];
11182 int new_variant_index = new_variant_indices[i];
11183 if ((new_variant_index == -1) || variant_indices.empty())
11184 continue;
11185
11186 for(auto idx : variant_indices){
11187 assert(idx < old_count);
11188 //the counts come from the variant columns, the arrays from the options;
11189 //they disagree when a config was authored at a different variant width
11190 if (idx >= old_count || new_variant_index >= (int)opt->values.size())
11191 continue;
11192 if (old_values[idx] < opt->values[new_variant_index])
11193 opt->values[new_variant_index] = old_values[idx];
11194 }
11195 }
11196 }
11197 break;
11198 }
11199 case coFloatsOrPercents:
11200 {
11201 ConfigOptionFloatsOrPercents* src_opt = new_config.option<ConfigOptionFloatsOrPercents>(key);
11202 if (src_opt) {
11204
11205 std::vector<FloatOrPercent> old_values = opt->values;
11206 int old_count = old_values.size();
11207 int new_count = src_opt->values.size();
11208
11209 assert(variant_count == old_count);
11210 assert(new_variant_count == new_count);
11211 opt->values = src_opt->values;
11212
11213 for (int i = 0; i < new_extruder_count; i++)
11214 {
11215 std::vector<int>& variant_indices = extruder_variant_indices[i];
11216 int new_variant_index = new_variant_indices[i];
11217 if ((new_variant_index == -1) || variant_indices.empty())
11218 continue;
11219
11220 for(auto idx : variant_indices){
11221 assert(idx < old_count);
11222 //the counts come from the variant columns, the arrays from the options;
11223 //they disagree when a config was authored at a different variant width
11224 if (idx >= old_count || new_variant_index >= (int)opt->values.size())
11225 continue;
11226 if (old_values[idx] < opt->values[new_variant_index])
11227 opt->values[new_variant_index] = old_values[idx];
11228 }
11229 }
11230 }
11231 break;
11232 }
11233 case coBools:
11234 {
11235 ConfigOptionBools* src_opt = new_config.option<ConfigOptionBools>(key);
11236 if (src_opt) {
11238
11239 std::vector<unsigned char> old_values = opt->values;
11240 int old_count = old_values.size();
11241 int new_count = src_opt->values.size();
11242
11243 assert(variant_count == old_count);
11244 assert(new_variant_count == new_count);
11245 opt->values = src_opt->values;
11246
11247 for (int i = 0; i < new_extruder_count; i++)
11248 {
11249 std::vector<int>& variant_indices = extruder_variant_indices[i];
11250 int new_variant_index = new_variant_indices[i];
11251 if ((new_variant_index == -1) || variant_indices.empty())
11252 continue;
11253
11254 for(auto idx : variant_indices){
11255 assert(idx < old_count);
11256 if (idx >= old_count || new_variant_index >= (int)opt->values.size())
11257 continue;
11258 if (old_values[idx]) //enabled
11259 opt->values[new_variant_index] = old_values[idx];
11260 }
11261 }
11262 }
11263
11264 break;
11265 }
11266 default:
11267 BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << boost::format(", Line %1%: unsupported option type for %2%") % __LINE__ % key;
11268 break;
11269 }
11270 }
11271
11272 return 0;
11273}

References DynamicPrintConfig(), Slic3r::coBools, Slic3r::coFloats, Slic3r::coFloatsOrPercents, Slic3r::coInts, Slic3r::coStrings, def(), Slic3r::ConfigDef::get(), Slic3r::DynamicConfig::opt(), Slic3r::ConfigBase::option(), Slic3r::ConfigOptionDef::type, Slic3r::ConfigOptionVector< T >::values, Slic3r::ConfigOptionVector< double >::values, Slic3r::ConfigOptionVector< FloatOrPercent >::values, Slic3r::ConfigOptionVector< int >::values, and Slic3r::ConfigOptionVector< unsigned char >::values.

Here is the call graph for this function:

◆ update_values_from_multi_to_multi_2()

int Slic3r::DynamicPrintConfig::update_values_from_multi_to_multi_2 ( const std::vector< std::string > & src_extruder_variants,
const std::vector< std::string > & dst_extruder_variants,
const DynamicPrintConfig & dst_config,
const std::set< std::string > & key_sets )
11276{
11277 const ConfigDef *config_def = this->def();
11278 if (!config_def) {
11279 BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(", Line %1%: can not find config define")%__LINE__;
11280 return -1;
11281 }
11282
11283 auto get_same_variant_indices = [](const std::vector<std::string>& extruder_variants, const std::string& variant){
11284 std::vector<int> indices;
11285 for(int i=0;i<extruder_variants.size();++i)
11286 if(extruder_variants[i] == variant)
11287 indices.push_back(i);
11288 return indices;
11289 };
11290
11291 std::vector<std::vector<int>> same_variant_indices;
11292 for(size_t dst_idx =0 ;dst_idx < dst_extruder_variants.size(); ++dst_idx){
11293 auto& dst_variant = dst_extruder_variants[dst_idx];
11294 auto indices =get_same_variant_indices(src_extruder_variants, dst_variant);
11295 same_variant_indices.emplace_back(indices);
11296 }
11297
11298 //dst_values below is the destination PRINT preset's per-variant row, sized to its own
11299 //print_extruder_variant; dst_extruder_variants is the PRINTER's list. They disagree until
11300 //the print preset is re-selected, so size the row to the variant count before indexing it.
11301 const size_t dst_variant_count = dst_extruder_variants.size();
11302 if (dst_variant_count == 0) {
11303 BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(", Line %1%: empty destination variant list")%__LINE__;
11304 return -1;
11305 }
11306
11307 t_config_option_keys keys = this->keys();
11308 for(auto& key : keys){
11309 if(key_sets.find(key) == key_sets.end())
11310 continue;
11311 const ConfigOptionDef* optdef = config_def->get(key);
11312 if(!optdef){
11313 BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << boost::format(", Line %1%: can not find opt define for %2%")%__LINE__%key;
11314 continue;
11315 }
11316
11317 switch (optdef->type){
11318 case coFloats:
11319 {
11321 auto src_values = opt->values;
11322 const auto* dst_opt = dst_config.option<ConfigOptionFloatsNullable>(key);
11323 if(!dst_opt){
11324 BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << boost::format(", Line %1%: %2% missing from destination config")%__LINE__%key;
11325 break;
11326 }
11327 auto dst_values = dst_opt->values;
11328 dst_values.resize(dst_variant_count, ConfigOptionFloatsNullable::nil_value());
11329 for(size_t dst_idx =0; dst_idx < same_variant_indices.size(); ++dst_idx){
11330 auto& indices = same_variant_indices[dst_idx];
11331 if(indices.empty())
11332 continue;
11333 bool has_value = false;
11334 double target_value = std::numeric_limits<double>::max();
11335 for(auto idx : indices){
11336 if(idx < (int)opt->values.size() && !opt->is_nil(idx)){
11337 has_value = true;
11338 target_value = std::min(target_value, src_values[idx]);
11339 }
11340 }
11341
11342 if(has_value)
11343 dst_values[dst_idx] = target_value;
11344 }
11345 opt->values = dst_values;
11346 break;
11347 }
11348 case coFloatsOrPercents:
11349 {
11351 auto src_values = opt->values;
11352 const auto* dst_opt = dst_config.option<ConfigOptionFloatsOrPercentsNullable>(key);
11353 if(!dst_opt){
11354 BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << boost::format(", Line %1%: %2% missing from destination config")%__LINE__%key;
11355 break;
11356 }
11357 auto dst_values = dst_opt->values;
11358 dst_values.resize(dst_variant_count, ConfigOptionFloatsOrPercentsNullable::nil_value());
11359 for(size_t dst_idx =0; dst_idx < same_variant_indices.size(); ++dst_idx){
11360 auto& indices = same_variant_indices[dst_idx];
11361 if(indices.empty())
11362 continue;
11363 bool has_value = false;
11364 FloatOrPercent target_value{9999.f, true};
11365 for(auto idx : indices){
11366 if(idx < (int)opt->values.size() && !opt->is_nil(idx)){
11367 has_value = true;
11368 target_value = src_values[idx].value < target_value.value ? src_values[idx] : target_value;
11369 }
11370 }
11371
11372 if(has_value)
11373 dst_values[dst_idx] = target_value;
11374 }
11375 opt->values = dst_values;
11376 break;
11377 }
11378 case coBools:
11379 {
11381 auto src_values = opt->values;
11382 const auto* dst_opt = dst_config.option<ConfigOptionBoolsNullable>(key);
11383 if(!dst_opt){
11384 BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << boost::format(", Line %1%: %2% missing from destination config")%__LINE__%key;
11385 break;
11386 }
11387 auto dst_values = dst_opt->values;
11388 dst_values.resize(dst_variant_count, ConfigOptionBoolsNullable::nil_value());
11389 for(size_t dst_idx =0; dst_idx < same_variant_indices.size(); ++dst_idx){
11390 auto indices = same_variant_indices[dst_idx];
11391 if(indices.empty())
11392 continue;
11393 bool has_value = false;
11394 bool target_value = false;
11395 for(auto idx : indices){
11396 if(idx < (int)opt->values.size() && !opt->is_nil(idx)){
11397 has_value = true;
11398 target_value = src_values[idx];
11399 break;
11400 }
11401 }
11402
11403 if(has_value)
11404 dst_values[dst_idx] = target_value;
11405 }
11406
11407 opt->values = dst_values;
11408 break;
11409 }
11410 default:
11411 BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << boost::format(", Line %1%: unsupported option type for %2%")%__LINE__%key;
11412 break;
11413 }
11414
11415 }
11416
11417 return 0;
11418
11419}
static unsigned char nil_value()
Definition Config.hpp:1976
static FloatOrPercent nil_value()
Definition Config.hpp:1424
static double nil_value()
Definition Config.hpp:899

References DynamicPrintConfig(), Slic3r::coBools, Slic3r::coFloats, Slic3r::coFloatsOrPercents, def(), Slic3r::ConfigDef::get(), Slic3r::DynamicConfig::keys(), Slic3r::ConfigOptionBoolsTempl< true >::nil_value(), Slic3r::ConfigOptionFloatsOrPercentsTempl< true >::nil_value(), Slic3r::ConfigOptionFloatsTempl< true >::nil_value(), Slic3r::DynamicConfig::opt(), Slic3r::ConfigBase::option(), Slic3r::ConfigOptionDef::type, and Slic3r::FloatOrPercent::value.

Referenced by Slic3r::GUI::Tab::load_current_preset(), and Slic3r::CLI::run().

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

◆ update_values_from_single_to_multi()

int Slic3r::DynamicPrintConfig::update_values_from_single_to_multi ( DynamicPrintConfig & multi_config,
std::set< std::string > & key_set,
std::string id_name,
std::string variant_name )
10919{
10920 auto print_variant_opt = dynamic_cast<const ConfigOptionStrings*>(multi_config.option(variant_name));
10921 if (!print_variant_opt) {
10922 BOOST_LOG_TRIVIAL(error) << boost::format("%1%:%2%, can not get %3% from config")%__FUNCTION__ %__LINE__ % variant_name;
10923 return -1;
10924 }
10925 int variant_count = print_variant_opt->size();
10926
10927 const ConfigDef *config_def = this->def();
10928 if (!config_def) {
10929 BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(", Line %1%: can not find config define")%__LINE__;
10930 return -1;
10931 }
10932 for (auto& key: key_set)
10933 {
10934 const ConfigOptionDef *optdef = config_def->get(key);
10935 if (!optdef) {
10936 BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << boost::format(", Line %1%: can not find opt define for %2%")%__LINE__%key;
10937 continue;
10938 }
10939 switch (optdef->type) {
10940 case coStrings:
10941 {
10942 ConfigOptionStrings* src_opt = multi_config.option<ConfigOptionStrings>(key);
10943 if (src_opt) {
10944 ConfigOptionStrings* opt = this->option<ConfigOptionStrings>(key, true);
10945
10946 opt->values = src_opt->values;
10947 }
10948 break;
10949 }
10950 case coInts:
10951 {
10952 ConfigOptionInts* src_opt = multi_config.option<ConfigOptionInts>(key);
10953 if (src_opt) {
10954 ConfigOptionInts* opt = this->option<ConfigOptionInts>(key, true);
10955
10956 opt->values = src_opt->values;
10957 }
10958 break;
10959 }
10960 case coFloats:
10961 {
10962 ConfigOptionFloats * src_opt = multi_config.option<ConfigOptionFloats>(key);
10963 if (src_opt) {
10965
10966 assert(variant_count == src_opt->size());
10967 opt->resize(variant_count, opt);
10968
10969 for (int index = 0; index < variant_count; index++)
10970 {
10971 //variant_count is the variant column width, src_opt the value array;
10972 //they disagree when the source was authored at a different width
10973 if (index >= (int)src_opt->values.size())
10974 break;
10975 if (opt->values[index] > src_opt->values[index])
10976 opt->values[index] = src_opt->values[index];
10977 }
10978 }
10979 break;
10980 }
10981 case coFloatsOrPercents:
10982 {
10983 ConfigOptionFloatsOrPercents * src_opt = multi_config.option<ConfigOptionFloatsOrPercents>(key);
10984 if (src_opt) {
10986
10987 assert(variant_count == src_opt->size());
10988 opt->resize(variant_count, opt);
10989
10990 for (int index = 0; index < variant_count; index++)
10991 {
10992 if (index >= (int)src_opt->values.size())
10993 break;
10994 if (opt->values[index].value > src_opt->values[index].value)
10995 opt->values[index] = src_opt->values[index];
10996 }
10997 }
10998 break;
10999 }
11000 case coBools:
11001 {
11002 ConfigOptionBools * src_opt = multi_config.option<ConfigOptionBools>(key);
11003 if (src_opt)
11004 {
11005 ConfigOptionBools * opt = this->option<ConfigOptionBools>(key, true);
11006
11007 assert(variant_count == src_opt->size());
11008 opt->resize(variant_count, opt);
11009 }
11010
11011 break;
11012 }
11013 default:
11014 BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << boost::format(", Line %1%: unsupported option type for %2%")%__LINE__%key;
11015 break;
11016 }
11017 }
11018
11019 return 0;
11020}

References DynamicPrintConfig(), Slic3r::coBools, Slic3r::coFloats, Slic3r::coFloatsOrPercents, Slic3r::coInts, Slic3r::coStrings, def(), Slic3r::ConfigDef::get(), Slic3r::DynamicConfig::opt(), Slic3r::ConfigBase::option(), Slic3r::ConfigOptionVector< T >::size(), Slic3r::ConfigOptionVector< double >::size(), Slic3r::ConfigOptionVector< FloatOrPercent >::size(), Slic3r::ConfigOptionVector< unsigned char >::size(), Slic3r::ConfigOptionDef::type, Slic3r::ConfigOptionVector< T >::values, Slic3r::ConfigOptionVector< double >::values, Slic3r::ConfigOptionVector< FloatOrPercent >::values, and Slic3r::ConfigOptionVector< int >::values.

Here is the call graph for this function:

◆ update_values_to_printer_extruders()

std::vector< int > Slic3r::DynamicPrintConfig::update_values_to_printer_extruders ( DynamicPrintConfig & printer_config,
int extruder_count,
int extruder_nozzle_volume_count,
std::vector< std::vector< NozzleVolumeType > > & nv_types,
std::set< std::string > & key_set,
std::string id_name,
std::string variant_name,
unsigned int stride = 1,
unsigned int extruder_id = 0,
NozzleVolumeType filament_nvt = nvtStandard )
11663{
11664 std::vector<int> variant_index;
11665 int variant_count = extruder_count;
11666
11667 BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(", Line %1%: extruder_count %2%, extruder_nozzle_volume_count %3%")%__LINE__ %extruder_count %extruder_nozzle_volume_count;
11668
11669 auto opt_extruder_type = dynamic_cast<const ConfigOptionEnumsGeneric*>(printer_config.option("extruder_type"));
11670 auto opt_nozzle_volume_type = dynamic_cast<const ConfigOptionEnumsGeneric*>(printer_config.option("nozzle_volume_type"));
11671 if (!opt_extruder_type || !opt_nozzle_volume_type) {
11672 BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << boost::format(", Line %1%: extruder_type or nozzle_volume_type option not found, skipping")%__LINE__;
11673 return variant_index;
11674 }
11675
11676 if (extruder_id > 0 && extruder_id <= static_cast<unsigned> (extruder_count)) {
11677 variant_index.resize(1);
11678 ExtruderType extruder_type = (ExtruderType)(opt_extruder_type->get_at(extruder_id - 1));
11679 NozzleVolumeType nozzle_volume_type = (NozzleVolumeType)(opt_nozzle_volume_type->get_at(extruder_id - 1));
11680
11682 // a mixed-nozzle extruder has no preset column of its own: the filament's concrete
11683 // volume type selects the slot
11684 nozzle_volume_type = filament_nvt;
11685 }
11686 else if (nozzle_volume_type != filament_nvt) {
11687 BOOST_LOG_TRIVIAL(info) << __FUNCTION__
11688 << boost::format(", Line %1%: nozzle_volume_type is %2%, not equal to filament_nvt %3%") % __LINE__ % nozzle_volume_type % filament_nvt;
11689 }
11690
11691 //variant index
11692 variant_index[0] = get_index_for_extruder(extruder_id, id_name, extruder_type, nozzle_volume_type, variant_name);
11693
11694 if (variant_index[0] < 0) {
11695 BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(", Line %1%: could not found extruder_type %2%, nozzle_volume_type %3%, for filament")
11696 % __LINE__ % s_keys_names_ExtruderType[extruder_type] % s_keys_names_NozzleVolumeType[nozzle_volume_type];
11697 }
11698
11699 variant_count = 1;
11700 }
11701 else {
11702 if (id_name == "print_extruder_id")
11703 ensure_process_variant_columns(*this, printer_config);
11704 // Orca: emit the slots first, then size variant_count from what was actually
11705 // emitted. extruder_nozzle_volume_count only equals the emitted total when every
11706 // extruder carries per-type stats; an extruder with an empty stats entry combined
11707 // with a Hybrid extruder would otherwise overrun a table pre-sized from that count.
11708 for (int e_index = 0; e_index < extruder_count; e_index++)
11709 {
11710 ExtruderType extruder_type = (ExtruderType)(opt_extruder_type->get_at(e_index));
11711 NozzleVolumeType nozzle_volume_type = (NozzleVolumeType)(opt_nozzle_volume_type->get_at(e_index));
11712
11713 // Orca: latch the decision before the inner loop reassigns nozzle_volume_type;
11714 // re-testing the reassigned value would make every slot after the first reuse
11715 // the first slot's volume type.
11716 const bool per_type_slots = extruder_nozzle_volume_count > extruder_count || nozzle_volume_type == nvtHybrid;
11717 const int nvt_count = per_type_slots ? int(nv_types[e_index].size()) : 1;
11718 for (int nvt_index = 0; nvt_index < nvt_count; nvt_index++)
11719 {
11720 if (per_type_slots)
11721 nozzle_volume_type = nv_types[e_index][nvt_index];
11722 //variant index
11723 int slot_index = get_index_for_extruder(e_index+1, id_name, extruder_type, nozzle_volume_type, variant_name);
11724 if (slot_index < 0) {
11725 // Orca: This is expected during transient UI states (e.g. popup windows),
11726 // fall back to 0 silently.
11727 slot_index = 0;
11728 }
11729 variant_index.push_back(slot_index);
11730 }
11731 }
11732 variant_count = int(variant_index.size());
11733 }
11734
11735 const ConfigDef *config_def = this->def();
11736 if (!config_def) {
11737 BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(", Line %1%: can not find config define")%__LINE__;
11738 return variant_index;
11739 }
11740 for (auto& key: key_set)
11741 {
11742 const ConfigOptionDef *optdef = config_def->get(key);
11743 if (!optdef) {
11744 BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << boost::format(", Line %1%: can not find opt define for %2%")%__LINE__%key;
11745 continue;
11746 }
11747 switch (optdef->type) {
11748 case coStrings:
11749 {
11750 ConfigOptionStrings * opt = this->option<ConfigOptionStrings>(key);
11751 if (!opt) continue;
11752 std::vector<std::string> new_values;
11753
11754 new_values.resize(variant_count * stride);
11755 for (int e_index = 0; e_index < variant_count; e_index++)
11756 {
11757 for (unsigned int i = 0; i < stride; i++)
11758 new_values[e_index*stride + i] = opt->get_at(variant_index[e_index]*stride + i);
11759 }
11760 opt->values = new_values;
11761 break;
11762 }
11763 case coInts:
11764 {
11766 if (!opt) continue;
11767 std::vector<int> new_values;
11768
11769 new_values.resize(variant_count * stride);
11770 for (int e_index = 0; e_index < variant_count; e_index++)
11771 {
11772 for (unsigned int i = 0; i < stride; i++)
11773 new_values[e_index*stride + i] = opt->get_at(variant_index[e_index]*stride + i);
11774 }
11775 opt->values = new_values;
11776 break;
11777 }
11778 case coFloats:
11779 {
11781 if (!opt) continue;
11782 std::vector<double> new_values;
11783
11784 new_values.resize(variant_count * stride);
11785 for (int e_index = 0; e_index < variant_count; e_index++)
11786 {
11787 for (unsigned int i = 0; i < stride; i++)
11788 new_values[e_index*stride + i] = opt->get_at(variant_index[e_index]*stride + i);
11789 }
11790 opt->values = new_values;
11791 break;
11792 }
11793 case coPercents:
11794 {
11796 if (!opt) continue;
11797 std::vector<double> new_values;
11798
11799 new_values.resize(variant_count * stride);
11800 for (int e_index = 0; e_index < variant_count; e_index++)
11801 {
11802 for (unsigned int i = 0; i < stride; i++)
11803 new_values[e_index*stride + i] = opt->get_at(variant_index[e_index]*stride + i);
11804 }
11805 opt->values = new_values;
11806 break;
11807 }
11808 case coFloatsOrPercents:
11809 {
11811 if (!opt) continue;
11812 std::vector<FloatOrPercent> new_values;
11813
11814 new_values.resize(variant_count * stride);
11815 for (int e_index = 0; e_index < variant_count; e_index++)
11816 {
11817 for (unsigned int i = 0; i < stride; i++)
11818 new_values[e_index*stride + i] = opt->get_at(variant_index[e_index]*stride + i);
11819 }
11820 opt->values = new_values;
11821 break;
11822 }
11823 case coBools:
11824 {
11826 if (!opt) continue;
11827 std::vector<unsigned char> new_values;
11828
11829 new_values.resize(variant_count * stride);
11830 for (int e_index = 0; e_index < variant_count; e_index++)
11831 {
11832 for (unsigned int i = 0; i < stride; i++)
11833 new_values[e_index*stride + i] = opt->get_at(variant_index[e_index]*stride + i);
11834 }
11835 opt->values = new_values;
11836 break;
11837 }
11838 case coEnums:
11839 {
11841 if (!opt) continue;
11842 std::vector<int> new_values;
11843
11844 new_values.resize(variant_count * stride);
11845 for (int e_index = 0; e_index < variant_count; e_index++)
11846 {
11847 for (unsigned int i = 0; i < stride; i++)
11848 new_values[e_index*stride + i] = opt->get_at(variant_index[e_index]*stride + i);
11849 }
11850 opt->values = new_values;
11851 break;
11852 }
11853 default:
11854 BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << boost::format(", Line %1%: unsupported option type for %2%")%__LINE__%key;
11855 break;
11856 }
11857 }
11858
11859 return variant_index;
11860}
static void ensure_process_variant_columns(DynamicPrintConfig &config, const DynamicPrintConfig &printer_config)
Definition PrintConfig.cpp:11631
ConfigOptionPercentsTempl< false > ConfigOptionPercents
Definition Config.hpp:1334

References DynamicPrintConfig(), Slic3r::coBools, Slic3r::coEnums, Slic3r::coFloats, Slic3r::coFloatsOrPercents, Slic3r::coInts, Slic3r::coPercents, Slic3r::coStrings, def(), Slic3r::ensure_process_variant_columns(), Slic3r::ConfigDef::get(), get_index_for_extruder(), Slic3r::nozzle_volume_type(), Slic3r::nvtHybrid, Slic3r::DynamicConfig::opt(), Slic3r::ConfigBase::option(), Slic3r::DynamicConfig::size(), and Slic3r::ConfigOptionDef::type.

Referenced by Slic3r::PresetBundle::construct_full_config(), and Slic3r::PresetBundle::full_fff_config().

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

◆ update_values_to_printer_extruders_for_multiple_filaments()

void Slic3r::DynamicPrintConfig::update_values_to_printer_extruders_for_multiple_filaments ( DynamicPrintConfig & printer_config,
int extruder_count,
int extruder_nozzle_volume_count,
std::set< std::string > & key_set,
std::string id_name,
std::string variant_name )
11885{
11886 BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(", Line %1%: extruder_count %2%, extruder_nozzle_volume_count %3%")%__LINE__ %extruder_count %extruder_nozzle_volume_count;
11887
11888 {
11889 auto opt_filament_map = printer_config.option<ConfigOptionInts>("filament_map");
11890 if (!opt_filament_map) {
11891 BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << boost::format(", Line %1%: filament_map option not found, skipping")%__LINE__;
11892 return;
11893 }
11894 std::vector<int> filament_maps = opt_filament_map->values;
11895 auto opt_ids = id_name.empty()? nullptr: dynamic_cast<const ConfigOptionInts*>(this->option(id_name));
11896 // Orca: a map shorter than the filament count must not drop the filaments past its end;
11897 // they take the first extruder.
11898 if (opt_ids && !opt_ids->values.empty())
11899 filament_maps.resize(std::max<size_t>(filament_maps.size(), *std::max_element(opt_ids->values.begin(), opt_ids->values.end())), 1);
11900 size_t filament_count = filament_maps.size();
11901 //apply process settings
11902 auto opt_extruder_type = dynamic_cast<const ConfigOptionEnumsGeneric*>(printer_config.option("extruder_type"));
11903 auto opt_nozzle_volume_type = dynamic_cast<const ConfigOptionEnumsGeneric*>(printer_config.option("nozzle_volume_type"));
11904 if (!opt_extruder_type || !opt_nozzle_volume_type) {
11905 BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << boost::format(", Line %1%: extruder_type or nozzle_volume_type option not found, skipping")%__LINE__;
11906 return;
11907 }
11908
11909 auto opt_filament_volume_maps = dynamic_cast<const ConfigOptionInts*>(printer_config.option("filament_volume_map"));
11910 std::vector<int> filament_volume_maps;
11911 // Orca: honour the per-filament volume map only when a producer sized it to the
11912 // filament count. The full-config producers (PresetBundle injection, engine
11913 // write-back) always size it; mis-sized maps (stale project values, CLI runs until
11914 // the per-filament synthesis lands there) must not distort slot resolution nor be
11915 // indexed out of bounds.
11916 if (opt_filament_volume_maps && opt_filament_volume_maps->values.size() == filament_count)
11917 filament_volume_maps = opt_filament_volume_maps->values;
11918 std::vector<int> variant_index;
11919
11920 variant_index.resize(filament_count, -1);
11921
11922 for (int f_index = 0; f_index < filament_count; f_index++)
11923 {
11924 ExtruderType extruder_type = (ExtruderType)(opt_extruder_type->get_at(filament_maps[f_index] - 1));
11925 NozzleVolumeType nozzle_volume_type = (NozzleVolumeType)(opt_nozzle_volume_type->get_at(filament_maps[f_index] - 1));
11926
11927 if ((extruder_nozzle_volume_count > extruder_count || nozzle_volume_type == nvtHybrid) && (!filament_volume_maps.empty())) {
11928 nozzle_volume_type = (NozzleVolumeType)(filament_volume_maps[f_index]);
11929 }
11930
11931 //variant index
11932 variant_index[f_index] = get_index_for_extruder(f_index+1, id_name, extruder_type, nozzle_volume_type, variant_name);
11933 if (variant_index[f_index] < 0) {
11934 // Orca: a filament need not define every extruder variant (a Direct Drive filament on a
11935 // Bowden printer), so this is not an invalid state: the filament's first variant is used.
11936 BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(", Line %1%: could not found extruder_type %2%, nozzle_volume_type %3%, filament_index %4%, extruder index %5%")
11937 %__LINE__ %s_keys_names_ExtruderType[extruder_type] % s_keys_names_NozzleVolumeType[nozzle_volume_type] % (f_index+1) %filament_maps[f_index];
11938 //for some updates happens in a invalid state(caused by popup window)
11939 //we need to avoid crash
11940 variant_index[f_index] = 0;
11941 if (opt_ids) {
11942 for (int i = 0; i < opt_ids->values.size(); i++)
11943 if (opt_ids->values[i] == (f_index+1)) {
11944 variant_index[f_index] = i;
11945 break;
11946 }
11947 }
11948 }
11949 }
11950
11951 const ConfigDef *config_def = this->def();
11952 if (!config_def) {
11953 BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(", Line %1%: can not find config define")%__LINE__;
11954 return;
11955 }
11956 bool has_id_key = !id_name.empty() && key_set.count(id_name) > 0;
11957 for (auto& key: key_set)
11958 {
11959 if (has_id_key && key == id_name)
11960 continue;
11961 const ConfigOptionDef *optdef = config_def->get(key);
11962 if (!optdef) {
11963 BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << boost::format(", Line %1%: can not find opt define for %2%")%__LINE__%key;
11964 continue;
11965 }
11966 // An empty option has no first value to fall back on; give it one registered default per filament.
11967 if (auto *vec = dynamic_cast<ConfigOptionVectorBase*>(this->option(key)); vec && vec->empty() && optdef->default_value)
11968 vec->resize(filament_count, optdef->default_value.get());
11969
11970 switch (optdef->type) {
11971 case coStrings: gather_option_values<ConfigOptionStrings, std::string>(__FUNCTION__, key, this->option<ConfigOptionStrings>(key), variant_index); break;
11972 case coInts: gather_option_values<ConfigOptionInts, int>(__FUNCTION__, key, this->option<ConfigOptionInts>(key), variant_index); break;
11973 case coFloats: gather_option_values<ConfigOptionFloats, double>(__FUNCTION__, key, this->option<ConfigOptionFloats>(key), variant_index); break;
11974 case coPercents: gather_option_values<ConfigOptionPercents, double>(__FUNCTION__, key, this->option<ConfigOptionPercents>(key), variant_index); break;
11976 case coBools: gather_option_values<ConfigOptionBools, unsigned char>(__FUNCTION__, key, this->option<ConfigOptionBools>(key), variant_index); break;
11977 case coEnums: gather_option_values<ConfigOptionEnumsGeneric, int>(__FUNCTION__, key, this->option<ConfigOptionEnumsGeneric>(key), variant_index); break;
11978 default:
11979 BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << boost::format(", Line %1%: unsupported option type for %2%")%__LINE__%key;
11980 break;
11981 }
11982 }
11983 // Orca: also require a non-empty id list; get_at on an empty vector is undefined.
11984 if (has_id_key && opt_ids && !opt_ids->values.empty()) {
11985 // remap the id list itself last: the lookups above still need the original ids
11986 std::vector<int> new_values;
11987 new_values.resize(filament_count);
11988 for (int f_index = 0; f_index < filament_count; f_index++) {
11989 new_values[f_index] = opt_ids->get_at(variant_index[f_index]);
11990 }
11991 const_cast<ConfigOptionInts*>(opt_ids)->values = new_values;
11992 }
11993 }
11994}

References DynamicPrintConfig(), Slic3r::coBools, Slic3r::coEnums, Slic3r::coFloats, Slic3r::coFloatsOrPercents, Slic3r::coInts, Slic3r::coPercents, Slic3r::coStrings, def(), Slic3r::ConfigOptionDef::default_value, Slic3r::ConfigOptionVectorBase::empty(), Slic3r::gather_option_values(), Slic3r::ConfigDef::get(), get_index_for_extruder(), Slic3r::nozzle_volume_type(), Slic3r::nvtHybrid, Slic3r::ConfigBase::option(), and Slic3r::ConfigOptionDef::type.

Here is the call graph for this function:

◆ validate()

std::map< std::string, std::string > Slic3r::DynamicPrintConfig::validate ( bool under_cli = false)
10707{
10708 // Full print config is initialized from the defaults.
10709 const ConfigOption *opt = this->option("printer_technology", false);
10710 auto printer_technology = (opt == nullptr) ? ptFFF : static_cast<PrinterTechnology>(dynamic_cast<const ConfigOptionEnumGeneric*>(opt)->value);
10711 switch (printer_technology) {
10712 case ptFFF:
10713 {
10714 FullPrintConfig fpc;
10715 fpc.apply(*this, true);
10716 // Verify this print options through the FullPrintConfig.
10717 return Slic3r::validate(fpc, under_cli);
10718 }
10719 default:
10720 //FIXME no validation on SLA data?
10721 return std::map<std::string, std::string>();
10722 }
10723}
std::map< std::string, std::string > validate(const FullPrintConfig &cfg, bool under_cli)
Definition PrintConfig.cpp:12444
printer_technology((ConfigOptionPoints, printable_area))((ConfigOptionFloat
PrinterTechnology
Definition Config.hpp:229
@ ptFFF
Definition Config.hpp:231

References Slic3r::DynamicConfig::opt(), Slic3r::ConfigBase::option(), Slic3r::printer_technology(), Slic3r::ptFFF, Slic3r::validate(), and Slic3r::ConfigOptionSingle< T >::value.

Here is the call graph for this function:

Member Data Documentation

◆ options


The documentation for this class was generated from the following files: