@@ -214,6 +214,12 @@ inline OutputFormat operator&=(OutputFormat& a, OutputFormat b) {
214214// A generic value of a configuration option.
215215class ConfigOption {
216216public:
217+ // if true, this option doesn't need to be saved, it's a computed value from an other configOption.
218+ bool phony;
219+
220+ ConfigOption () : phony(false ) {}
221+ ConfigOption (bool phony) : phony(phony) {}
222+
217223 virtual ~ConfigOption () {}
218224
219225 virtual ConfigOptionType type () const = 0;
@@ -258,6 +264,7 @@ class ConfigOptionSingle : public ConfigOption {
258264public:
259265 T value;
260266 explicit ConfigOptionSingle (T value) : value(value) {}
267+ explicit ConfigOptionSingle (T value, bool phony) : ConfigOption(phony), value(value) {}
261268 operator T () const { return this ->value ; }
262269
263270 void set (const ConfigOption *rhs) override
@@ -266,6 +273,7 @@ class ConfigOptionSingle : public ConfigOption {
266273 throw Slic3r::RuntimeError (" ConfigOptionSingle: Assigning an incompatible type" );
267274 assert (dynamic_cast <const ConfigOptionSingle<T>*>(rhs));
268275 this ->value = static_cast <const ConfigOptionSingle<T>*>(rhs)->value ;
276+ this ->phony = rhs->phony ;
269277 }
270278
271279 bool operator ==(const ConfigOption &rhs) const override
@@ -340,6 +348,7 @@ class ConfigOptionVector : public ConfigOptionVectorBase
340348 throw Slic3r::RuntimeError (" ConfigOptionVector: Assigning an incompatible type" );
341349 assert (dynamic_cast <const ConfigOptionVector<T>*>(rhs));
342350 this ->values = static_cast <const ConfigOptionVector<T>*>(rhs)->values ;
351+ this ->phony = rhs->phony ;
343352 }
344353
345354 // Set from a vector of ConfigOptions.
@@ -504,6 +513,7 @@ class ConfigOptionFloat : public ConfigOptionSingle<double>
504513public:
505514 ConfigOptionFloat () : ConfigOptionSingle<double >(0 ) {}
506515 explicit ConfigOptionFloat (double _value) : ConfigOptionSingle<double>(_value) {}
516+ explicit ConfigOptionFloat (double _value, bool _phony) : ConfigOptionSingle<double>(_value, _phony) {}
507517
508518 static ConfigOptionType static_type () { return coFloat; }
509519 ConfigOptionType type () const override { return static_type (); }
@@ -850,6 +860,7 @@ class ConfigOptionPercent : public ConfigOptionFloat
850860public:
851861 ConfigOptionPercent () : ConfigOptionFloat(0 ) {}
852862 explicit ConfigOptionPercent (double _value) : ConfigOptionFloat(_value) {}
863+ explicit ConfigOptionPercent (double _value, bool _phony) : ConfigOptionFloat(_value, _phony) {}
853864
854865 static ConfigOptionType static_type () { return coPercent; }
855866 ConfigOptionType type () const override { return static_type (); }
@@ -943,6 +954,7 @@ class ConfigOptionFloatOrPercent : public ConfigOptionPercent
943954 bool percent;
944955 ConfigOptionFloatOrPercent () : ConfigOptionPercent(0 ), percent(false ) {}
945956 explicit ConfigOptionFloatOrPercent (double _value, bool _percent) : ConfigOptionPercent(_value), percent(_percent) {}
957+ explicit ConfigOptionFloatOrPercent (double _value, bool _percent, bool _phony) : ConfigOptionPercent(_value, _phony), percent(_percent) {}
946958
947959 static ConfigOptionType static_type () { return coFloatOrPercent; }
948960 ConfigOptionType type () const override { return static_type (); }
@@ -1427,6 +1439,7 @@ class ConfigOptionEnum : public ConfigOptionSingle<T>
14271439 throw Slic3r::RuntimeError (" ConfigOptionEnum<T>: Assigning an incompatible type" );
14281440 // rhs could be of the following type: ConfigOptionEnumGeneric or ConfigOptionEnum<T>
14291441 this ->value = (T)rhs->getInt ();
1442+ this ->phony = rhs->phony ;
14301443 }
14311444
14321445 std::string serialize () const override
@@ -1511,6 +1524,7 @@ class ConfigOptionEnumGeneric : public ConfigOptionInt
15111524 throw Slic3r::RuntimeError (" ConfigOptionEnumGeneric: Assigning an incompatible type" );
15121525 // rhs could be of the following type: ConfigOptionEnumGeneric or ConfigOptionEnum<T>
15131526 this ->value = rhs->getInt ();
1527+ this ->phony = rhs->phony ;
15141528 }
15151529
15161530 std::string serialize () const override
@@ -1658,7 +1672,9 @@ class ConfigOptionDef
16581672 // For text input: If true, the GUI formats text as code (fixed-width)
16591673 bool is_code = false ;
16601674 // Not editable. Currently only used for the display of the number of threads.
1661- bool readonly = false ;
1675+ bool readonly = false ;
1676+ // Can be phony. if not present at laoding, mark it as phony. Also adapt the gui to look for phony status.
1677+ bool can_phony = false ;
16621678 // Height of a multiline GUI text box.
16631679 int height = -1 ;
16641680 // Optional width of an input field.
@@ -1907,7 +1923,7 @@ class ConfigBase : public ConfigOptionResolver
19071923 // Returns number of key/value pairs extracted.
19081924 size_t load_from_gcode_string (const char * str);
19091925 void load (const boost::property_tree::ptree &tree);
1910- void save (const std::string &file) const ;
1926+ void save (const std::string &file, bool to_prusa = false ) const ;
19111927
19121928 // Set all the nullable values to nils.
19131929 void null_nullables ();
0 commit comments