Make the Gradient tool work with gradient node chains feeding a Fill node#4177
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces support for a new "Gradient" node alongside the legacy "Gradient Value" node, updating the gradient tool, graph operations, and style conversions to handle both. Key changes include adding helper functions to traverse and resolve upstream gradient nodes, implementing a new existing_proto_node_id_at method to walk and insert nodes at specific inputs, and updating the gradient stop, type, and spread setters to support the new node structure. Feedback focuses on preventing state corruption in existing_proto_node_id_at by resolving inputs before node insertion, expanding get_gradient_stops to support the new node type, and avoiding redundant lookups in gradient_stops_set.
There was a problem hiding this comment.
1 issue found across 6 files
Confidence score: 3/5
- There is a concrete regression risk in
editor/src/messages/portfolio/document/graph_operation/utility_types.rs:existing_proto_node_id_atskips the visibility filtering thatlocate_node_in_layer_chainapplies, which could return nodes that should be hidden from lookup behavior. - Given the medium severity (6/10) with high confidence (8/10), this is more than a cosmetic issue and may affect user-facing graph operations, so this sits in the “some risk” range rather than a safe-to-merge 4/5.
- Pay close attention to
editor/src/messages/portfolio/document/graph_operation/utility_types.rs- alignexisting_proto_node_id_atwith visibility-filtering expectations to avoid incorrect upstream node resolution.
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Partly closes #2779
This PR teaches the Gradient tool to read from and write to a "Gradient Value" node chain (optionally paired with "Transform", "Gradient Type", and "Spread Method" nodes) when it feeds a "Fill" node, not just when it feeds a layer directly.
Notes
Update
From<List<GradientStops>>for Fill to convert the attributes on the list to the corresponding properties.Supported connection patterns:
Fill::Gradientenum, existing)