Fix in _3DScene::_load_gcode_extrusion_paths::Helper::path_color()

This commit is contained in:
Enrico Turri 2018-05-14 09:00:19 +02:00
parent 4cf74d6dcf
commit e90bc3fcab

View file

@ -2204,7 +2204,7 @@ void _3DScene::_load_gcode_extrusion_paths(const GCodePreviewData& preview_data,
return 0.0f; return 0.0f;
} }
static const GCodePreviewData::Color path_color(const GCodePreviewData& data, const std::vector<float>& tool_colors, float value) static GCodePreviewData::Color path_color(const GCodePreviewData& data, const std::vector<float>& tool_colors, float value)
{ {
switch (data.extrusion.view_type) switch (data.extrusion.view_type)
{ {
@ -2220,7 +2220,7 @@ void _3DScene::_load_gcode_extrusion_paths(const GCodePreviewData& preview_data,
return data.get_volumetric_rate_color(value); return data.get_volumetric_rate_color(value);
case GCodePreviewData::Extrusion::Tool: case GCodePreviewData::Extrusion::Tool:
{ {
static GCodePreviewData::Color color; GCodePreviewData::Color color;
::memcpy((void*)color.rgba, (const void*)(tool_colors.data() + (unsigned int)value * 4), 4 * sizeof(float)); ::memcpy((void*)color.rgba, (const void*)(tool_colors.data() + (unsigned int)value * 4), 4 * sizeof(float));
return color; return color;
} }