FIX: [STUDIO-1694] change support filament to default if out of range
Change-Id: Ie67b1832ec92cd66c14461d01363bbf2c2069185
This commit is contained in:
parent
88fbcb181e
commit
31ff48ccca
3 changed files with 11 additions and 2 deletions
|
@ -469,7 +469,7 @@ void ConfigManipulation::update_print_fff_config(DynamicPrintConfig* config, con
|
|||
if (opt != nullptr) {
|
||||
if (opt->getInt() > filament_cnt) {
|
||||
DynamicPrintConfig new_conf = *config;
|
||||
new_conf.set_key_value(key, new ConfigOptionInt(filament_cnt));
|
||||
new_conf.set_key_value(key, new ConfigOptionInt(0));
|
||||
apply(config, &new_conf);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -607,6 +607,11 @@ void ObjectList::update_filament_values_for_items(const size_t filaments_count)
|
|||
}
|
||||
m_objects_model->SetExtruder(extruder, item);
|
||||
|
||||
static const char *keys[] = {"support_filament", "support_interface_filament"};
|
||||
for (auto key : keys)
|
||||
if (object->config.has(key) && object->config.opt_int(key) > filaments_count)
|
||||
object->config.erase(key);
|
||||
|
||||
if (object->volumes.size() > 1) {
|
||||
for (size_t id = 0; id < object->volumes.size(); id++) {
|
||||
item = m_objects_model->GetItemByVolumeId(i, id);
|
||||
|
@ -620,6 +625,10 @@ void ObjectList::update_filament_values_for_items(const size_t filaments_count)
|
|||
}
|
||||
|
||||
m_objects_model->SetExtruder(extruder, item);
|
||||
|
||||
for (auto key : keys)
|
||||
if (object->volumes[id]->config.has(key) && object->volumes[id]->config.opt_int(key) > filaments_count)
|
||||
object->volumes[id]->config.erase(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -447,7 +447,7 @@ static struct DynamicFilamentList : DynamicList
|
|||
int index_of(wxString value) override
|
||||
{
|
||||
long n = 0;
|
||||
return value.ToLong(&n) ? int(n) : -1;
|
||||
return (value.ToLong(&n) && n <= items.size()) ? int(n) : -1;
|
||||
}
|
||||
void update(bool force = false)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue