Fixed get extruder color for SLA presets
This commit is contained in:
parent
3edca58a0c
commit
47a8b49f8b
@ -4893,7 +4893,11 @@ const DynamicPrintConfig* Plater::get_plater_config() const
|
|||||||
std::vector<std::string> Plater::get_extruder_colors_from_plater_config() const
|
std::vector<std::string> Plater::get_extruder_colors_from_plater_config() const
|
||||||
{
|
{
|
||||||
const Slic3r::DynamicPrintConfig* config = &wxGetApp().preset_bundle->printers.get_edited_preset().config;
|
const Slic3r::DynamicPrintConfig* config = &wxGetApp().preset_bundle->printers.get_edited_preset().config;
|
||||||
std::vector<std::string> extruder_colors = (config->option<ConfigOptionStrings>("extruder_colour"))->values;
|
std::vector<std::string> extruder_colors;
|
||||||
|
if (!config->has("extruder_colour")) // in case of a SLA print
|
||||||
|
return extruder_colors;
|
||||||
|
|
||||||
|
extruder_colors = (config->option<ConfigOptionStrings>("extruder_colour"))->values;
|
||||||
const std::vector<std::string>& filament_colours = (p->config->option<ConfigOptionStrings>("filament_colour"))->values;
|
const std::vector<std::string>& filament_colours = (p->config->option<ConfigOptionStrings>("filament_colour"))->values;
|
||||||
for (size_t i = 0; i < extruder_colors.size(); ++i)
|
for (size_t i = 0; i < extruder_colors.size(); ++i)
|
||||||
if (extruder_colors[i] == "" && i < filament_colours.size())
|
if (extruder_colors[i] == "" && i < filament_colours.size())
|
||||||
|
@ -455,6 +455,9 @@ Slic3r::GUI::BitmapCache* m_bitmap_cache = nullptr;
|
|||||||
std::vector<wxBitmap*> bmps;
|
std::vector<wxBitmap*> bmps;
|
||||||
std::vector<std::string> colors = Slic3r::GUI::wxGetApp().plater()->get_extruder_colors_from_plater_config();
|
std::vector<std::string> colors = Slic3r::GUI::wxGetApp().plater()->get_extruder_colors_from_plater_config();
|
||||||
|
|
||||||
|
if (bmps.empty())
|
||||||
|
return bmps;
|
||||||
|
|
||||||
unsigned char rgb[3];
|
unsigned char rgb[3];
|
||||||
|
|
||||||
/* It's supposed that standard size of an icon is 36px*16px for 100% scaled display.
|
/* It's supposed that standard size of an icon is 36px*16px for 100% scaled display.
|
||||||
@ -484,6 +487,8 @@ static wxBitmap get_extruder_color_icon(size_t extruder_idx)
|
|||||||
{
|
{
|
||||||
// Create the bitmap with color bars.
|
// Create the bitmap with color bars.
|
||||||
std::vector<wxBitmap*> bmps = get_extruder_color_icons();
|
std::vector<wxBitmap*> bmps = get_extruder_color_icons();
|
||||||
|
if (bmps.empty())
|
||||||
|
return wxNullBitmap;
|
||||||
|
|
||||||
return *bmps[extruder_idx >= bmps.size() ? 0 : extruder_idx];
|
return *bmps[extruder_idx >= bmps.size() ? 0 : extruder_idx];
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user