Skip to content
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

Allow the Path tool to edit an upstream path even if there's a type conversion midway #2055

Merged
merged 1 commit into from
Oct 26, 2024

Conversation

adamgerhant
Copy link
Collaborator

I changed the upstream traversal for the tools to only iterate over the same type so that modifications to the output of a Boolean were applied to the vector data after the operation, not an upstream path node. This was a hacky solution, and we need better support for selection which path node to modify. This can be done with dots in the layer panel. More information in comment above existing_node_id

Copy link
Member

@0HyperCube 0HyperCube left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks good.

Automatically inserting the flatten elements before the path node foregrounds an issue with the ID collisions. If you have a group with two shapes with the same point ids (e.g. two rectangles) and flatten them, the ids for the second rectangle differ each time, meaning that it is not possible to drag them around.

https://github.com/GraphiteEditor/Graphite/blob/c3a3c4c907419e2ebb9a382546a1d7b66f57cdc0/node-graph/gcore/src/vector/vector_data/attributes.rs#L762C78-L763C1

@adamgerhant
Copy link
Collaborator Author

adamgerhant commented Oct 22, 2024

Yes, that is why I created the generate_from_hash, which generates stable yet unique ids based on the NodeId of the merge node that the vector data flows through. It is implemented for the flatten vector elements in #2049, here where I needed the functionality to add the joining of vector data with the pen tool (this should be split into a separate PR).

It is also currently used by the repeat and copy to point nodes so that each new vector data has stable and unique ids.

This is still a work around to allowing the path tool to operate directly on vector data. A more robust method is necessary for the path node to input and output a GraphicGroup. I suppose each vector data will need a unique ID that the path node can reference, since the merge node id will change when it is copy and pasted.

@adamgerhant adamgerhant marked this pull request as draft October 22, 2024 03:29
@adamgerhant
Copy link
Collaborator Author

@Keavon Noted a crash on this branch, but I have not been able to reproduce it

@Keavon Keavon marked this pull request as ready for review October 26, 2024 01:37
@Keavon
Copy link
Member

Keavon commented Oct 26, 2024

Well, I couldn't find the crash either, so we'll have to live with it and fix it once we can reproduce it in the wild.

@Keavon Keavon changed the title Remove type check when iterating upstream Allow the Path tool to edit an upstream path even if there's a type conversion midway Oct 26, 2024
@Keavon Keavon enabled auto-merge (squash) October 26, 2024 18:36
@Keavon Keavon merged commit ff8fec6 into master Oct 26, 2024
4 checks passed
@Keavon Keavon deleted the Path-upstream-iteration-fix branch October 26, 2024 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants