Fixed #2738
+ Added update for plater config option "filament_colour", when we have multiple extruder print.
This commit is contained in:
parent
6780e74521
commit
7706a5be3e
2 changed files with 24 additions and 18 deletions
src/slic3r/GUI
|
@ -4602,6 +4602,30 @@ void Plater::on_config_change(const DynamicPrintConfig &config)
|
||||||
bool update_scheduled = false;
|
bool update_scheduled = false;
|
||||||
bool bed_shape_changed = false;
|
bool bed_shape_changed = false;
|
||||||
for (auto opt_key : p->config->diff(config)) {
|
for (auto opt_key : p->config->diff(config)) {
|
||||||
|
if (opt_key == "filament_colour")
|
||||||
|
{
|
||||||
|
update_scheduled = true; // update should be scheduled (for update 3DScene) #2738
|
||||||
|
|
||||||
|
/* There is a case, when we use filament_color instead of extruder_color (when extruder_color == "").
|
||||||
|
* Thus plater config option "filament_colour" should be filled with filament_presets values.
|
||||||
|
* Otherwise, on 3dScene will be used last edited filament color for all volumes with extruder_color == "".
|
||||||
|
*/
|
||||||
|
const std::vector<std::string> filament_presets = wxGetApp().preset_bundle->filament_presets;
|
||||||
|
if (filament_presets.size() > 1 &&
|
||||||
|
p->config->option<ConfigOptionStrings>(opt_key)->values.size() != config.option<ConfigOptionStrings>(opt_key)->values.size())
|
||||||
|
{
|
||||||
|
const PresetCollection& filaments = wxGetApp().preset_bundle->filaments;
|
||||||
|
std::vector<std::string> filament_colors;
|
||||||
|
filament_colors.reserve(filament_presets.size());
|
||||||
|
|
||||||
|
for (const std::string& filament_preset : filament_presets)
|
||||||
|
filament_colors.push_back(filaments.find_preset(filament_preset, true)->config.opt_string("filament_colour", (unsigned)0));
|
||||||
|
|
||||||
|
p->config->option<ConfigOptionStrings>(opt_key)->values = filament_colors;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
p->config->set_key_value(opt_key, config.option(opt_key)->clone());
|
p->config->set_key_value(opt_key, config.option(opt_key)->clone());
|
||||||
if (opt_key == "printer_technology")
|
if (opt_key == "printer_technology")
|
||||||
this->set_printer_technology(config.opt_enum<PrinterTechnology>(opt_key));
|
this->set_printer_technology(config.opt_enum<PrinterTechnology>(opt_key));
|
||||||
|
|
|
@ -1621,24 +1621,6 @@ void TabFilament::build()
|
||||||
optgroup->append_single_option_line("filament_density");
|
optgroup->append_single_option_line("filament_density");
|
||||||
optgroup->append_single_option_line("filament_cost");
|
optgroup->append_single_option_line("filament_cost");
|
||||||
|
|
||||||
optgroup->m_on_change = [this](t_config_option_key opt_key, boost::any value) {
|
|
||||||
this->update_dirty();
|
|
||||||
this->on_value_change(opt_key, value);
|
|
||||||
|
|
||||||
if (opt_key == "filament_colour")
|
|
||||||
{
|
|
||||||
const Preset& printer_preset = m_preset_bundle->printers.get_edited_preset();
|
|
||||||
const std::vector<std::string>& colors = static_cast<const ConfigOptionStrings*>(
|
|
||||||
printer_preset.config.option("extruder_colour"))->values;
|
|
||||||
for (const std::string& color : colors)
|
|
||||||
if (color.empty()) {
|
|
||||||
// update scene
|
|
||||||
wxGetApp().plater()->update();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
optgroup = page->new_optgroup(_(L("Temperature")) + wxString(" °C", wxConvUTF8));
|
optgroup = page->new_optgroup(_(L("Temperature")) + wxString(" °C", wxConvUTF8));
|
||||||
Line line = { _(L("Extruder")), "" };
|
Line line = { _(L("Extruder")), "" };
|
||||||
line.append_option(optgroup->get_option("first_layer_temperature"));
|
line.append_option(optgroup->get_option("first_layer_temperature"));
|
||||||
|
|
Loading…
Reference in a new issue