mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-10-10 17:21:10 +00:00
Merge pull request #3: port the IDEX/IQEX rendering onto the render_scene/render_overlay split
Fix the GCodeViewer.cpp conflict resolution from the upstream merge
This commit is contained in:
@@ -1003,19 +1003,19 @@ void GCodeViewer::SequentialView::GCodeWindow::stop_mapping_file()
|
||||
}
|
||||
void GCodeViewer::SequentialView::render_marker(const bool has_render_path, int canvas_width, int canvas_height, const libvgcode::EViewType& view_type)
|
||||
{
|
||||
if (has_render_path && m_show_marker)
|
||||
if (has_render_path && m_show_marker) {
|
||||
// marker.set_world_offset(current_offset);
|
||||
marker.render(canvas_width, canvas_height, view_type);
|
||||
// IDEX/IQEX secondary carriage markers
|
||||
for (auto& sec : m_imex_secondary_markers)
|
||||
sec.render(canvas_width, canvas_height, view_type);
|
||||
}
|
||||
}
|
||||
|
||||
void GCodeViewer::SequentialView::render_overlay(const bool has_render_path, float legend_height, const libvgcode::Viewer* viewer, uint32_t gcode_id, int canvas_width, int canvas_height, int right_margin, const libvgcode::EViewType& view_type)
|
||||
{
|
||||
if (has_render_path && m_show_marker)
|
||||
marker.render_position_window(viewer, canvas_width, canvas_height, view_type);
|
||||
// IDEX/IQEX secondary carriage markers
|
||||
for (auto& sec : m_imex_secondary_markers)
|
||||
sec.render(canvas_width, canvas_height, view_type);
|
||||
}
|
||||
|
||||
//float bottom = wxGetApp().plater()->get_current_canvas3D()->get_canvas_size().get_height();
|
||||
// BBS
|
||||
@@ -1856,30 +1856,6 @@ void GCodeViewer::render_scene(int canvas_width, int canvas_height)
|
||||
|
||||
render_toolpaths();
|
||||
|
||||
auto current = m_viewer.get_view_visible_range();
|
||||
auto endpoints = m_viewer.get_view_full_range();
|
||||
m_sequential_view.m_show_marker = m_sequential_view.m_show_marker || (current.back() != endpoints.back() && !m_no_render_path);
|
||||
const libvgcode::PathVertex& curr_vertex = m_viewer.get_current_vertex();
|
||||
m_sequential_view.marker.set_world_position(libvgcode::convert(curr_vertex.position));
|
||||
m_sequential_view.marker.set_z_offset(m_z_offset + 0.5f);
|
||||
m_sequential_view.render_marker(!m_no_render_path, canvas_width, sequential_view_height(canvas_height), m_viewer.get_view_type());
|
||||
}
|
||||
|
||||
void GCodeViewer::render_overlay(int canvas_width, int canvas_height, int right_margin)
|
||||
{
|
||||
if (m_viewer.get_extrusion_roles().empty())
|
||||
return;
|
||||
|
||||
float legend_height = 0.0f;
|
||||
render_legend(legend_height, canvas_width, canvas_height, right_margin);
|
||||
|
||||
if (m_user_mode != wxGetApp().get_mode()) {
|
||||
update_by_mode(wxGetApp().get_mode());
|
||||
m_user_mode = wxGetApp().get_mode();
|
||||
}
|
||||
|
||||
//BBS fixed bottom_margin for space to render horiz slider
|
||||
int bottom_margin = SLIDER_BOTTOM_MARGIN * GCODE_VIEWER_SLIDER_SCALE;
|
||||
auto current = m_viewer.get_view_visible_range();
|
||||
auto endpoints = m_viewer.get_view_full_range();
|
||||
m_sequential_view.m_show_marker = m_sequential_view.m_show_marker || (current.back() != endpoints.back() && !m_no_render_path);
|
||||
@@ -1888,7 +1864,7 @@ void GCodeViewer::render_overlay(int canvas_width, int canvas_height, int right_
|
||||
m_sequential_view.marker.set_z_offset(m_z_offset + 0.5f);
|
||||
|
||||
// IDEX/IQEX: compute all carriage positions; update secondary nozzle markers;
|
||||
// carriage_box_draws is populated for toolhead footprint rendering after sequential_view.render().
|
||||
// carriage_box_draws is populated for toolhead footprint rendering after render_marker().
|
||||
// Okabe-Ito colorblind-safe palette — excludes orange (#E69F00) and sky blue (#56B4E9)
|
||||
// which are used by the bed zone fills, ensuring the markers contrast against the background.
|
||||
static const std::array<ColorRGBA, 4> s_carriage_colors = {{
|
||||
@@ -2017,9 +1993,7 @@ void GCodeViewer::render_overlay(int canvas_width, int canvas_height, int right_
|
||||
if (!imex_active)
|
||||
m_sequential_view.m_imex_secondary_markers.clear();
|
||||
}
|
||||
|
||||
// BBS fixed buttom margin. m_moves_slider.pos_y
|
||||
m_sequential_view.render_overlay(!m_no_render_path, legend_height, &m_viewer, m_viewer.get_current_vertex().gcode_id, canvas_width, sequential_view_height(canvas_height), right_margin * m_scale, m_viewer.get_view_type());
|
||||
m_sequential_view.render_marker(!m_no_render_path, canvas_width, sequential_view_height(canvas_height), m_viewer.get_view_type());
|
||||
|
||||
// IDEX/IQEX: render toolhead footprint boxes for each active carriage.
|
||||
// Each box is imex_nozzle_clearance_x × imex_nozzle_clearance_y, sitting above the nozzle tip.
|
||||
@@ -2070,6 +2044,22 @@ void GCodeViewer::render_overlay(int canvas_width, int canvas_height, int right_
|
||||
glsafe(::glDisable(GL_BLEND));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GCodeViewer::render_overlay(int canvas_width, int canvas_height, int right_margin)
|
||||
{
|
||||
if (m_viewer.get_extrusion_roles().empty())
|
||||
return;
|
||||
|
||||
float legend_height = 0.0f;
|
||||
render_legend(legend_height, canvas_width, canvas_height, right_margin);
|
||||
|
||||
if (m_user_mode != wxGetApp().get_mode()) {
|
||||
update_by_mode(wxGetApp().get_mode());
|
||||
m_user_mode = wxGetApp().get_mode();
|
||||
}
|
||||
|
||||
m_sequential_view.render_overlay(!m_no_render_path, legend_height, &m_viewer, m_viewer.get_current_vertex().gcode_id, canvas_width, sequential_view_height(canvas_height), right_margin * m_scale, m_viewer.get_view_type());
|
||||
|
||||
#if VGCODE_ENABLE_COG_AND_TOOL_MARKERS
|
||||
if (is_legend_shown()) {
|
||||
|
||||
@@ -2117,7 +2117,7 @@ void PartPlate::render_icons(bool bottom, bool only_name, int hover_id)
|
||||
} catch (const std::exception&) {
|
||||
imex_tip = (boost::format("IDEX/IQEX mode: %1% (left-click to cycle, right-click for menu)") % cur).str();
|
||||
}
|
||||
show_tooltip(imex_tip);
|
||||
set_hover_tooltip(imex_tip);
|
||||
} else {
|
||||
render_icon_texture(m_imex_mode_icon.model, m_partplate_list->m_imex_mode_texture);
|
||||
}
|
||||
@@ -2125,7 +2125,7 @@ void PartPlate::render_icons(bool bottom, bool only_name, int hover_id)
|
||||
if (has_imex_multimaterial_conflict()) {
|
||||
render_icon_texture(m_imex_warn_icon, m_partplate_list->m_imex_warn_texture);
|
||||
if (hover_id == (int)PLATE_IMEX_MODE_ID)
|
||||
show_tooltip(_u8L("Warning: this plate uses a parallel IDEX/IQEX mode with multi-material objects. Proceed with caution — verify your G-code handles this combination correctly."));
|
||||
set_hover_tooltip(_u8L("Warning: this plate uses a parallel IDEX/IQEX mode with multi-material objects. Proceed with caution — verify your G-code handles this combination correctly."));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user