mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-10-15 11:51:33 +00:00
Precise Seam: new full-coverage policy for Seam Blocked (#16170)
* Precise Seam: new full-coverage policy for Seam Blocked A Seam Blocked modifier that covers a whole perimeter now blocks it, like a perimeter painted red all round, instead of being skipped. It overrides painting and lower-priority modifiers, like Enforced and Neutral. A new warning names the modifier: "Seam Blocked modifier "<name>" of "<object>" covers an entire perimeter". It is shown only when a perimeter stays entirely Blocked after all weak modifiers. The full-containment warning now covers only Center, Left and Right. * Precise Seam: fix seams on perimeters blocked all round - SeamComparator::is_first_not_much_worse() compares the types first, so two Blocked candidates fall through like Neutral ones. On a perimeter blocked all round, by a whole Seam Blocked modifier or by red painting, Random put the seam on the closing vertex of every layer and Aligned stopped aligning. - The whole-perimeter Blocked warning flags only the highest whole zone, the one in effect. A lower whole zone it overwrites is no longer reported, and the candidate scan runs only when that zone is Blocked. - The warning msgids take the type name from the menu's "Seam Blocked" msgid. - PreciseSeamWarnings::set() shares the load-before-store idiom, and every weak segment records its modifier. - Tests: a whole Blocked perimeter gets the seams of an unmarked one under every seam position; overwritten whole Blocked zones are not reported. --------- Co-authored-by: Ian Bassi <ian.bassi@outlook.com>
This commit is contained in:
co-authored by
Ian Bassi
parent
008ee792f6
commit
5a427f2eb6
@@ -673,7 +673,7 @@ static void refine_at_vertex(
|
||||
}
|
||||
}
|
||||
|
||||
// Records one extraction for the warnings: the type of a modifier with a discarded fragment, and the
|
||||
// Records one extraction for the warnings: the type of a modifier with a discarded fragment, the
|
||||
// evaluated/reached flags for "had no effect" (a discarded fragment counts as reached, a contact not).
|
||||
static void record_extraction(PreciseSeamWarnings *warnings, const ModelVolume *modifier,
|
||||
const SegmentExtraction &extracted)
|
||||
@@ -685,13 +685,10 @@ static void record_extraction(PreciseSeamWarnings *warnings, const ModelVolume *
|
||||
const auto it = warnings->modifier_usage.find(modifier);
|
||||
if (it == warnings->modifier_usage.end())
|
||||
return;
|
||||
// Load before store: most calls find the flag already set, so shared cache lines stay clean.
|
||||
PreciseSeamWarnings::ModifierUsage &usage = it->second;
|
||||
if (!usage.checked.load(std::memory_order_relaxed))
|
||||
usage.checked.store(true, std::memory_order_relaxed);
|
||||
const bool reached = !extracted.segments.empty() || extracted.full_containment || extracted.discarded_fragments > 0;
|
||||
if (reached && !usage.reached.load(std::memory_order_relaxed))
|
||||
usage.reached.store(true, std::memory_order_relaxed);
|
||||
PreciseSeamWarnings::set(usage.checked);
|
||||
if (!extracted.segments.empty() || extracted.full_containment || extracted.discarded_fragments > 0)
|
||||
PreciseSeamWarnings::set(usage.reached);
|
||||
}
|
||||
|
||||
// Strong priority is per modifier, never a global maximum across different modifiers.
|
||||
@@ -953,22 +950,15 @@ std::vector<WeakModifierSegment> collect_weak_modifier_segments(
|
||||
const SegmentExtraction extracted = extract_perimeter_segments(prepared, it->second[layer_id], modifier_volume->type(), context);
|
||||
record_extraction(warnings, modifier_volume, extracted);
|
||||
const auto type = convert_weak_modifier_type(modifier_volume->type());
|
||||
// Full containment works like seam painting: Enforced and Neutral type the whole perimeter;
|
||||
// Blocked is skipped with a warning, since the seam cannot avoid the whole perimeter.
|
||||
// Full containment works like seam painting all round: the whole perimeter takes the type.
|
||||
// A perimeter left whole Blocked also gets a warning (see apply_weak_modifiers_to_perimeter()).
|
||||
if (extracted.full_containment) {
|
||||
if (type == EnforcedBlockedSeamPoint::Blocked) {
|
||||
if (warnings)
|
||||
PreciseSeamWarnings::mark(warnings->full_containment, modifier_volume->type());
|
||||
continue;
|
||||
}
|
||||
WeakModifierSegment whole{type, Point(), PerimeterPosition{0, 0.}, Point(), PerimeterPosition{0, 0.}};
|
||||
whole.whole_perimeter = true;
|
||||
result.push_back(whole);
|
||||
result.push_back({type, Point(), PerimeterPosition{0, 0.}, Point(), PerimeterPosition{0, 0.}, true, modifier_volume});
|
||||
continue;
|
||||
}
|
||||
for (const PerimeterSegment &segment : extracted.segments) {
|
||||
result.push_back({type, segment.polyline.points.front(), segment.begin,
|
||||
segment.polyline.points.back(), segment.end});
|
||||
segment.polyline.points.back(), segment.end, false, modifier_volume});
|
||||
}
|
||||
}
|
||||
// Boundary insertion, refinement and last-write-wins priority use the established path.
|
||||
@@ -979,7 +969,8 @@ void apply_weak_modifiers_to_perimeter(
|
||||
const std::vector<WeakModifierSegment> &weak_segments,
|
||||
PrintObjectSeamData::LayerSeams &result,
|
||||
const SeamPlacerImpl::Perimeter &perimeter,
|
||||
bool &some_point_enforced)
|
||||
bool &some_point_enforced,
|
||||
PreciseSeamWarnings *warnings)
|
||||
{
|
||||
// Get z-coordinate for unscaling boundary points
|
||||
const float z_coord = result.points[perimeter.start_index].position.z();
|
||||
@@ -1029,6 +1020,19 @@ void apply_weak_modifiers_to_perimeter(
|
||||
some_point_enforced = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Only the highest whole zone is in effect, and a higher band may still unblock part of it.
|
||||
if (warnings == nullptr)
|
||||
return;
|
||||
const auto last_whole = std::find_if(weak_segments.rbegin(), weak_segments.rend(),
|
||||
[](const WeakModifierSegment &segment) { return segment.whole_perimeter; });
|
||||
if (last_whole == weak_segments.rend() || last_whole->type != EnforcedBlockedSeamPoint::Blocked)
|
||||
return;
|
||||
for (size_t i = perimeter.start_index; i < perimeter.end_index; ++i)
|
||||
if (result.points[i].type != EnforcedBlockedSeamPoint::Blocked)
|
||||
return;
|
||||
if (const auto usage = warnings->modifier_usage.find(last_whole->modifier); usage != warnings->modifier_usage.end())
|
||||
PreciseSeamWarnings::set(usage->second.fully_blocked);
|
||||
}
|
||||
|
||||
// Restore precise seam positions that may have been modified
|
||||
|
||||
Reference in New Issue
Block a user