From d6306f00b75b589fa7272ba584efad71eab74808 Mon Sep 17 00:00:00 2001 From: YuSanka Date: Tue, 16 Nov 2021 10:39:20 +0100 Subject: [PATCH] Resin colors: Set default value when color wasn't set in config --- src/slic3r/GUI/3DScene.cpp | 5 ++++- src/slic3r/GUI/Plater.cpp | 4 ++-- src/slic3r/GUI/PresetComboBoxes.cpp | 5 ++++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/slic3r/GUI/3DScene.cpp b/src/slic3r/GUI/3DScene.cpp index ca634c079..a96ea2d17 100644 --- a/src/slic3r/GUI/3DScene.cpp +++ b/src/slic3r/GUI/3DScene.cpp @@ -25,6 +25,7 @@ #include "libslic3r/PresetBundle.hpp" #include "libslic3r/ClipperUtils.hpp" #include "libslic3r/Tesselate.hpp" +#include "libslic3r/PrintConfig.hpp" #include #include @@ -1020,7 +1021,9 @@ void GLVolumeCollection::update_colors_by_extruder(const DynamicPrintConfig* con if (static_cast(config->opt_int("printer_technology")) == ptSLA) { - const std::string& txt_color = config->opt_string("material_colour"); + const std::string& txt_color = config->opt_string("material_colour").empty() ? + print_config_def.get("material_colour")->get_default_value()->value : + config->opt_string("material_colour"); if (Slic3r::GUI::BitmapCache::parse_color(txt_color, rgb)) { colors.resize(1); colors[0].set(txt_color, rgb); diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index cea8b4fe3..bd8cc4d46 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -141,7 +141,7 @@ public: wxStaticText *info_size; wxStaticText *info_volume; wxStaticText *info_facets; - wxStaticText *info_materials; +// wxStaticText *info_materials; wxStaticText *info_manifold; wxStaticText *label_volume; @@ -199,7 +199,7 @@ ObjectInfo::ObjectInfo(wxWindow *parent) : sizer_manifold->Add(info_manifold, 0, wxLEFT, 2); Add(sizer_manifold, 0, wxEXPAND | wxTOP, 4); - sla_hidden_items = { label_volume, info_volume, /*label_materials, */info_materials }; + sla_hidden_items = { label_volume, info_volume, /*label_materials, info_materials*/ }; } void ObjectInfo::show_sizer(bool show) diff --git a/src/slic3r/GUI/PresetComboBoxes.cpp b/src/slic3r/GUI/PresetComboBoxes.cpp index 33d8442a9..7b9c9846c 100644 --- a/src/slic3r/GUI/PresetComboBoxes.cpp +++ b/src/slic3r/GUI/PresetComboBoxes.cpp @@ -819,8 +819,11 @@ void PlaterPresetComboBox::update() bitmap_key += single_bar ? filament_rgb : filament_rgb + extruder_rgb; } - else if (m_type == Preset::TYPE_SLA_MATERIAL) + else if (m_type == Preset::TYPE_SLA_MATERIAL) { material_rgb = is_selected ? m_preset_bundle->sla_materials.get_edited_preset().config.opt_string("material_colour") : preset.config.opt_string("material_colour"); + if (material_rgb.empty()) + material_rgb = print_config_def.get("material_colour")->get_default_value()->value; + } wxBitmap* bmp = get_bmp(bitmap_key, wide_icons, bitmap_type_name, preset.is_compatible, preset.is_system || preset.is_default,