From 6780e74521111e4e08d8f3fdefab684f3e3e445b Mon Sep 17 00:00:00 2001 From: YuSanka Date: Tue, 13 Aug 2019 14:56:02 +0200 Subject: [PATCH] Update 3D-scene after filament's color change --- src/slic3r/GUI/Tab.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 4afd3a116..22c5a548a 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -1621,6 +1621,24 @@ void TabFilament::build() optgroup->append_single_option_line("filament_density"); 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& colors = static_cast( + 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)); Line line = { _(L("Extruder")), "" }; line.append_option(optgroup->get_option("first_layer_temperature"));