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

Path tool creates unexpected Flatten Vector Elements node #2231

Open
kojq opened this issue Jan 27, 2025 · 1 comment
Open

Path tool creates unexpected Flatten Vector Elements node #2231

kojq opened this issue Jan 27, 2025 · 1 comment
Labels
Good First Issue Good for newcomers

Comments

@kojq
Copy link

kojq commented Jan 27, 2025

This issue results in an error in the node graph, causing the document to not be rendered.

The Flatten Vector Elements node is created in utility_types.rs: https://github.com/GraphiteEditor/Graphite/pull/2228/files#diff-f9c3a49009b09a2d6bd1ebb8b090622e4a0e9c19f760f501d006bdb09e42759dR299

This was initially caused by creating a single file and using the path tool on an ellipse (I had two on the canvas), but it was difficult to reproduce.

To consistently reproduce, open these three files (error_1-and-3.graphite.txt and error_2.graphite.txt are the two files needed) in succession on a clean Graphite instance, using File > Open..., in the given order:

error_1-and-3.graphite.txt, error_2.graphite.txt, and finally error_1-and-3.graphite.txt.

Then, in the last file (the one currently open), use the path tool to drag a point of the black ellipse (the other layers/shapes are extraneous data relative to the error).

#2214 is a great example of the kind of situation we're looking to get bug reports for

Discord discussion: https://discord.com/channels/731730685944922173/860830913390575646/1333447293021720706

@0HyperCube
Copy link
Member

The error_2 document is unnecessary. Simply loading the first document twice will trigger the error.

This occurs because the type is not properly updated (so the editor falls back to a random default implementation):
Concrete<Instances<GraphicGroup>> from DocumentNodeDefault tooltip

The path tool looks at this incorrect type and decides to insert the flatten node.

The reason for the bad type information is that the two documents have the same node ids. The executor will only send types for new node ids or ones with updated types as ResolvedDocumentNodeTypesDelta.

However since the types are stored per document, the new document never ends up getting the resolved types.

To fix, you can either store the types globally, or reset the cache in the executor when switching documents.

@0HyperCube 0HyperCube added the Good First Issue Good for newcomers label Jan 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Good First Issue Good for newcomers
Projects
Status: Short-Term
Development

No branches or pull requests

2 participants