mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-25 07:34:03 -06:00
Expose static PrintConfig objects to Perl and test apply()
This commit is contained in:
parent
56d4da2ac7
commit
e0c0a42a8b
5 changed files with 35 additions and 6 deletions
|
@ -11,8 +11,13 @@ ConfigBase::apply(ConfigBase &other, bool ignore_nonexistent) {
|
|||
// loop through options and apply them
|
||||
for (t_config_option_keys::const_iterator it = opt_keys.begin(); it != opt_keys.end(); ++it) {
|
||||
ConfigOption* my_opt = this->option(*it);
|
||||
if (my_opt == NULL && ignore_nonexistent == false) throw "Attempt to apply non-existent option";
|
||||
*my_opt = *(other.option(*it));
|
||||
if (my_opt == NULL) {
|
||||
if (ignore_nonexistent == false) throw "Attempt to apply non-existent option";
|
||||
continue;
|
||||
}
|
||||
|
||||
// not the most efficient way, but easier than casting pointers to subclasses
|
||||
my_opt->deserialize( other.option(*it)->serialize() );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue