CutGizmo: Put the check of groove flaps validity to the has_valid_groove() function to avoid perform a cut with non valid groove

This commit is contained in:
YuSanka 2023-08-07 11:03:56 +02:00
parent 0c2913f20c
commit 89d66737b5

View File

@ -3427,10 +3427,8 @@ bool GLGizmoCut3D::can_perform_cut() const
if (! m_invalid_connectors_idxs.empty() || (!m_keep_upper && !m_keep_lower) || m_connectors_editing) if (! m_invalid_connectors_idxs.empty() || (!m_keep_upper && !m_keep_lower) || m_connectors_editing)
return false; return false;
if (CutMode(m_mode) == CutMode::cutTongueAndGroove) { if (CutMode(m_mode) == CutMode::cutTongueAndGroove)
const float flaps_width = -2.f * m_groove_depth / tan(m_groove_flaps_angle); return has_valid_groove();
return flaps_width < m_groove_width && has_valid_groove();
}
if (m_part_selection.valid()) if (m_part_selection.valid())
return ! m_part_selection.is_one_object(); return ! m_part_selection.is_one_object();
@ -3443,6 +3441,10 @@ bool GLGizmoCut3D::has_valid_groove() const
if (CutMode(m_mode) != CutMode::cutTongueAndGroove) if (CutMode(m_mode) != CutMode::cutTongueAndGroove)
return true; return true;
const float flaps_width = -2.f * m_groove_depth / tan(m_groove_flaps_angle);
if (flaps_width > m_groove_width)
return false;
const Selection& selection = m_parent.get_selection(); const Selection& selection = m_parent.get_selection();
const auto&list = selection.get_volume_idxs(); const auto&list = selection.get_volume_idxs();
// is more volumes selected? // is more volumes selected?