Graphite icon indicating copy to clipboard operation
Graphite copied to clipboard

Make all nodes stackable and generalize Layers as stacked Merge nodes

Open Keavon opened this issue 6 months ago • 1 comments

Currently, the Layer node performs a compositing operation with the bottom and left data. But we also want other adjustment-style nodes (with a single primary input and output of the same type, like blur, HSV, grayscale, Imaginate, etc.) to support being layers also.

To make this change, we need to tweak the current definition of a layer. The current functionality of the Layer node should become the Composite node, which is a standard-looking node. Then all nodes should be given a boolean flag as metadata indicating whether that node should be drawn as a layer. If drawn as a layer, its left-to-right primary input/output becomes bottom-to-top primary input/output. Other exposed input parameters are drawn on the left (for now it's ok to just support one input until I work out the styling for multiple). We can add a "Convert to Layer"/"Convert to Node" toggle up near where we have the "Make Hidden" and "Preview" buttons.

Here's an example from the mockup of what a standard Composite layer (which is today's functionality of layers) and a Hue/Saturation adjustment node look like when they are both acting as layers:

image

The image icon indicates it's a Composite node which has the features of what layers already do today. Thus these will be the most common form of nodes. But making this generalization will allow other nodes, like Hue/Saturation as shown in the mockup above, to stacked vertically in the graph. This is especially important for Imaginate's img2img feature now that the rasterize-the-layers-below approach is gone as part of the unified document graph refactor.

Q&A:

  • What about nodes with more than one parameter (secondary) input? -> Eventually the styling may be adjusted as needed to support multiple. For now we can just assume zero or one.
  • What about nodes with returned (secondary) outputs? -> The design might or might not accommodate them, but for now we just don't show those outputs so there is no way to connect them. If a node is converted from a node into a layer, we disconnect those.

Keavon avatar Dec 13 '23 04:12 Keavon