mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-14 04:25:57 +08:00
WIP: Invalidating shared support spots in Print::apply()
This commit is contained in:
parent
02b39d7282
commit
c3fec7b349
@ -609,6 +609,12 @@ private:
|
|||||||
// Return 4 wipe tower corners in the world coordinates (shifted and rotated), including the wipe tower brim.
|
// Return 4 wipe tower corners in the world coordinates (shifted and rotated), including the wipe tower brim.
|
||||||
std::vector<Point> first_layer_wipe_tower_corners() const;
|
std::vector<Point> first_layer_wipe_tower_corners() const;
|
||||||
|
|
||||||
|
// Returns true if any of the print_objects has print_object_step valid.
|
||||||
|
// That means data shared by all print objects of the print_objects span may still use the shared data.
|
||||||
|
// Otherwise the shared data shall be released.
|
||||||
|
// Unguarded variant, thus it shall only be called from main thread with background processing stopped.
|
||||||
|
static bool is_shared_print_object_step_valid_unguarded(SpanOfConstPtrs<PrintObject> print_objects, PrintObjectStep print_object_step);
|
||||||
|
|
||||||
PrintConfig m_config;
|
PrintConfig m_config;
|
||||||
PrintObjectConfig m_default_object_config;
|
PrintObjectConfig m_default_object_config;
|
||||||
PrintRegionConfig m_default_region_config;
|
PrintRegionConfig m_default_region_config;
|
||||||
|
@ -1451,6 +1451,21 @@ Print::ApplyStatus Print::apply(const Model &model, DynamicPrintConfig new_full_
|
|||||||
for (PrintObject *object : m_objects)
|
for (PrintObject *object : m_objects)
|
||||||
object->update_slicing_parameters();
|
object->update_slicing_parameters();
|
||||||
|
|
||||||
|
if (apply_status == APPLY_STATUS_INVALIDATED) {
|
||||||
|
// Invalidate data of a single ModelObject shared by multiple PrintObjects.
|
||||||
|
// Find spans of PrintObjects sharing the same PrintObjectRegions.
|
||||||
|
std::vector<PrintObject*> all_objects(m_objects);
|
||||||
|
std::sort(all_objects.begin(), all_objects.end(), [](const PrintObject *l, const PrintObject *r){ return l->shared_regions() < r->shared_regions(); } );
|
||||||
|
for (auto it = all_objects.begin(); it != all_objects.end();) {
|
||||||
|
PrintObjectRegions *shared_regions = (*it)->m_shared_regions;
|
||||||
|
auto it_begin = it;
|
||||||
|
for (++ it; it != all_objects.end() && shared_regions == (*it)->shared_regions(); ++ it);
|
||||||
|
auto this_objects = SpanOfConstPtrs<PrintObject>(const_cast<const PrintObject* const* const>(&(*it_begin)), it - it_begin);
|
||||||
|
if (Print::is_shared_print_object_step_valid_unguarded(this_objects, posSupportSpotsSearch))
|
||||||
|
shared_regions->generated_support_points.reset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
check_model_ids_equal(m_model, model);
|
check_model_ids_equal(m_model, model);
|
||||||
#endif /* _DEBUG */
|
#endif /* _DEBUG */
|
||||||
@ -1458,4 +1473,9 @@ Print::ApplyStatus Print::apply(const Model &model, DynamicPrintConfig new_full_
|
|||||||
return static_cast<ApplyStatus>(apply_status);
|
return static_cast<ApplyStatus>(apply_status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Print::is_shared_print_object_step_valid_unguarded(SpanOfConstPtrs<PrintObject> print_objects, PrintObjectStep print_object_step)
|
||||||
|
{
|
||||||
|
return std::any_of(print_objects.begin(), print_objects.end(), [print_object_step](auto po){ return po->is_step_done_unguarded(print_object_step); });
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Slic3r
|
} // namespace Slic3r
|
||||||
|
Loading…
x
Reference in New Issue
Block a user