mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-07-30 20:01:58 +08:00
New gcode visualization integration - Customizable extrusion roles colors
This commit is contained in:
parent
00a19fe4eb
commit
bcfec2ae1a
@ -1172,6 +1172,7 @@ void GCodeViewer::load_as_gcode(const GCodeProcessorResult& gcode_result, const
|
||||
libvgcode::GCodeInputData data = libvgcode::convert(gcode_result, m_new_viewer.get_travels_radius(), m_new_viewer.get_wipes_radius());
|
||||
|
||||
// send data to the viewer
|
||||
m_new_viewer.reset_default_extrusion_roles_colors();
|
||||
m_new_viewer.load(std::move(data));
|
||||
|
||||
#if ENABLE_NEW_GCODE_VIEWER_NO_COG_AND_TOOL_MARKERS
|
||||
@ -1345,6 +1346,14 @@ void GCodeViewer::load_as_preview(libvgcode::GCodeInputData&& data, const std::v
|
||||
}
|
||||
m_new_viewer.set_tool_colors(colors);
|
||||
}
|
||||
|
||||
m_new_viewer.set_extrusion_role_color(libvgcode::EGCodeExtrusionRole::Skirt, { 127, 255, 127 });
|
||||
m_new_viewer.set_extrusion_role_color(libvgcode::EGCodeExtrusionRole::ExternalPerimeter, { 255, 255, 0 });
|
||||
m_new_viewer.set_extrusion_role_color(libvgcode::EGCodeExtrusionRole::SupportMaterial, { 127, 255, 127 });
|
||||
m_new_viewer.set_extrusion_role_color(libvgcode::EGCodeExtrusionRole::SupportMaterialInterface, { 127, 255, 127 });
|
||||
m_new_viewer.set_extrusion_role_color(libvgcode::EGCodeExtrusionRole::InternalInfill, { 255, 127, 127 });
|
||||
m_new_viewer.set_extrusion_role_color(libvgcode::EGCodeExtrusionRole::SolidInfill, { 255, 127, 127 });
|
||||
m_new_viewer.set_extrusion_role_color(libvgcode::EGCodeExtrusionRole::WipeTower, { 127, 255, 127 });
|
||||
m_new_viewer.load(std::move(data));
|
||||
|
||||
const libvgcode::AABox bbox = m_new_viewer.get_bounding_box(libvgcode::EBBoxType::Extrusion);
|
||||
@ -4842,7 +4851,7 @@ void GCodeViewer::render_legend(float& legend_height)
|
||||
const bool visible = is_visible(role);
|
||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
#if ENABLE_NEW_GCODE_VIEWER
|
||||
append_item(EItemType::Rect, libvgcode::convert(libvgcode::Extrusion_Roles_Colors[static_cast<size_t>(role)]), labels[i],
|
||||
append_item(EItemType::Rect, libvgcode::convert(m_new_viewer.get_extrusion_role_color(role)), labels[i],
|
||||
visible, times[i], percents[i], max_time_percent, offsets, used_filaments_m[i], used_filaments_g[i],
|
||||
[this, role]() {
|
||||
const std::array<uint32_t, 2> view_visible_range = m_new_viewer.get_view_visible_range();
|
||||
|
@ -867,30 +867,30 @@ void Preview::load_print_as_fff(bool keep_z_range)
|
||||
return;
|
||||
}
|
||||
|
||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
#if ENABLE_NEW_GCODE_VIEWER
|
||||
const libvgcode::EViewType gcode_view_type = m_canvas->get_gcode_view_type();
|
||||
#else
|
||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@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||
bool gcode_preview_data_valid = !m_gcode_result->moves.empty();
|
||||
|
||||
// Collect colors per extruder.
|
||||
std::vector<std::string> colors;
|
||||
std::vector<CustomGCode::Item> color_print_values = {};
|
||||
// set color print values, if it si selected "ColorPrint" view type
|
||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
#if ENABLE_NEW_GCODE_VIEWER
|
||||
if (gcode_view_type == libvgcode::EViewType::ColorPrint) {
|
||||
#else
|
||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
if (gcode_view_type == GCodeViewer::EViewType::ColorPrint) {
|
||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
#endif // ENABLE_NEW_GCODE_VIEWER
|
||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
colors = wxGetApp().plater()->get_colors_for_color_print(m_gcode_result);
|
||||
|
||||
if (!gcode_preview_data_valid) {
|
||||
@ -901,15 +901,15 @@ void Preview::load_print_as_fff(bool keep_z_range)
|
||||
colors.push_back("#808080"); // gray color for pause print or custom G-code
|
||||
}
|
||||
}
|
||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
#if ENABLE_NEW_GCODE_VIEWER
|
||||
else if (gcode_preview_data_valid || gcode_view_type == libvgcode::EViewType::Tool) {
|
||||
#else
|
||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
else if (gcode_preview_data_valid || gcode_view_type == GCodeViewer::EViewType::Tool) {
|
||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
#endif // ENABLE_NEW_GCODE_VIEWER
|
||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
colors = wxGetApp().plater()->get_extruder_colors_from_plater_config(m_gcode_result);
|
||||
color_print_values.clear();
|
||||
}
|
||||
@ -959,29 +959,29 @@ void Preview::load_print_as_fff(bool keep_z_range)
|
||||
m_canvas->get_custom_gcode_per_print_z();
|
||||
const bool contains_color_gcodes = std::any_of(std::begin(gcodes), std::end(gcodes),
|
||||
[](auto const& item) { return item.type == CustomGCode::Type::ColorChange || item.type == CustomGCode::Type::ToolChange; });
|
||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
#if ENABLE_NEW_GCODE_VIEWER
|
||||
const libvgcode::EViewType choice = contains_color_gcodes ?
|
||||
libvgcode::EViewType::ColorPrint :
|
||||
(number_extruders > 1) ? libvgcode::EViewType::Tool : libvgcode::EViewType::FeatureType;
|
||||
#else
|
||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
const GCodeViewer::EViewType choice = contains_color_gcodes ?
|
||||
GCodeViewer::EViewType::ColorPrint :
|
||||
(number_extruders > 1) ? GCodeViewer::EViewType::Tool : GCodeViewer::EViewType::FeatureType;
|
||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
#endif // ENABLE_NEW_GCODE_VIEWER
|
||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||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@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
#endif // ENABLE_NEW_GCODE_VIEWER
|
||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
if (wxGetApp().is_gcode_viewer())
|
||||
m_keep_current_preview_type = true;
|
||||
refresh_print();
|
||||
|
@ -198,28 +198,6 @@ static const std::vector<Color> Ranges_Colors{ {
|
||||
{ 148, 38, 22 } // reddish
|
||||
} };
|
||||
|
||||
//
|
||||
// Palette used to render extrusion moves by extrusion roles
|
||||
// EViewType: FeatureType
|
||||
//
|
||||
static const std::vector<Color> Extrusion_Roles_Colors{ {
|
||||
{ 230, 179, 179 }, // None
|
||||
{ 255, 230, 77 }, // Perimeter
|
||||
{ 255, 125, 56 }, // ExternalPerimeter
|
||||
{ 31, 31, 255 }, // OverhangPerimeter
|
||||
{ 176, 48, 41 }, // InternalInfill
|
||||
{ 150, 84, 204 }, // SolidInfill
|
||||
{ 240, 64, 64 }, // TopSolidInfill
|
||||
{ 255, 140, 105 }, // Ironing
|
||||
{ 77, 128, 186 }, // BridgeInfill
|
||||
{ 255, 255, 255 }, // GapFill
|
||||
{ 0, 135, 110 }, // Skirt
|
||||
{ 0, 255, 0 }, // SupportMaterial
|
||||
{ 0, 128, 0 }, // SupportMaterialInterface
|
||||
{ 179, 227, 171 }, // WipeTower
|
||||
{ 94, 209, 148 } // Custom
|
||||
} };
|
||||
|
||||
//
|
||||
// Palette used to render travel moves
|
||||
// EViewType: FeatureType, Height, Width, FanSpeed, Temperature, VolumetricFlowRate,
|
||||
|
@ -147,6 +147,10 @@ public:
|
||||
const std::vector<Color>& get_tool_colors() const;
|
||||
void set_tool_colors(const std::vector<Color>& colors);
|
||||
|
||||
const Color& get_extrusion_role_color(EGCodeExtrusionRole role) const;
|
||||
void set_extrusion_role_color(EGCodeExtrusionRole role, const Color& color);
|
||||
void reset_default_extrusion_roles_colors();
|
||||
|
||||
const ColorRange& get_height_range() const;
|
||||
const ColorRange& get_width_range() const;
|
||||
const ColorRange& get_speed_range() const;
|
||||
|
@ -257,6 +257,21 @@ void Viewer::set_tool_colors(const std::vector<Color>& colors)
|
||||
m_impl->set_tool_colors(colors);
|
||||
}
|
||||
|
||||
const Color& Viewer::get_extrusion_role_color(EGCodeExtrusionRole role) const
|
||||
{
|
||||
return m_impl->get_extrusion_role_color(role);
|
||||
}
|
||||
|
||||
void Viewer::set_extrusion_role_color(EGCodeExtrusionRole role, const Color& color)
|
||||
{
|
||||
m_impl->set_extrusion_role_color(role, color);
|
||||
}
|
||||
|
||||
void Viewer::reset_default_extrusion_roles_colors()
|
||||
{
|
||||
m_impl->reset_default_extrusion_roles_colors();
|
||||
}
|
||||
|
||||
const ColorRange& Viewer::get_height_range() const
|
||||
{
|
||||
return m_impl->get_height_range();
|
||||
|
@ -962,6 +962,30 @@ void ViewerImpl::set_tool_colors(const std::vector<Color>& colors)
|
||||
m_settings.update_colors = true;
|
||||
}
|
||||
|
||||
const Color& ViewerImpl::get_extrusion_role_color(EGCodeExtrusionRole role) const
|
||||
{
|
||||
try
|
||||
{
|
||||
return m_extrusion_roles_colors.at(role);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
return Dummy_Color;
|
||||
}
|
||||
}
|
||||
|
||||
void ViewerImpl::set_extrusion_role_color(EGCodeExtrusionRole role, const Color& color)
|
||||
{
|
||||
auto it = m_extrusion_roles_colors.find(role);
|
||||
if (it != m_extrusion_roles_colors.end())
|
||||
m_extrusion_roles_colors[role] = color;
|
||||
}
|
||||
|
||||
void ViewerImpl::reset_default_extrusion_roles_colors()
|
||||
{
|
||||
m_extrusion_roles_colors = Default_Extrusion_Roles_Colors;
|
||||
}
|
||||
|
||||
const ColorRange& ViewerImpl::get_height_range() const
|
||||
{
|
||||
return m_height_range;
|
||||
@ -1284,8 +1308,8 @@ Color ViewerImpl::select_color(const PathVertex& v) const
|
||||
{
|
||||
case EViewType::FeatureType:
|
||||
{
|
||||
assert((v.is_travel() && role < Travels_Colors.size()) || (v.is_extrusion() && role < Extrusion_Roles_Colors.size()));
|
||||
return v.is_travel() ? Travels_Colors[role] : Extrusion_Roles_Colors[role];
|
||||
assert((v.is_travel() && role < Travels_Colors.size()) || v.is_extrusion());
|
||||
return v.is_travel() ? Travels_Colors[role] : get_extrusion_role_color(v.role);
|
||||
}
|
||||
case EViewType::Height:
|
||||
{
|
||||
|
@ -28,6 +28,28 @@ namespace libvgcode {
|
||||
|
||||
struct GCodeInputData;
|
||||
|
||||
//
|
||||
// Palette used to render extrusion moves by extrusion roles
|
||||
// EViewType: FeatureType
|
||||
//
|
||||
static const std::map<EGCodeExtrusionRole, Color> Default_Extrusion_Roles_Colors{ {
|
||||
{ EGCodeExtrusionRole::None, { 230, 179, 179 } },
|
||||
{ EGCodeExtrusionRole::Perimeter, { 255, 230, 77 } },
|
||||
{ EGCodeExtrusionRole::ExternalPerimeter, { 255, 125, 56 } },
|
||||
{ EGCodeExtrusionRole::OverhangPerimeter, { 31, 31, 255 } },
|
||||
{ EGCodeExtrusionRole::InternalInfill, { 176, 48, 41 } },
|
||||
{ EGCodeExtrusionRole::SolidInfill, { 150, 84, 204 } },
|
||||
{ EGCodeExtrusionRole::TopSolidInfill, { 240, 64, 64 } },
|
||||
{ EGCodeExtrusionRole::Ironing, { 255, 140, 105 } },
|
||||
{ EGCodeExtrusionRole::BridgeInfill, { 77, 128, 186 } },
|
||||
{ EGCodeExtrusionRole::GapFill, { 255, 255, 255 } },
|
||||
{ EGCodeExtrusionRole::Skirt, { 0, 135, 110 } },
|
||||
{ EGCodeExtrusionRole::SupportMaterial, { 0, 255, 0 } },
|
||||
{ EGCodeExtrusionRole::SupportMaterialInterface, { 0, 128, 0 } },
|
||||
{ EGCodeExtrusionRole::WipeTower, { 179, 227, 171 } },
|
||||
{ EGCodeExtrusionRole::Custom, { 94, 209, 148 } }
|
||||
} };
|
||||
|
||||
class ViewerImpl
|
||||
{
|
||||
public:
|
||||
@ -130,6 +152,10 @@ public:
|
||||
const std::vector<Color>& get_tool_colors() const;
|
||||
void set_tool_colors(const std::vector<Color>& colors);
|
||||
|
||||
const Color& get_extrusion_role_color(EGCodeExtrusionRole role) const;
|
||||
void set_extrusion_role_color(EGCodeExtrusionRole role, const Color& color);
|
||||
void reset_default_extrusion_roles_colors();
|
||||
|
||||
const ColorRange& get_height_range() const;
|
||||
const ColorRange& get_width_range() const;
|
||||
const ColorRange& get_speed_range() const;
|
||||
@ -181,6 +207,8 @@ private:
|
||||
bool m_initialized{ false };
|
||||
bool m_loading{ false };
|
||||
|
||||
std::map<EGCodeExtrusionRole, Color> m_extrusion_roles_colors{ Default_Extrusion_Roles_Colors };
|
||||
|
||||
//
|
||||
// The OpenGL element used to represent all toolpath segments
|
||||
//
|
||||
|
Loading…
x
Reference in New Issue
Block a user