mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-20 23:31:13 -06:00
merge upstream changes
Signed-off-by: SoftFever <103989404+SoftFever@users.noreply.github.com>
This commit is contained in:
parent
1bdedb1c47
commit
2492e5d39c
156 changed files with 33597 additions and 65667 deletions
|
@ -497,6 +497,9 @@ void GLGizmoAdvancedCut::on_render_input_window(float x, float y, float bottom_l
|
|||
double height = m_height;
|
||||
ImGui::PushItemWidth(caption_size);
|
||||
ImGui::AlignTextToFramePadding();
|
||||
// only allow setting height when cut plane is horizontal
|
||||
Vec3d plane_normal = get_plane_normal();
|
||||
m_imgui->disabled_begin(std::abs(plane_normal(0)) > EPSILON || std::abs(plane_normal(1)) > EPSILON);
|
||||
m_imgui->text(_L("Height") + " ");
|
||||
ImGui::SameLine(caption_size + 1 * space_size);
|
||||
ImGui::PushItemWidth(3 * unit_size + 2 * space_size);
|
||||
|
@ -513,6 +516,7 @@ void GLGizmoAdvancedCut::on_render_input_window(float x, float y, float bottom_l
|
|||
m_buffered_height = height;
|
||||
}
|
||||
ImGui::PopStyleVar(1);
|
||||
m_imgui->disabled_end();
|
||||
ImGui::Separator();
|
||||
// Part selection
|
||||
m_imgui->bbl_checkbox(_L("Keep upper part"), m_keep_upper);
|
||||
|
|
|
@ -1217,14 +1217,23 @@ void TriangleSelectorPatch::update_triangles_per_patch()
|
|||
return touching_triangles;
|
||||
};
|
||||
|
||||
auto calc_fragment_area = [this](const TrianglePatch& patch, float max_limit_area) {
|
||||
auto calc_fragment_area = [this](const TrianglePatch& patch, float max_limit_area, int stride) {
|
||||
double total_area = 0.f;
|
||||
const std::vector<int>& ti = patch.triangle_indices;
|
||||
for (int i = 0; i < ti.size() / 3; i++) {
|
||||
/*for (int i = 0; i < ti.size() / 3; i++) {
|
||||
total_area += std::abs((m_vertices[ti[i]].v - m_vertices[ti[i + 1]].v)
|
||||
.cross(m_vertices[ti[i]].v - m_vertices[ti[i + 2]].v).norm()) / 2;
|
||||
if (total_area >= max_limit_area)
|
||||
break;
|
||||
}*/
|
||||
const std::vector<float>& vertices = patch.patch_vertices;
|
||||
for (int i = 0; i < ti.size(); i+=3) {
|
||||
stl_vertex v0(vertices[ti[i] * stride], vertices[ti[i] * stride + 1], vertices[ti[i] * stride + 2]);
|
||||
stl_vertex v1(vertices[ti[i + 1] * stride], vertices[ti[i + 1] * stride + 1], vertices[ti[i + 1] * stride + 2]);
|
||||
stl_vertex v2(vertices[ti[i + 2] * stride], vertices[ti[i + 2] * stride + 1], vertices[ti[i + 2] * stride + 2]);
|
||||
total_area += std::abs((v0 - v1).cross(v0 - v2).norm()) / 2;
|
||||
if (total_area >= max_limit_area)
|
||||
break;
|
||||
}
|
||||
|
||||
return total_area;
|
||||
|
@ -1301,7 +1310,7 @@ void TriangleSelectorPatch::update_triangles_per_patch()
|
|||
visited[current_facet] = true;
|
||||
}
|
||||
|
||||
patch.area = calc_fragment_area(patch, GapAreaMax);
|
||||
patch.area = calc_fragment_area(patch, GapAreaMax, using_wireframe?6:3);
|
||||
patch.type = start_facet_state;
|
||||
m_triangle_patches.emplace_back(std::move(patch));
|
||||
}
|
||||
|
|
|
@ -333,6 +333,9 @@ bool GLGizmosManager::open_gizmo(EType type)
|
|||
if (m_gizmos[idx]->is_activable()
|
||||
&& activate_gizmo(m_current == idx ? Undefined : (EType)idx)) {
|
||||
update_data();
|
||||
#ifdef __WXOSX__
|
||||
m_parent.post_event(SimpleEvent(wxEVT_PAINT));
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue