Merge branch 'master' of https://github.com/prusa3d/PrusaSlicer into et_reload_from_disk
This commit is contained in:
commit
1624b634dd
2 changed files with 36 additions and 0 deletions
|
@ -168,6 +168,23 @@ bool ObjectSettings::update_settings_list()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ObjectSettings::add_missed_options(DynamicPrintConfig* config_to, const DynamicPrintConfig& config_from)
|
||||||
|
{
|
||||||
|
bool is_added = false;
|
||||||
|
if (wxGetApp().plater()->printer_technology() == ptFFF)
|
||||||
|
{
|
||||||
|
if (config_to->has("fill_density") && !config_to->has("fill_pattern"))
|
||||||
|
{
|
||||||
|
if (config_from.option<ConfigOptionPercent>("fill_density")->value == 100) {
|
||||||
|
config_to->set_key_value("fill_pattern", config_from.option("fill_pattern")->clone());
|
||||||
|
is_added = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return is_added;
|
||||||
|
}
|
||||||
|
|
||||||
void ObjectSettings::update_config_values(DynamicPrintConfig* config)
|
void ObjectSettings::update_config_values(DynamicPrintConfig* config)
|
||||||
{
|
{
|
||||||
const auto objects_model = wxGetApp().obj_list()->GetModel();
|
const auto objects_model = wxGetApp().obj_list()->GetModel();
|
||||||
|
@ -185,6 +202,12 @@ void ObjectSettings::update_config_values(DynamicPrintConfig* config)
|
||||||
|
|
||||||
auto load_config = [this, config, &main_config]()
|
auto load_config = [this, config, &main_config]()
|
||||||
{
|
{
|
||||||
|
/* Additional check for overrided options.
|
||||||
|
* There is a case, when some options should to be added,
|
||||||
|
* to avoid check loop in the next configuration update
|
||||||
|
*/
|
||||||
|
bool is_added = add_missed_options(config, main_config);
|
||||||
|
|
||||||
// load checked values from main_config to config
|
// load checked values from main_config to config
|
||||||
config->apply_only(main_config, config->keys(), true);
|
config->apply_only(main_config, config->keys(), true);
|
||||||
// Initialize UI components with the config values.
|
// Initialize UI components with the config values.
|
||||||
|
@ -192,6 +215,14 @@ void ObjectSettings::update_config_values(DynamicPrintConfig* config)
|
||||||
og->reload_config();
|
og->reload_config();
|
||||||
// next config check
|
// next config check
|
||||||
update_config_values(config);
|
update_config_values(config);
|
||||||
|
|
||||||
|
if (is_added) {
|
||||||
|
wxTheApp->CallAfter([this]() {
|
||||||
|
wxWindowUpdateLocker noUpdates(m_parent);
|
||||||
|
update_settings_list();
|
||||||
|
m_parent->Layout();
|
||||||
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
auto get_field = [this](const t_config_option_key & opt_key, int opt_index)
|
auto get_field = [this](const t_config_option_key & opt_key, int opt_index)
|
||||||
|
|
|
@ -48,6 +48,11 @@ public:
|
||||||
~ObjectSettings() {}
|
~ObjectSettings() {}
|
||||||
|
|
||||||
bool update_settings_list();
|
bool update_settings_list();
|
||||||
|
/* Additional check for override options: Add options, if its needed.
|
||||||
|
* Example: if Infill is set to 100%, and Fill Pattern is missed in config_to,
|
||||||
|
* we should add fill_pattern to avoid endless loop in update
|
||||||
|
*/
|
||||||
|
bool add_missed_options(DynamicPrintConfig *config_to, const DynamicPrintConfig &config_from);
|
||||||
void update_config_values(DynamicPrintConfig*config);
|
void update_config_values(DynamicPrintConfig*config);
|
||||||
void UpdateAndShow(const bool show) override;
|
void UpdateAndShow(const bool show) override;
|
||||||
void msw_rescale();
|
void msw_rescale();
|
||||||
|
|
Loading…
Reference in a new issue