Update additional object setting after print technology changing

This commit is contained in:
YuSanka 2018-11-29 15:00:23 +01:00
parent 38733ff56a
commit d7f9e86400
4 changed files with 27 additions and 0 deletions

View file

@ -721,6 +721,14 @@ wxMenu* ObjectList::create_settings_popupmenu(bool is_part)
return menu;
}
void ObjectList::update_opt_keys(t_config_option_keys& opt_keys)
{
auto full_current_opts = get_options(false);
for (int i = opt_keys.size()-1; i >= 0; --i)
if (find(full_current_opts.begin(), full_current_opts.end(), opt_keys[i]) == full_current_opts.end())
opt_keys.erase(opt_keys.begin() + i);
}
void ObjectList::load_subobject(int type)
{
auto item = GetSelection();
@ -1549,5 +1557,17 @@ bool ObjectList::has_multi_part_objects()
return false;
}
void ObjectList::update_settings_items()
{
wxDataViewItemArray items;
m_objects_model->GetChildren(wxDataViewItem(0), items);
for (auto& item : items) {
const wxDataViewItem& settings_item = m_objects_model->GetSettingsItem(item);
select_item(settings_item ? settings_item : m_objects_model->AddSettingsChild(item));
}
UnselectAll();
}
} //namespace GUI
} //namespace Slic3r

View file

@ -102,6 +102,8 @@ public:
wxMenu* create_part_popupmenu();
wxMenu* create_settings_popupmenu(bool is_part);
void update_opt_keys(t_config_option_keys& t_optopt_keys);
void load_subobject(int type);
void load_part(ModelObject* model_object, wxArrayString& part_names, int type);
void load_generic_subobject(const std::string& type_name, const int type);
@ -167,6 +169,7 @@ public:
void last_volume_is_deleted(const int obj_idx);
bool has_multi_part_objects();
void update_settings_items();
};

View file

@ -92,6 +92,8 @@ void ObjectSettings::update_settings_list()
std::map<std::string, std::vector<std::string>> cat_options;
auto opt_keys = config->keys();
objects_ctrl->update_opt_keys(opt_keys); // update options list according to print technology
m_og_settings.resize(0);
std::vector<std::string> categories;
if (!(opt_keys.size() == 1 && opt_keys[0] == "extruder"))// return;

View file

@ -2006,6 +2006,8 @@ void Plater::priv::on_select_preset(wxCommandEvent &evt)
// update plater with new config
wxGetApp().plater()->on_config_change(wxGetApp().preset_bundle->full_config());
if (preset_type == Preset::TYPE_PRINTER)
wxGetApp().obj_list()->update_settings_items();
}
void Plater::priv::on_slicing_update(SlicingStatusEvent &evt)