-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conditional geometry should be completely removed from render tree #3452
Comments
Note that this will in theory affect children-based patterns:
will generate a cube today, and with this would be an error. |
True, I wonder how many people do that as it looks ambiguous, compared to how many do it in an intersection? You can either reference the last child instead of the second one or add an else empty() to force an empty child. Or perhaps if(false) should still add an empty group() node but that should not get converted to an empty() node because it is not the same as empty geometry. |
And since children aren't evaluated until they are referred to with |
I agree with @nophead here. In the example @jordanbrown0 provided, if you want children(1) to give you an empty(), then you need to add an else that adds the empty. Another way to look at this, is what if you want the if to actually change/determine that first child? So I think the if conditional should completely remove its subtree. I'm running in to this with a module I wrote that worked great on previous releases of OpenSCAD, but is now broken. |
So given the current structure of the code, I'm not sure having the if remove its subtree is going to be easily done, so might have to look at what @nophead mentioned. It seems reasonable to interpret a null geometry differently from an empty geometry group, but I'm not familiar what existing interpretations/assumptions come with these. From what little bit of the code that I have seen, it seems like nullptr (null geometry) is return on most error conditions. Are there cases where an empty geometry group is returned to indicate something? I think evaluation of a false 'if' expression is currently returning nullptr; so would it be safe to make that an empty group like @nophead said, and then ignore empty groups in operations (certainly the boolean ones, but probably minkowski too). |
Don't return empty group for "if" statement with failing condition and no "else" (fixes #3452).
Reported via forum post
The
if()
should take out the whole subtree, so the result is the cube, not the empty intersection between a cube and an empty object.Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
The text was updated successfully, but these errors were encountered: