Implemented use of aliases in Plater's preset comboboxes

This commit is contained in:
YuSanka 2019-11-25 15:57:36 +01:00
parent afb8483250
commit 6a68002a1f
5 changed files with 54 additions and 17 deletions

View file

@ -352,7 +352,10 @@ wxBitmapComboBox(parent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(15 *
// Call select_preset() only if there is new preset and not just modified
if ( !boost::algorithm::ends_with(selected_preset, Preset::suffix_modified()) )
tab->select_preset(selected_preset);
{
const std::string& preset_name = wxGetApp().preset_bundle->filaments.get_preset_name_by_alias(selected_preset);
tab->select_preset(/*selected_preset*/preset_name);
}
}
}));
}
@ -3363,9 +3366,10 @@ void Plater::priv::on_select_preset(wxCommandEvent &evt)
//! combo->GetStringSelection().ToUTF8().data());
const std::string& selected_string = combo->GetString(combo->GetSelection()).ToUTF8().data();
const std::string preset_name = wxGetApp().preset_bundle->filaments.get_preset_name_by_alias(selected_string);
if (preset_type == Preset::TYPE_FILAMENT) {
wxGetApp().preset_bundle->set_filament_preset(idx, selected_string);
wxGetApp().preset_bundle->set_filament_preset(idx, /*selected_string*/preset_name);
}
// TODO: ?
@ -3375,7 +3379,7 @@ void Plater::priv::on_select_preset(wxCommandEvent &evt)
}
else {
wxWindowUpdateLocker noUpdates(sidebar->presets_panel());
wxGetApp().get_tab(preset_type)->select_preset(selected_string);
wxGetApp().get_tab(preset_type)->select_preset(/*selected_string*/preset_name);
}
// update plater with new config
@ -3386,7 +3390,6 @@ void Plater::priv::on_select_preset(wxCommandEvent &evt)
* and for SLA presets they should be deleted
*/
if (preset_type == Preset::TYPE_PRINTER)
// wxGetApp().obj_list()->update_settings_items();
wxGetApp().obj_list()->update_object_list_by_printer_technology();
}