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

@ -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));