fix merge conflicts

This commit is contained in:
Ian Chua
2026-07-15 21:04:42 +08:00
1025 changed files with 214936 additions and 22047 deletions
+30 -2
View File
@@ -364,6 +364,7 @@ public:
virtual void set_with_restore(const ConfigOptionVectorBase* rhs, std::vector<int>& restore_index, int stride) = 0;
virtual void set_with_restore_2(const ConfigOptionVectorBase* rhs, std::vector<int>& restore_index, int start, int len, bool skip_error = false) = 0;
virtual void set_only_diff(const ConfigOptionVectorBase* rhs, std::vector<int>& diff_index, int stride) = 0;
virtual void set_to_index(const ConfigOptionVectorBase* rhs, std::vector<int>& dest_index, int stride) = 0;
virtual void set_with_nil(const ConfigOptionVectorBase* rhs, const ConfigOptionVectorBase* inherits, int stride) = 0;
// Resize the vector of values, copy the newly added values from opt_default if provided.
virtual void resize(size_t n, const ConfigOption *opt_default = nullptr) = 0;
@@ -587,6 +588,32 @@ public:
throw ConfigurationError("ConfigOptionVector::set_only_diff(): Assigning an incompatible type");
}
//set a item related with extruder variants when apply static config with dynamic config
//rhs: item from dynamic config
//dest_index: which index in this vector need to be used
virtual void set_to_index(const ConfigOptionVectorBase* rhs, std::vector<int>& dest_index, int stride) override
{
if (rhs->type() == this->type()) {
// Assign the first value of the rhs vector.
auto other = static_cast<const ConfigOptionVector<T>*>(rhs);
T v = other->values.front();
this->values.resize(dest_index.size() * stride, v);
for (size_t i = 0; i < dest_index.size(); i++) {
if (dest_index[i] < 0)
continue;
for (size_t j = 0; j < size_t(stride); j++)
{
const size_t src_idx = size_t(dest_index[i]) * size_t(stride) + j;
if (src_idx < other->values.size() && !other->is_nil(size_t(dest_index[i]) * size_t(stride)))
this->values[i * size_t(stride) + j] = other->values[src_idx];
}
}
}
else
throw ConfigurationError("ConfigOptionVector::set_to_index(): Assigning an incompatible type");
}
//set a item related with extruder variants when saving user config, set the non-diff value of some extruder to nill
//this item has different value with inherit config
//rhs: item from userconfig
@@ -717,6 +744,7 @@ public:
return false;
}
// Apply an override option, possibly a nullable one.
//default_index are 0 based
bool apply_override(const ConfigOption *rhs, std::vector<int>& default_index) override {
if (this->nullable())
throw ConfigurationError("Cannot override a nullable ConfigOption.");
@@ -752,8 +780,8 @@ public:
this->values[i] = rhs_vec->values[i];
modified = true;
} else {
if ((i < default_index.size()) && (default_index[i] - 1 < default_value.size()))
this->values[i] = default_value[default_index[i] - 1];
if ((i < default_index.size()) && (default_index[i] < default_value.size()))
this->values[i] = default_value[default_index[i]];
else
this->values[i] = default_value[0];
}