From 812dfdb484b42eaae46c01100feab760738f8d6b Mon Sep 17 00:00:00 2001 From: supermerill Date: Fri, 8 Oct 2021 12:29:37 +0200 Subject: [PATCH] fix filament override for coFloatOrPercent / coFloatsOrPercents supermerill/SuperSlicer#1618 --- src/slic3r/GUI/Field.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/slic3r/GUI/Field.cpp b/src/slic3r/GUI/Field.cpp index cbc49c29e..a4cf9cd41 100644 --- a/src/slic3r/GUI/Field.cpp +++ b/src/slic3r/GUI/Field.cpp @@ -311,8 +311,10 @@ void Field::get_value_by_opt_type(wxString& str, const bool check_value/* = true str.Replace(" ", "", true); str.Replace("m", "", true); - if (!str.ToCDouble(&val)) - { + if (m_opt.nullable && str == na_value()) { + val = ConfigOptionFloatsNullable::nil_value(); + str = "nan"; + } else if (!str.ToCDouble(&val)) { if (!check_value) { m_value.clear(); break; @@ -480,7 +482,6 @@ void TextCtrl::BUILD() { m_opt.default_value->getFloat() : m_opt.get_default_value()->get_at(m_opt_idx); text_value = double_to_string(val, m_opt.precision); - m_last_meaningful_value = text_value; break; } case coFloatsOrPercents: @@ -507,6 +508,7 @@ void TextCtrl::BUILD() { default: break; } + m_last_meaningful_value = text_value; const long style = m_opt.multiline ? wxTE_MULTILINE : wxTE_PROCESS_ENTER/*0*/; auto temp = new wxTextCtrl(m_parent, wxID_ANY, text_value, wxDefaultPosition, size, style);