Skip to content

Commit

Permalink
Fix color update on fresh extruder
Browse files Browse the repository at this point in the history
  • Loading branch information
supermerill committed Oct 7, 2021
1 parent 2eaa677 commit 666851a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/slic3r/GUI/Plater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6084,6 +6084,17 @@ void Plater::on_config_change(const DynamicPrintConfig &config)
}
else if(opt_key == "extruder_colour") {
update_scheduled = true;
if (p->config->option<ConfigOptionStrings>("filament_colour")->values.size() < config.option<ConfigOptionStrings>(opt_key)->values.size()) {
const std::vector<std::string> filament_presets = wxGetApp().preset_bundle->filament_presets;
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>("filament_colour")->values = filament_colors;
}
#if !ENABLE_PREVIEW_TYPE_CHANGE
p->preview->set_number_extruders(p->config->option<ConfigOptionStrings>(opt_key)->values.size());
#endif // !ENABLE_PREVIEW_TYPE_CHANGE
Expand Down

0 comments on commit 666851a

Please sign in to comment.