Merge branch 'main' into enh-port-edit-gcode-dlg

This commit is contained in:
SoftFever 2024-01-15 22:35:36 +08:00 committed by GitHub
commit 95adb899a4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
54 changed files with 6290 additions and 6063 deletions

View file

@ -76,6 +76,16 @@ Generator::Generator(const PrintObject &print_object, const std::function<void()
const double layer_thickness = scaled<double>(object_config.layer_height.value);
m_infill_extrusion_width = scaled<float>(region_config.sparse_infill_line_width.get_abs_value(max_nozzle_diameter));
// Orca: fix lightning infill divide by zero when infill line width is set to 0.
// firstly attempt to set it to the default line width. If that is not provided either, set it to a sane default
// based on the nozzle diameter.
if (m_infill_extrusion_width < EPSILON)
m_infill_extrusion_width = scaled<float>(
object_config.line_width.get_abs_value(max_nozzle_diameter) < EPSILON ?
default_infill_extrusion_width :
object_config.line_width.get_abs_value(max_nozzle_diameter)
);
m_supporting_radius = coord_t(m_infill_extrusion_width) * 100 / region_config.sparse_infill_density;
const double lightning_infill_overhang_angle = M_PI / 4; // 45 degrees
@ -102,6 +112,15 @@ Generator::Generator(PrintObject* m_object, std::vector<Polygons>& contours, std
const double layer_thickness = scaled<double>(object_config.layer_height.value);
m_infill_extrusion_width = scaled<float>(region_config.sparse_infill_line_width.get_abs_value(max_nozzle_diameter));
// Orca: fix lightning infill divide by zero when infill line width is set to 0.
// firstly attempt to set it to the default line width. If that is not provided either, set it to a sane default
// based on the nozzle diameter.
if (m_infill_extrusion_width < EPSILON)
m_infill_extrusion_width = scaled<float>(
object_config.line_width.get_abs_value(max_nozzle_diameter) < EPSILON ?
default_infill_extrusion_width :
object_config.line_width.get_abs_value(max_nozzle_diameter)
);
//m_supporting_radius: against to the density of lightning, failures may happen if set to high density
//higher density lightning makes support harder, more time-consuming on computing and printing, but more reliable on supporting overhangs
//lower density lightning performs opposite

View file

@ -126,7 +126,9 @@ std::string SpiralVase::process_layer(const std::string &gcode, bool last_layer)
m_reader.parse_buffer(gcode, [&new_gcode, &z, total_layer_length, layer_height, transition_in, &len, &current_layer, &previous_layer, &transition_gcode, transition_out, smooth_spiral, &max_xy_dist_for_smoothing, &last_point]
(GCodeReader &reader, GCodeReader::GCodeLine line) {
if (line.cmd_is("G1")) {
if (line.has_z()) {
// Orca: Filter out retractions at layer change
if (line.retracting(reader) || (line.extruding(reader) && line.dist_XY(reader) < EPSILON)) return;
if (line.has_z() && !line.retracting(reader)) {
// If this is the initial Z move of the layer, replace it with a
// (redundant) move to the last Z of previous layer.
line.set(reader, Z, z);

View file

@ -160,9 +160,9 @@ std::unique_ptr<CompressedImageBuffer> compress_thumbnail_colpic(const Thumbnail
b = int(pixels[pix_idx + 2]) >> 3;
a = int(pixels[pix_idx + 3]);
if (a == 0) {
r = 239 >> 3;
g = 243 >> 2;
b = 247 >> 3;
r = 46 >> 3;
g = 51 >> 2;
b = 72 >> 3;
}
rgb = (r << 11) | (g << 5) | b;
color16_buf[time--] = rgb;
@ -529,4 +529,4 @@ int ColPic_EncodeStr(unsigned short* fromcolor16, int picw, int pich, unsigned c
return qty;
}
} // namespace Slic3r::GCodeThumbnails
} // namespace Slic3r::GCodeThumbnails

View file

@ -1258,11 +1258,11 @@ bool MachineObject::is_axis_at_home(std::string axis)
return true;
if (axis == "X") {
return home_flag & 1 == 1;
return (home_flag & 1) == 1;
} else if (axis == "Y") {
return home_flag >> 1 & 1 == 1;
return (home_flag >> 1 & 1) == 1;
} else if (axis == "Z") {
return home_flag >> 2 & 1 == 1;
return (home_flag >> 2 & 1) == 1;
} else {
return true;
}

View file

@ -6422,7 +6422,17 @@ void GLCanvas3D::_resize(unsigned int w, unsigned int h)
m_last_w = w;
m_last_h = h;
const float font_size = 1.5f * wxGetApp().em_unit();
float font_size = wxGetApp().em_unit();
#ifdef _WIN32
// On Windows, if manually scaled here, rendering issues can occur when the system's Display
// scaling is greater than 300% as the font's size gets to be to large. So, use imgui font
// scaling instead (see: ImGuiWrapper::init_font() and issue #3401)
font_size *= (font_size > 30.0f) ? 1.0f : 1.5f;
#else
font_size *= 1.5f;
#endif
#if ENABLE_RETINA_GL
imgui->set_scaling(font_size, 1.0f, m_retina_helper->get_scale_factor());
#else

View file

@ -1298,7 +1298,7 @@ void TriangleSelectorPatch::update_triangles_per_type()
patch.triangle_indices.reserve(m_triangles.size() / 3);
}
bool using_wireframe = (wxGetApp().plater()->is_wireframe_enabled() && wxGetApp().plater()->is_show_wireframe()) ? true : false;
bool using_wireframe = (m_need_wireframe && wxGetApp().plater()->is_wireframe_enabled() && wxGetApp().plater()->is_show_wireframe()) ? true : false;
for (auto& triangle : m_triangles) {
if (!triangle.valid() || triangle.is_split())
@ -1356,7 +1356,7 @@ void TriangleSelectorPatch::update_triangles_per_patch()
auto [neighbors, neighbors_propagated] = this->precompute_all_neighbors();
std::vector<bool> visited(m_triangles.size(), false);
bool using_wireframe = (wxGetApp().plater()->is_wireframe_enabled() && wxGetApp().plater()->is_show_wireframe()) ? true : false;
bool using_wireframe = (m_need_wireframe && wxGetApp().plater()->is_wireframe_enabled() && wxGetApp().plater()->is_show_wireframe()) ? true : false;
auto get_all_touching_triangles = [this](int facet_idx, const Vec3i& neighbors, const Vec3i& neighbors_propagated) -> std::vector<int> {
assert(facet_idx != -1 && facet_idx < int(m_triangles.size()));
@ -1537,7 +1537,8 @@ void TriangleSelectorPatch::render(int triangle_indices_idx, bool show_wireframe
glsafe(::glEnableVertexAttribArray((GLint)position_id));
}
GLint barycentric_id = -1;
if (show_wireframe) {
// Orca: This is required even if wireframe is not displayed, otherwise on AMD Vega GPUs the painter gizmo won't render properly
/*if (show_wireframe)*/ {
barycentric_id = shader->get_attrib_location("v_barycentric");
if (barycentric_id != -1) {
glsafe(::glVertexAttribPointer((GLint) barycentric_id, 3, GL_FLOAT, GL_FALSE, 6 * sizeof(float), (const void *) (3 * sizeof(float))));

View file

@ -2663,6 +2663,15 @@ void ImGuiWrapper::init_font(bool compress)
if (bold_font == nullptr) { throw Slic3r::RuntimeError("ImGui: Could not load deafult font"); }
}
#ifdef _WIN32
// Render the text a bit larger (see GLCanvas3D::_resize() and issue #3401), but only if the scale factor
// for the Display is greater than 300%.
if (wxGetApp().em_unit() > 30) {
default_font->Scale = 1.5f;
bold_font->Scale = 1.5f;
}
#endif
#ifdef __APPLE__
ImFontConfig config;
config.MergeMode = true;

View file

@ -444,14 +444,14 @@ void MonitorPanel::show_status(int status)
{
if (!m_initialized) return;
if (last_status == status)return;
if (last_status & (int)MonitorStatus::MONITOR_CONNECTING != 0) {
if ((last_status & (int)MonitorStatus::MONITOR_CONNECTING) != 0) {
NetworkAgent* agent = wxGetApp().getAgent();
json j;
j["dev_id"] = obj ? obj->dev_id : "obj_nullptr";
if (status & (int)MonitorStatus::MONITOR_DISCONNECTED != 0) {
if ((status & (int)MonitorStatus::MONITOR_DISCONNECTED) != 0) {
j["result"] = "failed";
}
else if (status & (int)MonitorStatus::MONITOR_NORMAL != 0) {
else if ((status & (int)MonitorStatus::MONITOR_NORMAL) != 0) {
j["result"] = "success";
}
}

View file

@ -6264,7 +6264,7 @@ void Plater::priv::on_slicing_update(SlicingStatusEvent &evt)
for (auto const& warning : state.warnings) {
if (warning.current) {
NotificationManager::NotificationLevel notif_level = NotificationManager::NotificationLevel::WarningNotificationLevel;
if (evt.status.message_type == PrintStateBase::SlicingNotificationType::SlicingReplaceInitEmptyLayers | PrintStateBase::SlicingNotificationType::SlicingEmptyGcodeLayers) {
if (evt.status.message_type == PrintStateBase::SlicingNotificationType::SlicingReplaceInitEmptyLayers || evt.status.message_type == PrintStateBase::SlicingNotificationType::SlicingEmptyGcodeLayers) {
notif_level = NotificationManager::NotificationLevel::SeriousWarningNotificationLevel;
}
notification_manager->push_slicing_warning_notification(warning.message, false, model_object, object_id, warning_step, warning.message_id, notif_level);

View file

@ -71,7 +71,7 @@ void StateHandler::update_binds()
void StateHandler::set_state(int state, int mask)
{
if (states_ & mask == state & mask) return;
if ((states_ & mask) == (state & mask)) return;
int old = states_;
states_ = states_ & ~mask | state & mask;
if (old != states_ && (old | states2_) != (states_ | states2_)) {

View file

@ -254,7 +254,7 @@ Temp_Calibration_Dlg::Temp_Calibration_Dlg(wxWindow* parent, wxWindowID id, Plat
// Settings
//
wxString start_temp_str = _L("Start temp: ");
wxString end_temp_str = _L("End end: ");
wxString end_temp_str = _L("End temp: ");
wxString temp_step_str = _L("Temp step: ");
auto text_size = wxWindow::GetTextExtent(start_temp_str);
text_size.IncTo(wxWindow::GetTextExtent(end_temp_str));