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

Store Metadata as data flows through the graph #2054

Open
Tracked by #1832
adamgerhant opened this issue Oct 19, 2024 · 1 comment
Open
Tracked by #1832

Store Metadata as data flows through the graph #2054

adamgerhant opened this issue Oct 19, 2024 · 1 comment
Assignees
Labels
Architecture Involves architecture or engineering work or discussion Graphene Involves the node graph system/engine used by Graphite

Comments

@adamgerhant
Copy link
Collaborator

adamgerhant commented Oct 19, 2024

The downstream transform to the document for layers (and other nodes) will have to be returned from the render output due to caching not working with monitor nodes (#1946). Monitor nodes cannot be used to get the downstream transforms, since a downstream transform node will not update an upstream cached monitor node. Currently this logic is done when rendering, but this will skip data upstream from destructive operations. This means the best solution is to store a recursive metadata structure for each row in a spread sheet that stores its downstream transforms, and the downstream transforms of all upstream nodes. This means all spreadsheets will need to contain a column for metadata, which will also need to include all upstream metadata (downstream transform to document).

The Path node and Merge node should add their NodeId and an identity matrix to the spreadsheet, and the transform node will continuously modify this transform as it flows through the graph. This means the Footprint is no longer used to calculate the downstream transforms

Monitor nodes can be used to access upstream data though, for example the vector data of a Path node, clip status for the artboard node, etc. This is somewhat blocked by (#2044), but an easy work around could be to insert them in the definition for now.

Transforms on vector data will be stored in a column of type Vec<(NodeId, DAffine)>. Each transform node right (left?) multiplies the last matrix in the vec, and each path node adds a new element to the vec. It is essentially the responsibility of the data type and nodes to provide the vector modify functionality for manipulating the various path nodes. The data cannot be returned from monitor nodes due to caching, as a downstream transform could change without the monitor node being updated. The two solutions to this could be to start execution from the path node, or return the data with the render output. Returning data from the render output means that the path node would store the its vector data in a column of type Vec<(NodeId, VectorData)>

When displaying the overlay for vector data in path_overlays, the click targets from the first path node are used, but the transform is derived from the layer. The transform should be used as it flows through the monitor node in the path node, not the layer.

For example, create a vector with a path, then repeat it. The graphic group has an identity transform, while the vector data stores the full transform. This means the vector

The best solution is to not return the transform to viewport from the render output as is currently done. Instead, monitor nodes are used to return the transform to document space (downstream transforms * data transform). The downstream transforms are tracked by separating the document to viewport and downstream transforms in the footprint. Then the editor will use the document to viewport transform to calculate the full transform from that monitor node to viewport space (monitor transform * document to viewport). This solves the caching issue since the monitor nodes will only need to return their data when the data changes, not when the document to viewport in the footprint changes.

In general, no metadata should be returned from the render output due to its destructive nature.

@adamgerhant adamgerhant added Architecture Involves architecture or engineering work or discussion Graphene Involves the node graph system/engine used by Graphite labels Oct 19, 2024
@adamgerhant adamgerhant self-assigned this Oct 19, 2024
@github-project-automation github-project-automation bot moved this to Short-Term in Task Board Oct 19, 2024
@adamgerhant adamgerhant changed the title Migrate downstream transforms to Monitor nodes instead of render output Store Metadata as data flows through the graph Oct 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Architecture Involves architecture or engineering work or discussion Graphene Involves the node graph system/engine used by Graphite
Projects
Status: Short-Term
Development

No branches or pull requests

2 participants
@adamgerhant and others