Print step invalidation: Improvement of readability.

This commit is contained in:
bubnikv 2018-10-31 19:21:00 +01:00
parent 8cab0a9757
commit e6d78cc063
3 changed files with 29 additions and 28 deletions

View file

@ -99,11 +99,9 @@ bool PrintObject::set_copies(const Points &points)
// Invalidate and set copies.
bool invalidated = false;
if (copies != m_copies) {
invalidated = m_print->invalidate_step(psSkirt);
invalidated |= m_print->invalidate_step(psBrim);
invalidated = m_print->invalidate_steps({ psSkirt, psBrim, psGCodeExport });
if (copies.size() != m_copies.size())
invalidated |= m_print->invalidate_step(psWipeTower);
invalidated |= m_print->invalidate_step(psGCodeExport);
m_copies = copies;
}
return invalidated;
@ -590,21 +588,16 @@ bool PrintObject::invalidate_step(PrintObjectStep step)
// propagate to dependent steps
if (step == posPerimeters) {
invalidated |= this->invalidate_step(posPrepareInfill);
invalidated |= m_print->invalidate_step(psSkirt);
invalidated |= m_print->invalidate_step(psBrim);
invalidated |= m_print->invalidate_steps({ psSkirt, psBrim });
} else if (step == posPrepareInfill) {
invalidated |= this->invalidate_step(posInfill);
} else if (step == posInfill) {
invalidated |= m_print->invalidate_step(psSkirt);
invalidated |= m_print->invalidate_step(psBrim);
invalidated |= m_print->invalidate_steps({ psSkirt, psBrim });
} else if (step == posSlice) {
invalidated |= this->invalidate_step(posPerimeters);
invalidated |= this->invalidate_step(posSupportMaterial);
invalidated |= this->invalidate_steps({ posPerimeters, posSupportMaterial });
invalidated |= m_print->invalidate_step(psWipeTower);
} else if (step == posSupportMaterial) {
invalidated |= m_print->invalidate_step(psSkirt);
invalidated |= m_print->invalidate_step(psBrim);
}
} else if (step == posSupportMaterial)
invalidated |= m_print->invalidate_steps({ psSkirt, psBrim });
// Wipe tower depends on the ordering of extruders, which in turn depends on everything.
// It also decides about what the wipe_into_infill / wipe_into_object features will do,
@ -613,11 +606,6 @@ bool PrintObject::invalidate_step(PrintObjectStep step)
return invalidated;
}
bool PrintObject::invalidate_all_steps()
{
return m_state.invalidate_all(m_print->m_mutex, m_print->m_cancel_callback);
}
bool PrintObject::has_support_material() const
{
return m_config.support_material
@ -2254,4 +2242,15 @@ void PrintObject::adjust_layer_height_profile(coordf_t z, coordf_t layer_thickne
layer_height_profile_valid = false;
}
tbb::mutex& PrintObject::cancel_mutex()
{
return m_print->m_mutex;
}
std::function<void()> PrintObject::cancel_callback()
{
return m_print->m_cancel_callback;
}
} // namespace Slic3r