update slic3r

This commit is contained in:
QIDI TECH
2024-11-28 15:19:12 +08:00
parent a26696f35e
commit 7eb6543991
196 changed files with 18701 additions and 3803 deletions

View File

@@ -1123,6 +1123,7 @@ void GCodeViewer::load(const GCodeProcessorResult& gcode_result, const Print& pr
m_conflict_result = gcode_result.conflict_result;
if (m_conflict_result) { m_conflict_result.value().layer = m_layers.get_l_at(m_conflict_result.value()._height); }
filament_printable_reuslt = gcode_result.filament_printable_reuslt;
//QDS: add mutex for protection of gcode result
gcode_result.unlock();
//QDS: add logs
@@ -1291,13 +1292,13 @@ void GCodeViewer::render(int canvas_width, int canvas_height, int right_margin)
#endif // ENABLE_GCODE_VIEWER_STATISTICS
//QDS: always render shells in preview window
glsafe(::glEnable(GL_DEPTH_TEST));
render_shells();
m_legend_height = 0.0f;
if (m_roles.empty())
return;
glsafe(::glEnable(GL_DEPTH_TEST));
render_toolpaths();
//render_shells();
render_legend(m_legend_height, canvas_width, canvas_height, right_margin);
@@ -3167,6 +3168,7 @@ void GCodeViewer::load_shells(const Print& print, bool initialized, bool force_p
// QDS: fix the issue that object_idx is not assigned as index of Model.objects array
int object_count = 0;
const ModelObjectPtrs& model_objs = wxGetApp().model().objects;
bool enable_lod = GUI::wxGetApp().app_config->get("enable_lod") == "true";
for (const PrintObject* obj : print.objects()) {
const ModelObject* model_obj = obj->model_object();
@@ -3193,7 +3195,7 @@ void GCodeViewer::load_shells(const Print& print, bool initialized, bool force_p
instance_ids.resize(instance_index);
size_t current_volumes_count = m_shells.volumes.volumes.size();
m_shells.volumes.load_object(model_obj, object_idx, instance_ids, "object", initialized);
m_shells.volumes.load_object(model_obj, object_idx, instance_ids, "object", initialized, enable_lod);
// adjust shells' z if raft is present
const SlicingParameters& slicing_parameters = obj->slicing_parameters();
@@ -3258,6 +3260,29 @@ void GCodeViewer::load_shells(const Print& print, bool initialized, bool force_p
% m_shells.print_id % m_shells.print_modify_count % object_count %m_shells.volumes.volumes.size();
}
void GUI::GCodeViewer::set_shells_on_preview(bool is_previewing) {
if (is_previewing) {
delete_wipe_tower();
}
m_shells.previewing = is_previewing;
}
void GUI::GCodeViewer::delete_wipe_tower()
{
size_t current_volumes_count = m_shells.volumes.volumes.size();
if (current_volumes_count >= 1) {
for (size_t i = current_volumes_count - 1; i > 0; i--) {
GLVolume *v = m_shells.volumes.volumes[i];
if (v->is_wipe_tower) {
m_shells.volumes.release_volume(v);
delete v;
m_shells.volumes.volumes.erase(m_shells.volumes.volumes.begin() + i);
break;
}
}
}
}
void GCodeViewer::refresh_render_paths(bool keep_sequential_current_first, bool keep_sequential_current_last) const
{
#if ENABLE_GCODE_VIEWER_STATISTICS
@@ -4139,16 +4164,14 @@ void GCodeViewer::render_shells()
if (!v->indexed_vertex_array->has_VBOs())
v->finalize_geometry(true);
}
glsafe(::glEnable(GL_DEPTH_TEST));
// glsafe(::glDepthMask(GL_FALSE));
glsafe(::glDepthMask(GL_FALSE));
shader->start_using();
//QDS: reopen cul faces
m_shells.volumes.render(GLVolumeCollection::ERenderType::Transparent, false, wxGetApp().plater()->get_camera().get_view_matrix());
shader->stop_using();
// glsafe(::glDepthMask(GL_TRUE));
glsafe(::glDepthMask(GL_TRUE));
}
//QDS
@@ -4363,10 +4386,9 @@ void GCodeViewer::render_all_plates_stats(const std::vector<const GCodeProcessor
char buff[64];
double longest_str = 0.0;
for (auto i : model_used_filaments_g_all_plates) {
if (i > longest_str)
longest_str = i;
longest_str += i;
}
::sprintf(buff, "%.2f", longest_str);
::sprintf(buff, imperial_units ? "%.2f oz" : "%.2f g", longest_str / unit_conver);
std::vector<std::pair<std::string, std::vector<::string>>> title_columns;
if (displayed_columns & ColumnData::Model) {
@@ -4479,10 +4501,10 @@ void GCodeViewer::render_all_plates_stats(const std::vector<const GCodeProcessor
columns_offsets.push_back({buf, offsets[_u8L("Model")]});
}
if (displayed_columns & ColumnData::Support) {
std::for_each(model_used_filaments_m_all_plates.begin(), model_used_filaments_m_all_plates.end(), [&total_support_used_filament_m](double value) {
std::for_each(support_used_filaments_m_all_plates.begin(), support_used_filaments_m_all_plates.end(), [&total_support_used_filament_m](double value) {
total_support_used_filament_m += value;
});
std::for_each(model_used_filaments_g_all_plates.begin(), model_used_filaments_g_all_plates.end(), [&total_support_used_filament_g](double value) {
std::for_each(support_used_filaments_g_all_plates.begin(), support_used_filaments_g_all_plates.end(), [&total_support_used_filament_g](double value) {
total_support_used_filament_g += value;
});
::sprintf(buf, imperial_units ? "%.2f in\n%.2f oz" : "%.2f m\n%.2f g", total_support_used_filament_m, total_support_used_filament_g / unit_conver);
@@ -4532,7 +4554,7 @@ void GCodeViewer::render_all_plates_stats(const std::vector<const GCodeProcessor
for (auto it = plate_time.begin(); it != plate_time.end(); it++) {
std::vector<std::pair<std::string, float>> columns_offsets;
columns_offsets.push_back({ _u8L("Plate") + " " + std::to_string(it->first), offsets[_u8L("Filament")]});
columns_offsets.push_back({ _u8L("Plate") + " " + std::to_string(it->first + 1), offsets[_u8L("Filament")]});
columns_offsets.push_back({ short_time(get_time_dhms(it->second)), offsets[_u8L("Model")] });
append_item(false, m_tools.m_tool_colors[0], columns_offsets);
}