mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-10-08 00:01:09 +00:00
Merge Main into Belt Printer
Merge origin/main (00429da739) into belt-printer.
Conflicts resolved:
- src/CMakeLists.txt: keep both wxInspector workarounds.
- GCodeProcessor.cpp: keep the belt compare_pos / z_for_height lines.
- PrintObjectSlice.cpp: the belt bbox-Z guard also covers main's
printable_region_ids bookkeeping.
- TreeSupport.cpp: the belt-floor check runs before main's PendingNode
queueing.
- Tab.hpp: keep the belt fields, drop the removed upload description
fields.
- tests/libslic3r/CMakeLists.txt: keep both test files.
Also included:
- eSUN PLA belt presets declare their own filament_id (OFkrxQC4) and
scripts/filament_id_snapshot.json is regenerated, as main's filament_id
check requires.
- Custom.json version bumped to 02.04.00.05 so the belt entries reach
existing installs.
- Fix the ambiguous WithinRel call in the belt apron width test, which
otherwise breaks the fff_print build.
This commit is contained in:
@@ -787,6 +787,19 @@ void GCodeViewer::SequentialView::GCodeWindow::load_gcode(const std::string& fil
|
||||
}
|
||||
}
|
||||
|
||||
// Byte offset just past the first count characters of str, or its length if it is shorter.
|
||||
static size_t utf8_offset(const std::string& str, size_t count)
|
||||
{
|
||||
const char* const begin = str.c_str();
|
||||
const char* const end = begin + str.size();
|
||||
const char* pos = begin;
|
||||
for (size_t i = 0; i < count && pos < end; ++i) {
|
||||
unsigned int codepoint = 0;
|
||||
pos += ImTextCharFromUtf8(&codepoint, pos, end);
|
||||
}
|
||||
return pos - begin;
|
||||
}
|
||||
|
||||
//BBS: GUI refactor: move to right
|
||||
void GCodeViewer::SequentialView::GCodeWindow::render(float top, float bottom, float right, uint64_t curr_line_id) const
|
||||
{
|
||||
@@ -798,23 +811,27 @@ void GCodeViewer::SequentialView::GCodeWindow::render(float top, float bottom, f
|
||||
// read line from file
|
||||
const size_t start = id == 1 ? 0 : m_lines_ends[id - 2];
|
||||
const size_t original_len = m_lines_ends[id - 1] - start;
|
||||
const size_t len = std::min(original_len, (size_t) 55);
|
||||
// A character is four bytes at most, so 55 of them always fit in 220.
|
||||
const size_t len = std::min(original_len, (size_t) 55 * 4);
|
||||
std::string gline(m_file.data() + start, len);
|
||||
|
||||
// If original line is longer than 55 characters, truncate and append "..."
|
||||
if (original_len > 55)
|
||||
gline = gline.substr(0, 52) + "...";
|
||||
// If original line is longer than 55 characters, truncate and append "...".
|
||||
// The cut must land on a character boundary or it leaves half a character behind.
|
||||
if (len < original_len || utf8_offset(gline, 55) < gline.size())
|
||||
gline = gline.substr(0, utf8_offset(gline, 52)) + "...";
|
||||
|
||||
std::string command, parameters, comment;
|
||||
// extract comment
|
||||
std::vector<std::string> tokens;
|
||||
boost::split(tokens, gline, boost::is_any_of(";"), boost::token_compress_on);
|
||||
command = tokens.front();
|
||||
if (tokens.size() > 1)
|
||||
comment = ";" + tokens.back();
|
||||
const size_t comment_start = gline.find(';');
|
||||
if (comment_start == std::string::npos)
|
||||
command = gline;
|
||||
else {
|
||||
command = gline.substr(0, comment_start);
|
||||
comment = gline.substr(comment_start);
|
||||
}
|
||||
|
||||
// extract gcode command and parameters
|
||||
if (!command.empty()) {
|
||||
std::vector<std::string> tokens;
|
||||
boost::split(tokens, command, boost::is_any_of(" "), boost::token_compress_on);
|
||||
command = tokens.front();
|
||||
if (tokens.size() > 1) {
|
||||
@@ -2796,7 +2813,7 @@ void GCodeViewer::render_all_plates_stats(const std::vector<const GCodeProcessor
|
||||
|
||||
return ret;
|
||||
};
|
||||
auto append_item = [icon_size, &imgui, imperial_units, &window_padding, &draw_list, this](const ColorRGBA& color, const std::vector<std::pair<std::string, float>>& columns_offsets)
|
||||
auto append_item = [icon_size, &imgui, &window_padding, &draw_list, this](const ColorRGBA& color, const std::vector<std::pair<std::string, float>>& columns_offsets)
|
||||
{
|
||||
// render icon
|
||||
ImVec2 pos = ImVec2(ImGui::GetCursorScreenPos().x + window_padding * 3, ImGui::GetCursorScreenPos().y);
|
||||
@@ -2831,7 +2848,7 @@ void GCodeViewer::render_all_plates_stats(const std::vector<const GCodeProcessor
|
||||
}
|
||||
ImGui::Separator();
|
||||
};
|
||||
auto get_used_filament_from_volume = [this, imperial_units, &filament_diameters, &filament_densities](double volume, int extruder_id) {
|
||||
auto get_used_filament_from_volume = [imperial_units, &filament_diameters, &filament_densities](double volume, int extruder_id) {
|
||||
double koef = imperial_units ? 1.0 / GizmoObjectManipulation::in_to_mm : 0.001;
|
||||
std::pair<double, double> ret = { koef * volume / (PI * sqr(0.5 * filament_diameters[extruder_id])),
|
||||
volume * filament_densities[extruder_id] * 0.001 };
|
||||
@@ -3416,7 +3433,7 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv
|
||||
//ImVec2(pos_rect.x + ImGui::GetWindowWidth() + ImGui::GetFrameHeight(),pos_rect.y + ImGui::GetFrameHeight() + window_padding * 2.5),
|
||||
//ImGui::GetColorU32(ImVec4(0,0,0,0.3)));
|
||||
|
||||
auto append_item = [icon_size, &imgui, imperial_units, &window_padding, &draw_list, this](
|
||||
auto append_item = [icon_size, &imgui, &window_padding, &draw_list, this](
|
||||
EItemType type,
|
||||
const ColorRGBA& color,
|
||||
const std::vector<std::pair<std::string, float>>& columns_offsets,
|
||||
@@ -3551,7 +3568,7 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv
|
||||
return ret;
|
||||
};
|
||||
|
||||
auto calculate_offsets = [&imgui, max_width, window_padding, this](const std::vector<std::pair<std::string, std::vector<::string>>>& title_columns, float extra_size = 0.0f) {
|
||||
auto calculate_offsets = [max_width, this](const std::vector<std::pair<std::string, std::vector<::string>>>& title_columns, float extra_size = 0.0f) {
|
||||
const ImGuiStyle& style = ImGui::GetStyle();
|
||||
std::vector<float> offsets;
|
||||
// ORCA increase spacing for more readable format. Using direct number requires much less code change in here. GetTextLineHeight for additional spacing for icon_size
|
||||
@@ -4039,7 +4056,7 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv
|
||||
columns_offsets.push_back({ distance_text, offsets[3] });
|
||||
if (full_layout && !count_text.empty())
|
||||
columns_offsets.push_back({ count_text, distance_text.empty() ? offsets[3] : offsets[4] });
|
||||
append_item(EItemType::Rect, color, columns_offsets, true, offsets.back()/*ORCA checkbox_pos*/, visible, [this, type, visible]() {
|
||||
append_item(EItemType::Rect, color, columns_offsets, true, offsets.back()/*ORCA checkbox_pos*/, visible, [this, type]() {
|
||||
m_viewer.toggle_option_visibility(type);
|
||||
update_moves_slider();
|
||||
});
|
||||
@@ -4096,7 +4113,7 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv
|
||||
columns_offsets.push_back({used_filaments_length[i], offsets[3]});
|
||||
columns_offsets.push_back({used_filaments_weight[i], offsets[4]});
|
||||
append_item(EItemType::Rect, libvgcode::convert(m_viewer.get_extrusion_role_color(role)), columns_offsets,
|
||||
true, offsets.back(), visible, [this, role, visible]() {
|
||||
true, offsets.back(), visible, [this, role]() {
|
||||
m_viewer.toggle_extrusion_role_visibility(role);
|
||||
update_moves_slider();
|
||||
});
|
||||
@@ -4115,7 +4132,7 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv
|
||||
columns_offsets.push_back({ travel_percent, offsets[2] });
|
||||
columns_offsets.push_back({ travel_distance, offsets[3] }); // Usage column
|
||||
columns_offsets.push_back({ travel_moves, offsets[4] }); // Usage column
|
||||
append_item(EItemType::Rect, libvgcode::convert(m_viewer.get_option_color(libvgcode::EOptionType::Travels)), columns_offsets, true, offsets.back()/*ORCA checkbox_pos*/, visible, [this, item, visible]() {
|
||||
append_item(EItemType::Rect, libvgcode::convert(m_viewer.get_option_color(libvgcode::EOptionType::Travels)), columns_offsets, true, offsets.back()/*ORCA checkbox_pos*/, visible, [this, item]() {
|
||||
m_viewer.toggle_option_visibility(item);
|
||||
update_moves_slider();
|
||||
});
|
||||
@@ -4134,7 +4151,7 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv
|
||||
append_headers({ {_u8L("Options"), offsets[0] }, { _u8L("Display"), offsets[1]} });
|
||||
const bool travel_visible = m_viewer.is_option_visible(libvgcode::EOptionType::Travels);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0.0f, 3.0f));
|
||||
append_item(EItemType::None, libvgcode::convert(m_viewer.get_option_color(libvgcode::EOptionType::Travels)), { {_u8L("Travel"), offsets[0] }}, true, predictable_icon_pos/*ORCA checkbox_pos*/, travel_visible, [this, travel_visible]() {
|
||||
append_item(EItemType::None, libvgcode::convert(m_viewer.get_option_color(libvgcode::EOptionType::Travels)), { {_u8L("Travel"), offsets[0] }}, true, predictable_icon_pos/*ORCA checkbox_pos*/, travel_visible, [this]() {
|
||||
m_viewer.toggle_option_visibility(libvgcode::EOptionType::Travels);
|
||||
// refresh(*m_gcode_result, wxGetApp().plater()->get_extruder_colors_from_plater_config(m_gcode_result));
|
||||
update_moves_slider();
|
||||
@@ -4151,7 +4168,7 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv
|
||||
append_headers({ {_u8L("Options"), offsets[0] }, { _u8L("Display"), offsets[1]} });
|
||||
const bool travel_visible = m_viewer.is_option_visible(libvgcode::EOptionType::Travels);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0.0f, 3.0f));
|
||||
append_item(EItemType::None, libvgcode::convert(m_viewer.get_option_color(libvgcode::EOptionType::Travels)), { {_u8L("Travel"), offsets[0] }}, true, predictable_icon_pos/*ORCA checkbox_pos*/, travel_visible, [this, travel_visible]() {
|
||||
append_item(EItemType::None, libvgcode::convert(m_viewer.get_option_color(libvgcode::EOptionType::Travels)), { {_u8L("Travel"), offsets[0] }}, true, predictable_icon_pos/*ORCA checkbox_pos*/, travel_visible, [this]() {
|
||||
m_viewer.toggle_option_visibility(libvgcode::EOptionType::Travels);
|
||||
// refresh(*m_gcode_result, wxGetApp().plater()->get_extruder_colors_from_plater_config(m_gcode_result));
|
||||
update_moves_slider();
|
||||
@@ -4168,7 +4185,7 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv
|
||||
append_headers({ {_u8L("Options"), offsets[0] }, { _u8L("Display"), offsets[1]} });
|
||||
const bool travel_visible = m_viewer.is_option_visible(libvgcode::EOptionType::Travels);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0.0f, 3.0f));
|
||||
append_item(EItemType::None, libvgcode::convert(m_viewer.get_option_color(libvgcode::EOptionType::Travels)), { {_u8L("Travel"), offsets[0] }}, true, predictable_icon_pos/*ORCA checkbox_pos*/, travel_visible, [this, travel_visible]() {
|
||||
append_item(EItemType::None, libvgcode::convert(m_viewer.get_option_color(libvgcode::EOptionType::Travels)), { {_u8L("Travel"), offsets[0] }}, true, predictable_icon_pos/*ORCA checkbox_pos*/, travel_visible, [this]() {
|
||||
m_viewer.toggle_option_visibility(libvgcode::EOptionType::Travels);
|
||||
update_moves_slider();
|
||||
});
|
||||
@@ -4184,7 +4201,7 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv
|
||||
append_headers({ {_u8L("Options"), offsets[0] }, { _u8L("Display"), offsets[1]} });
|
||||
const bool travel_visible = m_viewer.is_option_visible(libvgcode::EOptionType::Travels);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0.0f, 3.0f));
|
||||
append_item(EItemType::None, libvgcode::convert(m_viewer.get_option_color(libvgcode::EOptionType::Travels)), { {_u8L("Travel"), offsets[0] }}, true, predictable_icon_pos/*ORCA checkbox_pos*/, travel_visible, [this, travel_visible]() {
|
||||
append_item(EItemType::None, libvgcode::convert(m_viewer.get_option_color(libvgcode::EOptionType::Travels)), { {_u8L("Travel"), offsets[0] }}, true, predictable_icon_pos/*ORCA checkbox_pos*/, travel_visible, [this]() {
|
||||
m_viewer.toggle_option_visibility(libvgcode::EOptionType::Travels);
|
||||
update_moves_slider();
|
||||
});
|
||||
@@ -4304,7 +4321,7 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv
|
||||
}
|
||||
|
||||
float checkbox_pos = std::max(predictable_icon_pos, color_print_offsets[_u8L("Display")]); // ORCA prefer predictable_icon_pos when header not reacing end
|
||||
append_item(EItemType::Rect, libvgcode::convert(tool_colors[extruder_idx]), columns_offsets, false, checkbox_pos/*ORCA*/, true, [this, extruder_idx]() {});
|
||||
append_item(EItemType::Rect, libvgcode::convert(tool_colors[extruder_idx]), columns_offsets, false, checkbox_pos/*ORCA*/, true, []() {});
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user