mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-08 07:27:41 -06:00
FIX: withdraw support enforcers on vertical faces
JIRA: studio-2274 Now support enforcer on vertical faces function is invalid. Previous enhancement of support enforcer on vertical faces brounght more conficts than benefits. Change-Id: Icbb0df3995d8ac8b3c22dda1bd4615da78af963b (cherry picked from commit bca003cbc35791838484afe4032276be8fa91db0)
This commit is contained in:
parent
0a730e9c2e
commit
1d92895456
3 changed files with 7 additions and 29 deletions
|
@ -2841,10 +2841,6 @@ static void project_triangles_to_slabs(ConstLayerPtrsAdaptor layers, const index
|
|||
void PrintObject::project_and_append_custom_facets(
|
||||
bool seam, EnforcerBlockerType type, std::vector<Polygons>& out) const
|
||||
{
|
||||
// BBS: Approve adding enforcer support on vertical faces
|
||||
SlabSlicingConfig config;
|
||||
config.isVertical = type == EnforcerBlockerType::ENFORCER ? true : false;
|
||||
|
||||
for (const ModelVolume* mv : this->model_object()->volumes)
|
||||
if (mv->is_model_part()) {
|
||||
const indexed_triangle_set custom_facets = seam
|
||||
|
@ -2858,7 +2854,7 @@ void PrintObject::project_and_append_custom_facets(
|
|||
else {
|
||||
std::vector<Polygons> projected;
|
||||
// Support blockers or enforcers. Project downward facing painted areas upwards to their respective slicing plane.
|
||||
slice_mesh_slabs(custom_facets, zs_from_layers(this->layers()), this->trafo_centered() * mv->get_matrix(), nullptr, &projected, [](){}, config);
|
||||
slice_mesh_slabs(custom_facets, zs_from_layers(this->layers()), this->trafo_centered() * mv->get_matrix(), nullptr, &projected, [](){});
|
||||
// Merge these projections with the output, layer by layer.
|
||||
assert(! projected.empty());
|
||||
assert(out.empty() || out.size() == projected.size());
|
||||
|
|
|
@ -753,9 +753,7 @@ inline std::pair<SlabLines, SlabLines> slice_slabs_make_lines(
|
|||
const std::vector<float> &zs,
|
||||
bool top,
|
||||
bool bottom,
|
||||
const ThrowOnCancel throw_on_cancel_fn,
|
||||
// BBS: solve conflicts (see declaration) and most elegant way I can get
|
||||
SlabSlicingConfig config)
|
||||
const ThrowOnCancel throw_on_cancel_fn)
|
||||
{
|
||||
std::pair<SlabLines, SlabLines> out;
|
||||
SlabLines &lines_top = out.first;
|
||||
|
@ -774,7 +772,7 @@ inline std::pair<SlabLines, SlabLines> slice_slabs_make_lines(
|
|||
|
||||
tbb::parallel_for(
|
||||
tbb::blocked_range<int>(0, int(indices.size())),
|
||||
[&vertices, &indices, &face_neighbors, &face_edge_ids, num_edges, &face_orientation, &zs, top, bottom, &lines_top, &lines_bottom, &lines_mutex_top, &lines_mutex_bottom, throw_on_cancel_fn, &config]
|
||||
[&vertices, &indices, &face_neighbors, &face_edge_ids, num_edges, &face_orientation, &zs, top, bottom, &lines_top, &lines_bottom, &lines_mutex_top, &lines_mutex_bottom, throw_on_cancel_fn]
|
||||
(const tbb::blocked_range<int> &range) {
|
||||
for (int face_idx = range.begin(); face_idx < range.end(); ++ face_idx) {
|
||||
if ((face_idx & 0x0ffff) == 0)
|
||||
|
@ -793,7 +791,7 @@ inline std::pair<SlabLines, SlabLines> slice_slabs_make_lines(
|
|||
slice_facet_with_slabs<true>(vertices, indices, face_idx, neighbors, edge_ids, num_edges, zs, lines_top, lines_mutex_top);
|
||||
}
|
||||
// BBS: add vertical faces option
|
||||
if (bottom && (fo == FaceOrientation::Down || (config.isVertical && fo == FaceOrientation::Vertical) || fo == FaceOrientation::Degenerate)) {
|
||||
if (bottom && (fo == FaceOrientation::Down || fo == FaceOrientation::Degenerate)) {
|
||||
Vec3i neighbors = face_neighbors[face_idx];
|
||||
// Reset neighborship of this triangle in case the other triangle is oriented backwards from this one.
|
||||
for (int i = 0; i < 3; ++ i)
|
||||
|
@ -1898,8 +1896,7 @@ void slice_mesh_slabs(
|
|||
const Transform3d &trafo,
|
||||
std::vector<Polygons> *out_top,
|
||||
std::vector<Polygons> *out_bottom,
|
||||
std::function<void()> throw_on_cancel,
|
||||
SlabSlicingConfig config)
|
||||
std::function<void()> throw_on_cancel)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(debug) << "slice_mesh_slabs to polygons";
|
||||
|
||||
|
@ -1978,7 +1975,7 @@ void slice_mesh_slabs(
|
|||
std::vector<Vec3i> face_edge_ids = its_face_edge_ids(mesh, face_neighbors, true, &num_edges);
|
||||
std::pair<SlabLines, SlabLines> lines = slice_slabs_make_lines(
|
||||
vertices_transformed, mesh.indices, face_neighbors, face_edge_ids, num_edges, face_orientation, zs,
|
||||
out_top != nullptr, out_bottom != nullptr, throw_on_cancel, config);
|
||||
out_top != nullptr, out_bottom != nullptr, throw_on_cancel);
|
||||
|
||||
throw_on_cancel();
|
||||
|
||||
|
|
|
@ -46,19 +46,6 @@ struct MeshSlicingParamsEx : public MeshSlicingParams
|
|||
double resolution { 0 };
|
||||
};
|
||||
|
||||
// BBS: MusangKing - NEW: add paint-on support on vertical-faces
|
||||
// this SlabSlicingConfig aiming to distinguish if slice_slabs_make_lines() outputs lines by slab_slicing on vertical faces
|
||||
// e.g., for support enforcer operation: isVertical = true; for other color painting operations: isVertical = false (default).
|
||||
// solve conflicts STUDIO-1183/970/1285
|
||||
struct SlabSlicingConfig
|
||||
{
|
||||
SlabSlicingConfig()
|
||||
: isVertical(false)
|
||||
{}
|
||||
|
||||
bool isVertical;
|
||||
};
|
||||
|
||||
// All the following slicing functions shall produce consistent results with the same mesh, same transformation matrix and slicing parameters.
|
||||
// Namely, slice_mesh_slabs() shall produce consistent results with slice_mesh() and slice_mesh_ex() in the sense, that projections made by
|
||||
// slice_mesh_slabs() shall fall onto slicing planes produced by slice_mesh().
|
||||
|
@ -120,9 +107,7 @@ void slice_mesh_slabs(
|
|||
const Transform3d &trafo,
|
||||
std::vector<Polygons> *out_top,
|
||||
std::vector<Polygons> *out_bottom,
|
||||
std::function<void()> throw_on_cancel,
|
||||
// BBS: MusangKing
|
||||
SlabSlicingConfig config = SlabSlicingConfig());
|
||||
std::function<void()> throw_on_cancel);
|
||||
|
||||
// Project mesh upwards pointing surfaces / downwards pointing surfaces into 2D polygons.
|
||||
void project_mesh(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue