Fix: Correct range checking for int and float Config Options + QoL changes in tooltips (#11915)

* Fix float number not working properly for option min/max (#11211)

* ConfigOptionDef: min/max values type are changed from INT to FLOAT.

(cherry picked from commit f277bc80c22e0c9a067481a4301922e2c96aed47)

* Fix infinite loop and crash when `fuzzy_skin_point_distance` = 0 (SoftFever/OrcaSlicer#11069)

* Fix Linux build issue

* Fix float comparison due to precision loss

* Fix: Range check added for coInt options; Ranges and defaults added in tooltips

---------

Co-authored-by: Noisyfox <timemanager.rick@gmail.com>
Co-authored-by: SoftFever <softfeverever@gmail.com>
This commit is contained in:
Valerii Bokhan
2026-02-23 06:06:07 +01:00
committed by GitHub
parent 5e6a8e4daf
commit 4343ddf823
7 changed files with 128 additions and 49 deletions

View File

@@ -318,6 +318,24 @@ ConfigOption* ConfigOptionDef::create_default_option() const
return this->create_empty_option();
}
bool ConfigOptionDef::is_value_valid(const double value, const int max_precision /*= 4*/) const
{
// Special handling for the nil values
// The nil value is a valid one only for nullable options
if (std::isnan(value))
return this->nullable;
// Special handling of 0
if (this->min == 0.f && value < 0)
return false;
const double ep = std::pow(0.1, max_precision);
if (is_approx(value, (double) this->min, ep) || is_approx(value, (double) this->max, ep))
return true;
return this->min <= value && value <= this->max;
}
// Assignment of the serialization IDs is not thread safe. The Defs shall be initialized from the main thread!
ConfigOptionDef* ConfigDef::add(const t_config_option_key &opt_key, ConfigOptionType type)
{