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

Add artboard displayed names in the viewport #1795

Closed ysrtyfn closed 1 week ago

ysrtyfn commented 1 week ago

Added Label property to Artboard struct. Updated related artboard creation methods. Updated input indexes of Artboard node. Updated indexes used in resize_artboard method. Updated flatten_with_fns method to use node's alias as an input value for Artboard label.

Keavon commented 1 week ago

Follows on from https://github.com/GraphiteEditor/Graphite/pull/1788 which got closed.

ysrtyfn commented 1 week ago

Adam's review from previous (deleted) PR: If the NodeInput for the String is exposed and connected to another node with NodeInput::Node, this will disconnect it when the name is changed in the layer panel. It doesn't really make sense to expose the name as an Input, since the only way it should be modified is through modifying the DocumentNode alias property.

I think it is best to remove the NodeInput entirely, and automatically add a NodeInput::Value with the TaggedValue::String based on the DocumentNode alias. This can be done in the flatten_with_fns step of the compilation process, where the input could be added when the NodeNetwork is compiled into an executable ProtoNetwork. This will allow the input to be fully hidden, similar to how footprints are automatically added. (This is quite advanced, but also a great way to learn about the compilation process. I can help more if I have time)

I outlined a bit of the process here, and the linked discord threads have more information https://github.com/GraphiteEditor/Graphite/issues/1762. Id recommend tracing over the entire compilation process, which starts here to get a basic understanding.