mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-16 18:12:10 +00:00
ENH: config apply_only vector at index
Change-Id: I7bf5a44b2d3db2e21207696b6ef7e41a499da078 Jira: STUDIO-7747 (cherry picked from commit 5f30ee389e804f3a71021cdec231a0c92d21d83c)
This commit is contained in:
@@ -451,6 +451,17 @@ void ConfigBase::apply_only(const ConfigBase &other, const t_config_option_keys
|
||||
if (my_opt == nullptr) {
|
||||
// opt_key does not exist in this ConfigBase and it cannot be created, because it is not defined by this->def().
|
||||
// This is only possible if other is of DynamicConfig type.
|
||||
if (auto n = opt_key.find('#'); n != std::string::npos) {
|
||||
auto opt_key2 = opt_key.substr(0, n);
|
||||
auto my_opt2 = dynamic_cast<ConfigOptionVectorBase*>(this->option(opt_key2, true));
|
||||
if (my_opt2) {
|
||||
int index = std::atoi(opt_key.c_str() + n + 1);
|
||||
auto other_opt = other.option(opt_key2);
|
||||
if (other_opt)
|
||||
my_opt2->set_at(other_opt, index, index);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (ignore_nonexistent)
|
||||
continue;
|
||||
throw UnknownOptionException(opt_key);
|
||||
|
||||
Reference in New Issue
Block a user