Added a check that first layer height is not expressed as a percentage (related to https://github.com/prusa3d/PrusaSlicer/issues/7418)

first_layer_height cannot be changed to ConfigOptionFloat, that would break loading of old 3MFs.
The relative values from 3MFs should already be converted to absolute in `Preset::normalize`, what is missing is the UI check.

+ Code refactoring for OptionsGroup::create_single_option_line():
Don't clear label value in an Option. This value is used in Field::get_value_by_opt_type() to show error "%s doesn't support percentage".
=> At functions OG_CustomCtrl::CtrlLine::render() and OG_CustomCtrl::CtrlLine::get_pos() added check if current line has more than one option.
=> Draw option's label only when line has several options.
This commit is contained in:
YuSanka 2021-12-07 09:17:45 +01:00
parent 091585076c
commit d8ecc191da
4 changed files with 18 additions and 7 deletions
src/slic3r/GUI

View file

@ -291,6 +291,16 @@ void Field::get_value_by_opt_type(wxString& str, const bool check_value/* = true
case coString:
case coStrings:
case coFloatOrPercent: {
if (m_opt.type == coFloatOrPercent && m_opt.opt_key == "first_layer_height" && !str.IsEmpty() && str.Last() == '%') {
// Workaroud to avoid of using of the % for first layer height
// see https://github.com/prusa3d/PrusaSlicer/issues/7418
wxString label = m_opt.full_label.empty() ? _(m_opt.label) : _(m_opt.full_label);
show_error(m_parent, from_u8((boost::format(_utf8(L("%s doesn't support percentage"))) % label).str()));
const wxString stVal = double_to_string(0.01, 2);
set_value(stVal, true);
m_value = into_u8(stVal);;
break;
}
if (m_opt.type == coFloatOrPercent && !str.IsEmpty() && str.Last() != '%')
{
double val = 0.;