-
-
Notifications
You must be signed in to change notification settings - Fork 482
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
Add a stack-based Boolean Operation layer node #1813
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Keavon
changed the title
Boolean operation layer node
Add a stack-based input variant of the Boolean Operation layer node
Jul 8, 2024
Keavon
changed the title
Add a stack-based input variant of the Boolean Operation layer node
Add a stack-based Boolean Operation layer node
Jul 8, 2024
adamgerhant
force-pushed
the
layer-boolean-operation
branch
from
July 9, 2024 05:45
c003bd9
to
92c81a0
Compare
Keavon
force-pushed
the
layer-boolean-operation
branch
from
July 9, 2024 11:32
92c81a0
to
750a75c
Compare
Keavon
force-pushed
the
layer-boolean-operation
branch
from
July 9, 2024 23:41
750a75c
to
2f21304
Compare
adamgerhant
force-pushed
the
layer-boolean-operation
branch
from
July 10, 2024 01:41
5497fb4
to
7bf170d
Compare
adamgerhant
force-pushed
the
layer-boolean-operation
branch
from
July 10, 2024 07:40
8e7ab30
to
68494e2
Compare
Keavon
approved these changes
Jul 10, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #1816
Adds a layer Boolean operation node which performs the Boolean operation on an entire stack of vector data. This means the layer panel can now be used to adjust the operation order.
chrome_D7jptsQ7ZW.mp4
Since operations can now be performed on more than 2 shapes, the order and merging of these operations into a single vector will have to be carefully considered.
Another consideration is that a
GraphicGroup
can contain elements other than vector data. Currently, each element can be either anotherGraphicGroup
,VectorData
,Image
, orArtboard
. ForGraphicGroup
's and Artboards, a recursive Boolean union is applied to convert them into a a single vector. Image's are treated as default rectangles based on their height, width, and position, although this will have to be reworked. Maybe a mask should be used instead of the Boolean operation?It would also be helpful to allow the user to specify a minimum and maximum number of overlaps for the resulting shape. For example a union would have a minimum of 0 overlaps and no maximum, intersect sets the minimum to the number of shapes - 1 and no maximum, and difference sets the minimum to 0 and maximum to 1. The UI for this could be a single slider bar with the number of ticks equal to the number of shapes in the stack, and 2 selectors for the minimum and maximum. This could be a new node "Intersect".
A more flexible implementation for the Boolean operation could take the following inputs: List of vector data (
GraphicGroup
), minimum overlap(RelativeOffset
), maximum overlap (RelativeOffset
), subtract index (Option<RelativeOffset>
). The relative offset will be an enum with 2 varients, FromStart(usize) and FromBack(usize). This is necessary to ensure indices can be based of either the start of end of the vector data, so that adding a new item to the stack does not require the indices to be manually updated. For example, union will store a minimum offset ofRelativeOffset::FromStart(0)
and a maximum offset ofRelativeOffset::FromEnd(0)
.Since subtracting is fundamentally different than the intersection selection, it should be a separate node. If the subtract index is Some, then it will get that index from the list of vector data and subtract it from the Union of all vector data. This Union will be created by output of the new Intersect node.
Implementation sketch: