mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-14 21:45:58 +08:00
Making progress with eliminating exceptions
+ Fixed : SpinCtrl for nullable int still does not work
This commit is contained in:
parent
ef3493d7ea
commit
7143190779
@ -266,6 +266,8 @@ ConfigOption* ConfigOptionDef::create_empty_option() const
|
|||||||
{
|
{
|
||||||
if (this->nullable) {
|
if (this->nullable) {
|
||||||
switch (this->type) {
|
switch (this->type) {
|
||||||
|
case coFloat: return new ConfigOptionFloatNullable();
|
||||||
|
case coInt: return new ConfigOptionIntNullable();
|
||||||
case coFloats: return new ConfigOptionFloatsNullable();
|
case coFloats: return new ConfigOptionFloatsNullable();
|
||||||
case coInts: return new ConfigOptionIntsNullable();
|
case coInts: return new ConfigOptionIntsNullable();
|
||||||
case coPercents: return new ConfigOptionPercentsNullable();
|
case coPercents: return new ConfigOptionPercentsNullable();
|
||||||
@ -1433,6 +1435,9 @@ CEREAL_REGISTER_TYPE(Slic3r::ConfigOptionSingle<std::string>)
|
|||||||
CEREAL_REGISTER_TYPE(Slic3r::ConfigOptionSingle<Slic3r::Vec2d>)
|
CEREAL_REGISTER_TYPE(Slic3r::ConfigOptionSingle<Slic3r::Vec2d>)
|
||||||
CEREAL_REGISTER_TYPE(Slic3r::ConfigOptionSingle<Slic3r::Vec3d>)
|
CEREAL_REGISTER_TYPE(Slic3r::ConfigOptionSingle<Slic3r::Vec3d>)
|
||||||
CEREAL_REGISTER_TYPE(Slic3r::ConfigOptionSingle<bool>)
|
CEREAL_REGISTER_TYPE(Slic3r::ConfigOptionSingle<bool>)
|
||||||
|
CEREAL_REGISTER_TYPE(Slic3r::ConfigOptionSingleNullable<double>)
|
||||||
|
CEREAL_REGISTER_TYPE(Slic3r::ConfigOptionSingleNullable<int>)
|
||||||
|
CEREAL_REGISTER_TYPE(Slic3r::ConfigOptionSingleNullable<bool>)
|
||||||
CEREAL_REGISTER_TYPE(Slic3r::ConfigOptionVectorBase)
|
CEREAL_REGISTER_TYPE(Slic3r::ConfigOptionVectorBase)
|
||||||
CEREAL_REGISTER_TYPE(Slic3r::ConfigOptionVector<double>)
|
CEREAL_REGISTER_TYPE(Slic3r::ConfigOptionVector<double>)
|
||||||
CEREAL_REGISTER_TYPE(Slic3r::ConfigOptionVector<int>)
|
CEREAL_REGISTER_TYPE(Slic3r::ConfigOptionVector<int>)
|
||||||
@ -1440,9 +1445,11 @@ CEREAL_REGISTER_TYPE(Slic3r::ConfigOptionVector<std::string>)
|
|||||||
CEREAL_REGISTER_TYPE(Slic3r::ConfigOptionVector<Slic3r::Vec2d>)
|
CEREAL_REGISTER_TYPE(Slic3r::ConfigOptionVector<Slic3r::Vec2d>)
|
||||||
CEREAL_REGISTER_TYPE(Slic3r::ConfigOptionVector<unsigned char>)
|
CEREAL_REGISTER_TYPE(Slic3r::ConfigOptionVector<unsigned char>)
|
||||||
CEREAL_REGISTER_TYPE(Slic3r::ConfigOptionFloat)
|
CEREAL_REGISTER_TYPE(Slic3r::ConfigOptionFloat)
|
||||||
|
CEREAL_REGISTER_TYPE(Slic3r::ConfigOptionFloatNullable)
|
||||||
CEREAL_REGISTER_TYPE(Slic3r::ConfigOptionFloats)
|
CEREAL_REGISTER_TYPE(Slic3r::ConfigOptionFloats)
|
||||||
CEREAL_REGISTER_TYPE(Slic3r::ConfigOptionFloatsNullable)
|
CEREAL_REGISTER_TYPE(Slic3r::ConfigOptionFloatsNullable)
|
||||||
CEREAL_REGISTER_TYPE(Slic3r::ConfigOptionInt)
|
CEREAL_REGISTER_TYPE(Slic3r::ConfigOptionInt)
|
||||||
|
CEREAL_REGISTER_TYPE(Slic3r::ConfigOptionIntNullable)
|
||||||
CEREAL_REGISTER_TYPE(Slic3r::ConfigOptionInts)
|
CEREAL_REGISTER_TYPE(Slic3r::ConfigOptionInts)
|
||||||
CEREAL_REGISTER_TYPE(Slic3r::ConfigOptionIntsNullable)
|
CEREAL_REGISTER_TYPE(Slic3r::ConfigOptionIntsNullable)
|
||||||
CEREAL_REGISTER_TYPE(Slic3r::ConfigOptionString)
|
CEREAL_REGISTER_TYPE(Slic3r::ConfigOptionString)
|
||||||
@ -1469,6 +1476,9 @@ CEREAL_REGISTER_POLYMORPHIC_RELATION(Slic3r::ConfigOption, Slic3r::ConfigOptionS
|
|||||||
CEREAL_REGISTER_POLYMORPHIC_RELATION(Slic3r::ConfigOption, Slic3r::ConfigOptionSingle<Slic3r::Vec2d>)
|
CEREAL_REGISTER_POLYMORPHIC_RELATION(Slic3r::ConfigOption, Slic3r::ConfigOptionSingle<Slic3r::Vec2d>)
|
||||||
CEREAL_REGISTER_POLYMORPHIC_RELATION(Slic3r::ConfigOption, Slic3r::ConfigOptionSingle<Slic3r::Vec3d>)
|
CEREAL_REGISTER_POLYMORPHIC_RELATION(Slic3r::ConfigOption, Slic3r::ConfigOptionSingle<Slic3r::Vec3d>)
|
||||||
CEREAL_REGISTER_POLYMORPHIC_RELATION(Slic3r::ConfigOption, Slic3r::ConfigOptionSingle<bool>)
|
CEREAL_REGISTER_POLYMORPHIC_RELATION(Slic3r::ConfigOption, Slic3r::ConfigOptionSingle<bool>)
|
||||||
|
CEREAL_REGISTER_POLYMORPHIC_RELATION(Slic3r::ConfigOption, Slic3r::ConfigOptionSingleNullable<double>)
|
||||||
|
CEREAL_REGISTER_POLYMORPHIC_RELATION(Slic3r::ConfigOption, Slic3r::ConfigOptionSingleNullable<int>)
|
||||||
|
CEREAL_REGISTER_POLYMORPHIC_RELATION(Slic3r::ConfigOption, Slic3r::ConfigOptionSingleNullable<bool>)
|
||||||
CEREAL_REGISTER_POLYMORPHIC_RELATION(Slic3r::ConfigOption, Slic3r::ConfigOptionVectorBase)
|
CEREAL_REGISTER_POLYMORPHIC_RELATION(Slic3r::ConfigOption, Slic3r::ConfigOptionVectorBase)
|
||||||
CEREAL_REGISTER_POLYMORPHIC_RELATION(Slic3r::ConfigOptionVectorBase, Slic3r::ConfigOptionVector<double>)
|
CEREAL_REGISTER_POLYMORPHIC_RELATION(Slic3r::ConfigOptionVectorBase, Slic3r::ConfigOptionVector<double>)
|
||||||
CEREAL_REGISTER_POLYMORPHIC_RELATION(Slic3r::ConfigOptionVectorBase, Slic3r::ConfigOptionVector<int>)
|
CEREAL_REGISTER_POLYMORPHIC_RELATION(Slic3r::ConfigOptionVectorBase, Slic3r::ConfigOptionVector<int>)
|
||||||
@ -1476,9 +1486,11 @@ CEREAL_REGISTER_POLYMORPHIC_RELATION(Slic3r::ConfigOptionVectorBase, Slic3r::Con
|
|||||||
CEREAL_REGISTER_POLYMORPHIC_RELATION(Slic3r::ConfigOptionVectorBase, Slic3r::ConfigOptionVector<Slic3r::Vec2d>)
|
CEREAL_REGISTER_POLYMORPHIC_RELATION(Slic3r::ConfigOptionVectorBase, Slic3r::ConfigOptionVector<Slic3r::Vec2d>)
|
||||||
CEREAL_REGISTER_POLYMORPHIC_RELATION(Slic3r::ConfigOptionVectorBase, Slic3r::ConfigOptionVector<unsigned char>)
|
CEREAL_REGISTER_POLYMORPHIC_RELATION(Slic3r::ConfigOptionVectorBase, Slic3r::ConfigOptionVector<unsigned char>)
|
||||||
CEREAL_REGISTER_POLYMORPHIC_RELATION(Slic3r::ConfigOptionSingle<double>, Slic3r::ConfigOptionFloat)
|
CEREAL_REGISTER_POLYMORPHIC_RELATION(Slic3r::ConfigOptionSingle<double>, Slic3r::ConfigOptionFloat)
|
||||||
|
CEREAL_REGISTER_POLYMORPHIC_RELATION(Slic3r::ConfigOptionSingleNullable<double>, Slic3r::ConfigOptionFloatNullable)
|
||||||
CEREAL_REGISTER_POLYMORPHIC_RELATION(Slic3r::ConfigOptionVector<double>, Slic3r::ConfigOptionFloats)
|
CEREAL_REGISTER_POLYMORPHIC_RELATION(Slic3r::ConfigOptionVector<double>, Slic3r::ConfigOptionFloats)
|
||||||
CEREAL_REGISTER_POLYMORPHIC_RELATION(Slic3r::ConfigOptionVector<double>, Slic3r::ConfigOptionFloatsNullable)
|
CEREAL_REGISTER_POLYMORPHIC_RELATION(Slic3r::ConfigOptionVector<double>, Slic3r::ConfigOptionFloatsNullable)
|
||||||
CEREAL_REGISTER_POLYMORPHIC_RELATION(Slic3r::ConfigOptionSingle<int>, Slic3r::ConfigOptionInt)
|
CEREAL_REGISTER_POLYMORPHIC_RELATION(Slic3r::ConfigOptionSingle<int>, Slic3r::ConfigOptionInt)
|
||||||
|
CEREAL_REGISTER_POLYMORPHIC_RELATION(Slic3r::ConfigOptionSingleNullable<int>, Slic3r::ConfigOptionIntNullable)
|
||||||
CEREAL_REGISTER_POLYMORPHIC_RELATION(Slic3r::ConfigOptionVector<int>, Slic3r::ConfigOptionInts)
|
CEREAL_REGISTER_POLYMORPHIC_RELATION(Slic3r::ConfigOptionVector<int>, Slic3r::ConfigOptionInts)
|
||||||
CEREAL_REGISTER_POLYMORPHIC_RELATION(Slic3r::ConfigOptionVector<int>, Slic3r::ConfigOptionIntsNullable)
|
CEREAL_REGISTER_POLYMORPHIC_RELATION(Slic3r::ConfigOptionVector<int>, Slic3r::ConfigOptionIntsNullable)
|
||||||
CEREAL_REGISTER_POLYMORPHIC_RELATION(Slic3r::ConfigOptionSingle<std::string>, Slic3r::ConfigOptionString)
|
CEREAL_REGISTER_POLYMORPHIC_RELATION(Slic3r::ConfigOptionSingle<std::string>, Slic3r::ConfigOptionString)
|
||||||
|
@ -332,16 +332,16 @@ public:
|
|||||||
{
|
{
|
||||||
if (rhs->type() != this->type())
|
if (rhs->type() != this->type())
|
||||||
throw ConfigurationError("ConfigOptionSingle: Assigning an incompatible type");
|
throw ConfigurationError("ConfigOptionSingle: Assigning an incompatible type");
|
||||||
assert(dynamic_cast<const ConfigOptionSingle<T>*>(rhs));
|
assert(dynamic_cast<const ConfigOptionSingle*>(rhs));
|
||||||
this->value = static_cast<const ConfigOptionSingle<T>*>(rhs)->value;
|
this->value = static_cast<const ConfigOptionSingle*>(rhs)->value;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator==(const ConfigOption &rhs) const override
|
bool operator==(const ConfigOption &rhs) const override
|
||||||
{
|
{
|
||||||
if (rhs.type() != this->type())
|
if (rhs.type() != this->type())
|
||||||
throw ConfigurationError("ConfigOptionSingle: Comparing incompatible types");
|
throw ConfigurationError("ConfigOptionSingle: Comparing incompatible types");
|
||||||
assert(dynamic_cast<const ConfigOptionSingle<T>*>(&rhs));
|
assert(dynamic_cast<const ConfigOptionSingle*>(&rhs));
|
||||||
return this->value == static_cast<const ConfigOptionSingle<T>*>(&rhs)->value;
|
return this->value == static_cast<const ConfigOptionSingle*>(&rhs)->value;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator==(const T &rhs) const throw() { return this->value == rhs; }
|
bool operator==(const T &rhs) const throw() { return this->value == rhs; }
|
||||||
@ -357,7 +357,7 @@ public:
|
|||||||
throw ConfigurationError("Cannot override a nullable ConfigOption.");
|
throw ConfigurationError("Cannot override a nullable ConfigOption.");
|
||||||
if (rhs->type() != this->type())
|
if (rhs->type() != this->type())
|
||||||
throw ConfigurationError("ConfigOptionVector.overriden_by() applied to different types.");
|
throw ConfigurationError("ConfigOptionVector.overriden_by() applied to different types.");
|
||||||
auto rhs_vec = static_cast<const ConfigOptionSingle<T>*>(rhs);
|
auto rhs_vec = static_cast<const ConfigOptionSingle*>(rhs);
|
||||||
if (! rhs->nullable())
|
if (! rhs->nullable())
|
||||||
// Overridding a non-nullable object with another non-nullable object.
|
// Overridding a non-nullable object with another non-nullable object.
|
||||||
return this->value != rhs_vec->value;
|
return this->value != rhs_vec->value;
|
||||||
@ -370,7 +370,7 @@ public:
|
|||||||
throw ConfigurationError("Cannot override a nullable ConfigOption.");
|
throw ConfigurationError("Cannot override a nullable ConfigOption.");
|
||||||
if (rhs->type() != this->type())
|
if (rhs->type() != this->type())
|
||||||
throw ConfigurationError("ConfigOptionVector.apply_override() applied to different types.");
|
throw ConfigurationError("ConfigOptionVector.apply_override() applied to different types.");
|
||||||
auto rhs_vec = static_cast<const ConfigOptionSingle<T>*>(rhs);
|
auto rhs_vec = static_cast<const ConfigOptionSingle*>(rhs);
|
||||||
if (! rhs->nullable()) {
|
if (! rhs->nullable()) {
|
||||||
// Overridding a non-nullable object with another non-nullable object.
|
// Overridding a non-nullable object with another non-nullable object.
|
||||||
if (this->value != rhs_vec->value) {
|
if (this->value != rhs_vec->value) {
|
||||||
@ -398,6 +398,9 @@ private:
|
|||||||
template<class Archive> void serialize(Archive & ar) { ar(this->value); }
|
template<class Archive> void serialize(Archive & ar) { ar(this->value); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
using ConfigOptionSingleNullable = ConfigOptionSingle<T, true>;
|
||||||
|
|
||||||
// Value of a vector valued option (bools, ints, floats, strings, points)
|
// Value of a vector valued option (bools, ints, floats, strings, points)
|
||||||
class ConfigOptionVectorBase : public ConfigOption {
|
class ConfigOptionVectorBase : public ConfigOption {
|
||||||
public:
|
public:
|
||||||
@ -653,7 +656,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
friend class cereal::access;
|
friend class cereal::access;
|
||||||
template<class Archive> void serialize(Archive &ar) { ar(cereal::base_class<ConfigOptionSingle<double>>(this)); }
|
template<class Archive> void serialize(Archive &ar) { ar(cereal::base_class<ConfigOptionSingle<double, NULLABLE>>(this)); }
|
||||||
};
|
};
|
||||||
|
|
||||||
template<bool NULLABLE>
|
template<bool NULLABLE>
|
||||||
@ -784,19 +787,20 @@ using ConfigOptionFloatNullable = ConfigOptionFloatTempl<true>;
|
|||||||
using ConfigOptionFloats = ConfigOptionFloatsTempl<false>;
|
using ConfigOptionFloats = ConfigOptionFloatsTempl<false>;
|
||||||
using ConfigOptionFloatsNullable = ConfigOptionFloatsTempl<true>;
|
using ConfigOptionFloatsNullable = ConfigOptionFloatsTempl<true>;
|
||||||
|
|
||||||
class ConfigOptionInt : public ConfigOptionSingle<int>
|
template<bool NULLABLE = false>
|
||||||
|
class ConfigOptionIntTempl : public ConfigOptionSingle<int, NULLABLE>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ConfigOptionInt() : ConfigOptionSingle<int>(0) {}
|
ConfigOptionIntTempl() : ConfigOptionSingle<int, NULLABLE>(0) {}
|
||||||
explicit ConfigOptionInt(int value) : ConfigOptionSingle<int>(value) {}
|
explicit ConfigOptionIntTempl(int value) : ConfigOptionSingle<int, NULLABLE>(value) {}
|
||||||
explicit ConfigOptionInt(double _value) : ConfigOptionSingle<int>(int(floor(_value + 0.5))) {}
|
explicit ConfigOptionIntTempl(double _value) : ConfigOptionSingle<int, NULLABLE>(int(floor(_value + 0.5))) {}
|
||||||
|
|
||||||
static ConfigOptionType static_type() { return coInt; }
|
static ConfigOptionType static_type() { return coInt; }
|
||||||
ConfigOptionType type() const override { return static_type(); }
|
ConfigOptionType type() const override { return static_type(); }
|
||||||
int getInt() const override { return this->value; }
|
int getInt() const override { return this->value; }
|
||||||
void setInt(int val) override { this->value = val; }
|
void setInt(int val) override { this->value = val; }
|
||||||
ConfigOption* clone() const override { return new ConfigOptionInt(*this); }
|
ConfigOption* clone() const override { return new ConfigOptionIntTempl(*this); }
|
||||||
bool operator==(const ConfigOptionInt &rhs) const throw() { return this->value == rhs.value; }
|
bool operator==(const ConfigOptionIntTempl &rhs) const throw() { return this->value == rhs.value; }
|
||||||
|
|
||||||
std::string serialize() const override
|
std::string serialize() const override
|
||||||
{
|
{
|
||||||
@ -813,7 +817,7 @@ public:
|
|||||||
return !iss.fail();
|
return !iss.fail();
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfigOptionInt& operator=(const ConfigOption *opt)
|
ConfigOptionIntTempl& operator=(const ConfigOption *opt)
|
||||||
{
|
{
|
||||||
this->set(opt);
|
this->set(opt);
|
||||||
return *this;
|
return *this;
|
||||||
@ -821,9 +825,12 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
friend class cereal::access;
|
friend class cereal::access;
|
||||||
template<class Archive> void serialize(Archive &ar) { ar(cereal::base_class<ConfigOptionSingle<int>>(this)); }
|
template<class Archive> void serialize(Archive &ar) { ar(cereal::base_class<ConfigOptionSingle<int, NULLABLE>>(this)); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
using ConfigOptionInt = ConfigOptionIntTempl<false>;
|
||||||
|
using ConfigOptionIntNullable = ConfigOptionIntTempl<true>;
|
||||||
|
|
||||||
template<bool NULLABLE>
|
template<bool NULLABLE>
|
||||||
class ConfigOptionIntsTempl : public ConfigOptionVector<int>
|
class ConfigOptionIntsTempl : public ConfigOptionVector<int>
|
||||||
{
|
{
|
||||||
@ -1907,6 +1914,8 @@ public:
|
|||||||
template<class Archive> ConfigOption* load_option_from_archive(Archive &archive) const {
|
template<class Archive> ConfigOption* load_option_from_archive(Archive &archive) const {
|
||||||
if (this->nullable) {
|
if (this->nullable) {
|
||||||
switch (this->type) {
|
switch (this->type) {
|
||||||
|
case coFloat: { auto opt = new ConfigOptionFloatNullable(); archive(*opt); return opt; }
|
||||||
|
case coInt: { auto opt = new ConfigOptionIntNullable(); archive(*opt); return opt; }
|
||||||
case coFloats: { auto opt = new ConfigOptionFloatsNullable(); archive(*opt); return opt; }
|
case coFloats: { auto opt = new ConfigOptionFloatsNullable(); archive(*opt); return opt; }
|
||||||
case coInts: { auto opt = new ConfigOptionIntsNullable(); archive(*opt); return opt; }
|
case coInts: { auto opt = new ConfigOptionIntsNullable(); archive(*opt); return opt; }
|
||||||
case coPercents: { auto opt = new ConfigOptionPercentsNullable();archive(*opt); return opt; }
|
case coPercents: { auto opt = new ConfigOptionPercentsNullable();archive(*opt); return opt; }
|
||||||
@ -1939,6 +1948,8 @@ public:
|
|||||||
template<class Archive> ConfigOption* save_option_to_archive(Archive &archive, const ConfigOption *opt) const {
|
template<class Archive> ConfigOption* save_option_to_archive(Archive &archive, const ConfigOption *opt) const {
|
||||||
if (this->nullable) {
|
if (this->nullable) {
|
||||||
switch (this->type) {
|
switch (this->type) {
|
||||||
|
case coFloat: archive(*static_cast<const ConfigOptionFloatNullable*>(opt)); break;
|
||||||
|
case coInt: archive(*static_cast<const ConfigOptionIntNullable*>(opt)); break;
|
||||||
case coFloats: archive(*static_cast<const ConfigOptionFloatsNullable*>(opt)); break;
|
case coFloats: archive(*static_cast<const ConfigOptionFloatsNullable*>(opt)); break;
|
||||||
case coInts: archive(*static_cast<const ConfigOptionIntsNullable*>(opt)); break;
|
case coInts: archive(*static_cast<const ConfigOptionIntsNullable*>(opt)); break;
|
||||||
case coPercents: archive(*static_cast<const ConfigOptionPercentsNullable*>(opt));break;
|
case coPercents: archive(*static_cast<const ConfigOptionPercentsNullable*>(opt));break;
|
||||||
|
@ -609,22 +609,22 @@ static std::vector<std::string> s_Preset_sla_material_options {
|
|||||||
"compatible_printers", "compatible_printers_condition", "inherits",
|
"compatible_printers", "compatible_printers_condition", "inherits",
|
||||||
|
|
||||||
// overriden options
|
// overriden options
|
||||||
"material_support_head_front_diameter",
|
"material_ow_support_head_front_diameter",
|
||||||
"material_support_head_penetration",
|
"material_ow_support_head_penetration",
|
||||||
"material_support_head_width",
|
"material_ow_support_head_width",
|
||||||
"material_support_pillar_diameter",
|
"material_ow_support_pillar_diameter",
|
||||||
|
|
||||||
"material_branchingsupport_head_front_diameter",
|
"material_ow_branchingsupport_head_front_diameter",
|
||||||
"material_branchingsupport_head_penetration",
|
"material_ow_branchingsupport_head_penetration",
|
||||||
"material_branchingsupport_head_width",
|
"material_ow_branchingsupport_head_width",
|
||||||
"material_branchingsupport_pillar_diameter",
|
"material_ow_branchingsupport_pillar_diameter",
|
||||||
|
|
||||||
"material_support_points_density_relative",
|
"material_ow_support_points_density_relative",
|
||||||
|
|
||||||
"material_relative_correction_x",
|
"material_ow_relative_correction_x",
|
||||||
"material_relative_correction_y",
|
"material_ow_relative_correction_y",
|
||||||
"material_relative_correction_z",
|
"material_ow_relative_correction_z",
|
||||||
"material_elefant_foot_compensation"
|
"material_ow_elefant_foot_compensation"
|
||||||
};
|
};
|
||||||
|
|
||||||
static std::vector<std::string> s_Preset_sla_printer_options {
|
static std::vector<std::string> s_Preset_sla_printer_options {
|
||||||
|
@ -4316,7 +4316,7 @@ void PrintConfigDef::init_sla_params()
|
|||||||
}) {
|
}) {
|
||||||
auto it_opt = options.find(opt_key);
|
auto it_opt = options.find(opt_key);
|
||||||
assert(it_opt != options.end());
|
assert(it_opt != options.end());
|
||||||
def = this->add_nullable(std::string("material_") + opt_key, it_opt->second.type == coFloat ? coFloats : coInts);
|
def = this->add_nullable(std::string("material_ow_") + opt_key, it_opt->second.type);
|
||||||
def->label = it_opt->second.label;
|
def->label = it_opt->second.label;
|
||||||
def->full_label = it_opt->second.full_label;
|
def->full_label = it_opt->second.full_label;
|
||||||
def->tooltip = it_opt->second.tooltip;
|
def->tooltip = it_opt->second.tooltip;
|
||||||
@ -4325,8 +4325,8 @@ void PrintConfigDef::init_sla_params()
|
|||||||
def->max = it_opt->second.max;
|
def->max = it_opt->second.max;
|
||||||
def->mode = it_opt->second.mode;
|
def->mode = it_opt->second.mode;
|
||||||
switch (def->type) {
|
switch (def->type) {
|
||||||
case coFloats: def->set_default_value(new ConfigOptionFloatsNullable{ it_opt->second.default_value->getFloat() }); break;
|
case coFloat: def->set_default_value(new ConfigOptionFloatNullable{ it_opt->second.default_value->getFloat() }); break;
|
||||||
case coInts: def->set_default_value(new ConfigOptionIntsNullable { it_opt->second.default_value->getInt() }); break;
|
case coInt: def->set_default_value(new ConfigOptionIntNullable{ it_opt->second.default_value->getInt() }); break;
|
||||||
default: assert(false);
|
default: assert(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -802,7 +802,7 @@ bool SLAPrint::invalidate_state_by_config_options(const std::vector<t_config_opt
|
|||||||
"absolute_correction"sv,
|
"absolute_correction"sv,
|
||||||
"elefant_foot_compensation"sv,
|
"elefant_foot_compensation"sv,
|
||||||
"elefant_foot_min_width"sv,
|
"elefant_foot_min_width"sv,
|
||||||
"gamma_correction"sv
|
"gamma_correction"sv,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Cache the plenty of parameters, which influence the final rasterization only,
|
// Cache the plenty of parameters, which influence the final rasterization only,
|
||||||
@ -837,7 +837,18 @@ bool SLAPrint::invalidate_state_by_config_options(const std::vector<t_config_opt
|
|||||||
"bottle_cost"sv,
|
"bottle_cost"sv,
|
||||||
"bottle_volume"sv,
|
"bottle_volume"sv,
|
||||||
"bottle_weight"sv,
|
"bottle_weight"sv,
|
||||||
"material_density"sv
|
"material_density"sv,
|
||||||
|
// "material_ow_support_pillar_diameter"sv,
|
||||||
|
// "material_ow_support_head_front_diameter"sv,
|
||||||
|
// "material_ow_support_head_penetration"sv,
|
||||||
|
// "material_ow_support_head_width"sv,
|
||||||
|
// "material_ow_branchingsupport_pillar_diameter"sv,
|
||||||
|
// "material_ow_branchingsupport_head_front_diameter"sv,
|
||||||
|
// "material_ow_branchingsupport_head_penetration"sv,
|
||||||
|
// "material_ow_branchingsupport_head_width"sv,
|
||||||
|
// "material_ow_elefant_foot_compensation"sv,
|
||||||
|
// "material_ow_support_points_density_relative"sv,
|
||||||
|
// "material_ow_relative_correction"sv
|
||||||
};
|
};
|
||||||
|
|
||||||
std::vector<SLAPrintStep> steps;
|
std::vector<SLAPrintStep> steps;
|
||||||
@ -922,7 +933,9 @@ bool SLAPrintObject::invalidate_state_by_config_options(const std::vector<t_conf
|
|||||||
} else if (
|
} else if (
|
||||||
opt_key == "support_points_density_relative"
|
opt_key == "support_points_density_relative"
|
||||||
|| opt_key == "support_enforcers_only"
|
|| opt_key == "support_enforcers_only"
|
||||||
|| opt_key == "support_points_minimal_distance") {
|
|| opt_key == "support_points_minimal_distance"
|
||||||
|
// || opt_key == "material_ow_support_points_density_relative"
|
||||||
|
) {
|
||||||
steps.emplace_back(slaposSupportPoints);
|
steps.emplace_back(slaposSupportPoints);
|
||||||
} else if (
|
} else if (
|
||||||
opt_key == "support_head_front_diameter"
|
opt_key == "support_head_front_diameter"
|
||||||
@ -941,6 +954,10 @@ bool SLAPrintObject::invalidate_state_by_config_options(const std::vector<t_conf
|
|||||||
|| opt_key == "support_max_bridge_length"
|
|| opt_key == "support_max_bridge_length"
|
||||||
|| opt_key == "support_max_pillar_link_distance"
|
|| opt_key == "support_max_pillar_link_distance"
|
||||||
|| opt_key == "support_base_safety_distance"
|
|| opt_key == "support_base_safety_distance"
|
||||||
|
// || opt_key == "material_ow_support_pillar_diameter"
|
||||||
|
// || opt_key == "material_ow_support_head_front_diameter"
|
||||||
|
// || opt_key == "material_ow_support_head_penetration"
|
||||||
|
// || opt_key == "material_ow_support_head_width"
|
||||||
|
|
||||||
|| opt_key == "branchingsupport_head_front_diameter"
|
|| opt_key == "branchingsupport_head_front_diameter"
|
||||||
|| opt_key == "branchingsupport_head_penetration"
|
|| opt_key == "branchingsupport_head_penetration"
|
||||||
@ -958,6 +975,10 @@ bool SLAPrintObject::invalidate_state_by_config_options(const std::vector<t_conf
|
|||||||
|| opt_key == "branchingsupport_max_bridge_length"
|
|| opt_key == "branchingsupport_max_bridge_length"
|
||||||
|| opt_key == "branchingsupport_max_pillar_link_distance"
|
|| opt_key == "branchingsupport_max_pillar_link_distance"
|
||||||
|| opt_key == "branchingsupport_base_safety_distance"
|
|| opt_key == "branchingsupport_base_safety_distance"
|
||||||
|
// || opt_key == "material_ow_branchingsupport_pillar_diameter"
|
||||||
|
// || opt_key == "material_ow_branchingsupport_head_front_diameter"
|
||||||
|
// || opt_key == "material_ow_branchingsupport_head_penetration"
|
||||||
|
// || opt_key == "material_ow_branchingsupport_head_width"
|
||||||
|
|
||||||
|| opt_key == "pad_object_gap"
|
|| opt_key == "pad_object_gap"
|
||||||
) {
|
) {
|
||||||
|
@ -194,8 +194,11 @@ void change_opt_value(DynamicPrintConfig& config, const t_config_option_key& opt
|
|||||||
ConfigOptionBools* vec_new = new ConfigOptionBools{ boost::any_cast<unsigned char>(value) != 0 };
|
ConfigOptionBools* vec_new = new ConfigOptionBools{ boost::any_cast<unsigned char>(value) != 0 };
|
||||||
config.option<ConfigOptionBools>(opt_key)->set_at(vec_new, opt_index, 0);
|
config.option<ConfigOptionBools>(opt_key)->set_at(vec_new, opt_index, 0);
|
||||||
break;}
|
break;}
|
||||||
case coInt:
|
case coInt: {
|
||||||
config.set_key_value(opt_key, new ConfigOptionInt(boost::any_cast<int>(value)));
|
//config.set_key_value(opt_key, new ConfigOptionInt(boost::any_cast<int>(value)));
|
||||||
|
int& val_new = config.opt_int(opt_key);
|
||||||
|
val_new = boost::any_cast<int>(value);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case coInts:{
|
case coInts:{
|
||||||
ConfigOptionInts* vec_new = new ConfigOptionInts{ boost::any_cast<int>(value) };
|
ConfigOptionInts* vec_new = new ConfigOptionInts{ boost::any_cast<int>(value) };
|
||||||
|
@ -867,6 +867,12 @@ boost::any ConfigOptionsGroup::get_config_value(const DynamicPrintConfig& config
|
|||||||
{
|
{
|
||||||
switch (opt->type)
|
switch (opt->type)
|
||||||
{
|
{
|
||||||
|
case coFloat:
|
||||||
|
ret = double_to_string(config.option<ConfigOptionFloatNullable>(opt_key)->value);
|
||||||
|
break;
|
||||||
|
case coInt:
|
||||||
|
ret = config.option<ConfigOptionIntNullable>(opt_key)->value;
|
||||||
|
break;
|
||||||
case coPercents:
|
case coPercents:
|
||||||
case coFloats: {
|
case coFloats: {
|
||||||
if (config.option(opt_key)->is_nil())
|
if (config.option(opt_key)->is_nil())
|
||||||
|
@ -5472,7 +5472,7 @@ void TabSLAPrint::build_sla_support_params(const std::vector<SamePair<std::strin
|
|||||||
|
|
||||||
static std::vector<std::string> get_override_opt_kyes_for_line(const std::string& title, const std::string& key)
|
static std::vector<std::string> get_override_opt_kyes_for_line(const std::string& title, const std::string& key)
|
||||||
{
|
{
|
||||||
const std::string preprefix = "material_";
|
const std::string preprefix = "material_ow_";
|
||||||
|
|
||||||
std::vector<std::string> opt_keys;
|
std::vector<std::string> opt_keys;
|
||||||
opt_keys.reserve(3);
|
opt_keys.reserve(3);
|
||||||
@ -5494,9 +5494,9 @@ static std::vector<std::string> get_override_opt_kyes_for_line(const std::string
|
|||||||
void TabSLAMaterial::create_line_with_near_label_widget(ConfigOptionsGroupShp optgroup, const std::string& key)
|
void TabSLAMaterial::create_line_with_near_label_widget(ConfigOptionsGroupShp optgroup, const std::string& key)
|
||||||
{
|
{
|
||||||
if (optgroup->title == "Support head" || optgroup->title == "Support pillar")
|
if (optgroup->title == "Support head" || optgroup->title == "Support pillar")
|
||||||
add_options_into_line(optgroup, { {"", L("Default")}, {"branching", L("Branching")} }, key, "material_");
|
add_options_into_line(optgroup, { {"", L("Default")}, {"branching", L("Branching")} }, key, "material_ow_");
|
||||||
else {
|
else {
|
||||||
const std::string opt_key = std::string("material_") + key;
|
const std::string opt_key = std::string("material_ow_") + key;
|
||||||
if (key == "relative_correction") {
|
if (key == "relative_correction") {
|
||||||
Line line = Line{ m_preset_bundle->printers.get_edited_preset().config.def()->get("relative_correction")->full_label, "" };
|
Line line = Line{ m_preset_bundle->printers.get_edited_preset().config.def()->get("relative_correction")->full_label, "" };
|
||||||
for (auto& axis : { "X", "Y", "Z" }) {
|
for (auto& axis : { "X", "Y", "Z" }) {
|
||||||
@ -5573,7 +5573,7 @@ void TabSLAMaterial::update_line_with_near_label_widget(ConfigOptionsGroupShp op
|
|||||||
if (!m_overrides_options[key])
|
if (!m_overrides_options[key])
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const std::string preprefix = "material_";
|
const std::string preprefix = "material_ow_";
|
||||||
|
|
||||||
std::vector<std::string> opt_keys;
|
std::vector<std::string> opt_keys;
|
||||||
opt_keys.reserve(3);
|
opt_keys.reserve(3);
|
||||||
@ -5627,7 +5627,7 @@ void TabSLAMaterial::update_material_overrides_page()
|
|||||||
|
|
||||||
bool is_checked{ true };
|
bool is_checked{ true };
|
||||||
|
|
||||||
const static std::string preprefix = "material_";
|
const static std::string preprefix = "material_ow_";
|
||||||
if (title == "Support head" || title == "Support pillar") {
|
if (title == "Support head" || title == "Support pillar") {
|
||||||
for (auto& prefix : { "", "branching" })
|
for (auto& prefix : { "", "branching" })
|
||||||
update_line_with_near_label_widget(*optgroup, preprefix + prefix + key, is_checked);
|
update_line_with_near_label_widget(*optgroup, preprefix + prefix + key, is_checked);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user