ENH: set filament retract params even if nil

1.Always set filament retract params to filament_num size.In
gcode export module, we can always use filament idx to get
retract params

2. add logic in update_filament_maps_to_config to update the
   retraction related params which can be overiden by filament

jira:NONE

Signed-off-by: xun.zhang <xun.zhang@bambulab.com>
Change-Id: Ia45dd1401aa3565d062d5da1c9f4a2ba8966f693
(cherry picked from commit 4b083d8d8220b8f65a1b804688cb2d6e238eb4e6)
This commit is contained in:
xun.zhang
2024-12-05 17:10:28 +08:00
committed by Noisyfox
parent d637efee3d
commit 07148d2dfd
5 changed files with 70 additions and 27 deletions

View File

@@ -286,7 +286,7 @@ public:
return *this != *rhs;
}
// Apply an override option, possibly a nullable one.
virtual bool apply_override(const ConfigOption *rhs) {
virtual bool apply_override(const ConfigOption *rhs, std::vector<int>& default_index) {
if (*this == *rhs)
return false;
*this = *rhs;
@@ -583,7 +583,7 @@ public:
return false;
}
// Apply an override option, possibly a nullable one.
bool apply_override(const ConfigOption *rhs) override {
bool apply_override(const ConfigOption *rhs, std::vector<int>& default_index) override {
if (this->nullable())
throw ConfigurationError("Cannot override a nullable ConfigOption.");
if (rhs->type() != this->type())
@@ -607,14 +607,16 @@ public:
else
this->values.resize(rhs_vec->size(), this->values.front());
bool modified = false;
auto default_value = this->values[0];
assert(default_index.size() == rhs_vec->size());
bool modified = false;
std::vector<T> default_value = this->values;
for (size_t i = 0; i < rhs_vec->size(); ++i) {
if (!rhs_vec->is_nil(i)) {
this->values[i] = rhs_vec->values[i];
modified = true;
} else {
this->values[i] = default_value;
this->values[i] = default_value[default_index[i]-1];
}
}
return modified;