mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-14 02:55:55 +08:00
allow bad key/value from imported .3mf/gcode
these will be silently ignored and so the default value will be used.
This commit is contained in:
parent
afcdb1b6bb
commit
19d2115f20
@ -530,10 +530,11 @@ bool ConfigBase::set_deserialize_nothrow(const t_config_option_key &opt_key_src,
|
||||
return this->set_deserialize_raw(opt_key, value, append);
|
||||
}
|
||||
|
||||
void ConfigBase::set_deserialize(const t_config_option_key &opt_key_src, const std::string &value_src, bool append)
|
||||
void ConfigBase::set_deserialize(const t_config_option_key& opt_key_src, const std::string& value_src, bool append)
|
||||
{
|
||||
if (! this->set_deserialize_nothrow(opt_key_src, value_src, append))
|
||||
throw BadOptionTypeException(format("ConfigBase::set_deserialize() failed for parameter \"%1%\", value \"%2%\"", opt_key_src, value_src));
|
||||
if (!this->set_deserialize_nothrow(opt_key_src, value_src, append)) {
|
||||
throw BadOptionTypeException(format("ConfigBase::set_deserialize() failed for parameter \"%1%\", value \"%2%\"", opt_key_src, value_src));
|
||||
}
|
||||
}
|
||||
|
||||
void ConfigBase::set_deserialize(std::initializer_list<SetDeserializeItem> items)
|
||||
@ -580,10 +581,7 @@ bool ConfigBase::set_deserialize_raw(const t_config_option_key &opt_key_src, con
|
||||
if (opt == nullptr)
|
||||
throw new UnknownOptionException(opt_key);
|
||||
bool ok= opt->deserialize(value, append);
|
||||
if (!ok) {
|
||||
return opt->deserialize(value, append);
|
||||
}
|
||||
return true;
|
||||
return ok;
|
||||
}
|
||||
|
||||
// Return an absolute value of a possibly relative config variable.
|
||||
@ -783,8 +781,9 @@ size_t ConfigBase::load_from_gcode_string(const char* str)
|
||||
if (key == nullptr)
|
||||
break;
|
||||
try {
|
||||
this->set_deserialize(std::string(key, key_end), std::string(value, end));
|
||||
++num_key_value_pairs;
|
||||
//change it from set_deserialize to set_deserialize_nothrow to allow bad/old config to swtch to default value.
|
||||
if(this->set_deserialize_nothrow(std::string(key, key_end), std::string(value, end)))
|
||||
++num_key_value_pairs;
|
||||
}
|
||||
catch (UnknownOptionException & /* e */) {
|
||||
// ignore
|
||||
|
@ -714,7 +714,6 @@ void PrintConfigDef::init_fff_params()
|
||||
def->tooltip = L("Fill pattern for bottom infill. This only affects the bottom visible layer, and not its adjacent solid shells.");
|
||||
def->cli = "bottom-fill-pattern|external-fill-pattern=s";
|
||||
def->enum_keys_map = &ConfigOptionEnum<InfillPattern>::get_enum_values();
|
||||
|
||||
def->enum_values.push_back("rectilinear");
|
||||
def->enum_values.push_back("rectilineargapfill");
|
||||
def->enum_values.push_back("monotonic");
|
||||
|
Loading…
x
Reference in New Issue
Block a user