mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-11 16:57:53 -06:00
Fixed is_nil() method on ConfigOptions.
PlaceholderParser was extended to support external config. The external config has a lowest priority when looking up a variable.
This commit is contained in:
parent
6ea3a8e2b4
commit
42c8940795
4 changed files with 20 additions and 12 deletions
|
@ -378,7 +378,7 @@ public:
|
|||
static double nil_value() { return std::numeric_limits<double>::quiet_NaN(); }
|
||||
// A scalar is nil, or all values of a vector are nil.
|
||||
bool is_nil() const override { for (auto v : this->values) if (! std::isnan(v)) return false; return true; }
|
||||
bool is_nil(size_t idx) const override { return std::isnan(v->values[idx]); }
|
||||
bool is_nil(size_t idx) const override { return std::isnan(this->values[idx]); }
|
||||
|
||||
std::string serialize() const override
|
||||
{
|
||||
|
@ -524,7 +524,7 @@ public:
|
|||
static int nil_value() { return std::numeric_limits<int>::max(); }
|
||||
// A scalar is nil, or all values of a vector are nil.
|
||||
bool is_nil() const override { for (auto v : this->values) if (v != nil_value()) return false; return true; }
|
||||
bool is_nil(size_t idx) const override { return v->values[idx] == nil_value(); }
|
||||
bool is_nil(size_t idx) const override { return this->values[idx] == nil_value(); }
|
||||
|
||||
std::string serialize() const override
|
||||
{
|
||||
|
@ -633,6 +633,7 @@ public:
|
|||
ConfigOption* clone() const override { return new ConfigOptionStrings(*this); }
|
||||
ConfigOptionStrings& operator=(const ConfigOption *opt) { this->set(opt); return *this; }
|
||||
bool operator==(const ConfigOptionStrings &rhs) const { return this->values == rhs.values; }
|
||||
bool is_nil(size_t idx) const override { return false; }
|
||||
|
||||
std::string serialize() const override
|
||||
{
|
||||
|
@ -847,6 +848,7 @@ public:
|
|||
ConfigOption* clone() const override { return new ConfigOptionPoints(*this); }
|
||||
ConfigOptionPoints& operator=(const ConfigOption *opt) { this->set(opt); return *this; }
|
||||
bool operator==(const ConfigOptionPoints &rhs) const { return this->values == rhs.values; }
|
||||
bool is_nil(size_t idx) const override { return false; }
|
||||
|
||||
std::string serialize() const override
|
||||
{
|
||||
|
@ -994,7 +996,7 @@ public:
|
|||
static unsigned char nil_value() { return std::numeric_limits<unsigned char>::max(); }
|
||||
// A scalar is nil, or all values of a vector are nil.
|
||||
bool is_nil() const override { for (auto v : this->values) if (v != nil_value()) return false; return true; }
|
||||
bool is_nil(size_t idx) const override { return v->values[idx] == nil_value(); }
|
||||
bool is_nil(size_t idx) const override { return this->values[idx] == nil_value(); }
|
||||
|
||||
bool& get_at(size_t i) {
|
||||
assert(! this->values.empty());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue