UI: Fix the logic for switching between union/assemble and difference/intersection

The logic that is flipping the extrusions was working by chance.
This commit is contained in:
ruevs 2020-05-10 05:22:51 +03:00 committed by phkahler
parent 6245c63f2e
commit 9b07aaf262

View File

@ -212,15 +212,15 @@ void TextWindow::ScreenChangeGroupOption(int link, uint32_t v) {
// extrusion. If no constraints were added, flip it when we switch between
// union/assemble and difference/intersection modes to avoid manual work doing the same.
if(g->meshCombine != (Group::CombineAs)v && g->GetNumConstraints() == 0) {
// I apologise for his if statement
if(((Group::CombineAs::DIFFERENCE == g->meshCombine ||
Group::CombineAs::INTERSECTION == g->meshCombine) &&
(Group::CombineAs::DIFFERENCE != (Group::CombineAs)v &&
Group::CombineAs::INTERSECTION != (Group::CombineAs)v)) ||
((Group::CombineAs::DIFFERENCE != g->meshCombine &&
Group::CombineAs::INTERSECTION != g->meshCombine) &&
(Group::CombineAs::DIFFERENCE == (Group::CombineAs)v ||
Group::CombineAs::INTERSECTION == (Group::CombineAs)v))) {
// I apologise for this if statement
if((((Group::CombineAs::DIFFERENCE == g->meshCombine) ||
(Group::CombineAs::INTERSECTION == g->meshCombine)) &&
(Group::CombineAs::DIFFERENCE != (Group::CombineAs)v) &&
(Group::CombineAs::INTERSECTION != (Group::CombineAs)v)) ||
((Group::CombineAs::DIFFERENCE != g->meshCombine) &&
(Group::CombineAs::INTERSECTION != g->meshCombine) &&
((Group::CombineAs::DIFFERENCE == (Group::CombineAs)v) ||
(Group::CombineAs::INTERSECTION == (Group::CombineAs)v)))) {
g->ExtrusionForceVectorTo(g->ExtrusionGetVector().Negated());
}
}