GraphiteEditor / Graphite

2D vector & raster editor that melds traditional layers & tools with a modern node-based, non-destructive, procedural workflow.
https://graphite.rs
Apache License 2.0
7.29k stars 385 forks source link

Always update source node in borrow tree #1758

Closed 0HyperCube closed 1 month ago

0HyperCube commented 1 month ago

Closes #1756

The issue was that the protonode id for the artboard node was the same between documents (it is the hash of the input values) but the document node id changes (it is a random number for each document). This fix ensures that the document id is always updated.

If you want to clear the borrow tree whilst switching documents you can add that as well, however this will prevent any potential caching of nodes as the user switches documents.

adamgerhant commented 1 month ago

I agree that always updating the source map with the new document node id should fix the issue of nodes with the same hash being skipped. I just tested it and it the ResolvedDocumentNodeTypes are now always correct when switch documents.

I also don't see a need to clear the borrow tree as long as the hash for nodes is based on the internal network. That way if the user switches documents, an identical node with the same hash will be skipped, but if the internal network is different then it will have a different hash and then be added.