Fixed linking of the "pad" combo box of the Plater with the respective

pad boolean values of the configuration layer.
This commit is contained in:
bubnikv 2019-08-08 09:48:56 +02:00
parent b7f93292fa
commit 8970ee28b2
2 changed files with 11 additions and 1 deletions

View File

@ -905,7 +905,7 @@ boost::any& Choice::get_value()
wxString ret_str = field->GetValue();
// options from right panel
std::vector <std::string> right_panel_options{ "support", "scale_unit" };
std::vector <std::string> right_panel_options{ "support", "pad", "scale_unit" };
for (auto rp_option: right_panel_options)
if (m_opt_id == rp_option)
return m_value = boost::any(ret_str);

View File

@ -834,6 +834,11 @@ static wxString support_combo_value_for_config(const DynamicPrintConfig &config,
_("Everywhere"));
}
static wxString pad_combo_value_for_config(const DynamicPrintConfig &config)
{
return config.opt_bool("pad_enable") ? (config.opt_bool("pad_zero_elevation") ? _("Around object") : _("Below object")) : _("None");
}
void Tab::on_value_change(const std::string& opt_key, const boost::any& value)
{
if (wxGetApp().plater() == nullptr) {
@ -853,6 +858,9 @@ void Tab::on_value_change(const std::string& opt_key, const boost::any& value)
(opt_key == "supports_enable" || opt_key == "support_buildplate_only"))
og_freq_chng_params->set_value("support", support_combo_value_for_config(*m_config, is_fff));
if (! is_fff && (opt_key == "pad_enable" || opt_key == "pad_zero_elevation"))
og_freq_chng_params->set_value("pad", pad_combo_value_for_config(*m_config));
if (opt_key == "brim_width")
{
bool val = m_config->opt_float("brim_width") > 0.0 ? true : false;
@ -987,6 +995,8 @@ void Tab::update_frequently_changed_parameters()
if (!og_freq_chng_params) return;
og_freq_chng_params->set_value("support", support_combo_value_for_config(*m_config, is_fff));
if (! is_fff)
og_freq_chng_params->set_value("pad", pad_combo_value_for_config(*m_config));
const std::string updated_value_key = is_fff ? "fill_density" : "pad_enable";