ENH: support filament_z_hop_types

Support override z top type in filament

This is handling for STUDIO-2082

Change-Id: I885d1d5e44d626e28b260ff569d0359e462a5f8d
This commit is contained in:
chunmao.guo 2023-02-09 17:02:41 +08:00 committed by Lane.Wei
parent 3a14acba99
commit cbb84d2fb6
22 changed files with 126 additions and 48 deletions

View file

@ -1021,6 +1021,9 @@ void Choice::BUILD()
if (m_opt.height >= 0) size.SetHeight(m_opt.height*m_em_unit);
if (m_opt.width >= 0) size.SetWidth(m_opt.width*m_em_unit);
if (m_opt.nullable)
m_last_meaningful_value = dynamic_cast<ConfigOptionEnumsGenericNullable const *>(m_opt.default_value.get())->get_at(0);
choice_ctrl* temp;
auto dynamic_list = dynamic_lists.find(m_opt.opt_key);
if (dynamic_list != dynamic_lists.end())
@ -1209,7 +1212,7 @@ void Choice::set_selection()
void Choice::set_value(const std::string& value, bool change_event) //! Redundant?
{
m_disable_change_event = !change_event;
m_disable_change_event = !change_event;
size_t idx=0;
for (auto el : m_opt.enum_values)
@ -1305,6 +1308,12 @@ void Choice::set_value(const boost::any& value, bool change_event)
auto it = std::find(values.begin(), values.end(), key);
val = it == values.end() ? 0 : it - values.begin();
}
if (m_opt.nullable) {
if (val != ConfigOptionEnumsGenericNullable::nil_value())
m_last_meaningful_value = value;
else
val = -1;
}
field->SetSelection(val);
break;
}
@ -1370,7 +1379,9 @@ boost::any& Choice::get_value()
// BBS
if (m_opt.type == coEnum || m_opt.type == coEnums)
{
if (m_opt_id == "top_surface_pattern" || m_opt_id == "bottom_surface_pattern" || m_opt_id == "sparse_infill_pattern" || m_opt_id == "support_style") {
if (m_opt.nullable && field->GetSelection() == -1)
m_value = ConfigOptionEnumsGenericNullable::nil_value();
else if (m_opt_id == "top_surface_pattern" || m_opt_id == "bottom_surface_pattern" || m_opt_id == "sparse_infill_pattern" || m_opt_id == "support_style") {
const std::string& key = m_opt.enum_values[field->GetSelection()];
m_value = int(m_opt.enum_keys_map->at(key));
}
@ -1404,6 +1415,20 @@ boost::any& Choice::get_value()
return m_value;
}
void Choice::set_last_meaningful_value()
{
if (m_opt.nullable) {
set_value(m_last_meaningful_value, false);
on_change_field();
}
}
void Choice::set_na_value()
{
dynamic_cast<choice_ctrl *>(window)->SetSelection(-1);
on_change_field();
}
void Choice::enable() { dynamic_cast<choice_ctrl*>(window)->Enable(); }
void Choice::disable() { dynamic_cast<choice_ctrl*>(window)->Disable(); }