Skip to content

Make the Gradient tool work with gradient node chains feeding a Fill node#4177

Merged
Keavon merged 7 commits into
GraphiteEditor:masterfrom
YohYamasaki:gradient-node
Jun 6, 2026
Merged

Make the Gradient tool work with gradient node chains feeding a Fill node#4177
Keavon merged 7 commits into
GraphiteEditor:masterfrom
YohYamasaki:gradient-node

Conversation

@YohYamasaki
Copy link
Copy Markdown
Contributor

@YohYamasaki YohYamasaki commented May 27, 2026

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:

    • "Gradient Value" node → "Fill" node
    • "Fill" node (uses Fill::Gradient enum, existing)
    • "Gradient Value" node → Layer (existing)

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread editor/src/messages/portfolio/document/graph_operation/utility_types.rs Outdated
@YohYamasaki YohYamasaki marked this pull request as ready for review June 5, 2026 02:54
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_at skips the visibility filtering that locate_node_in_layer_chain applies, 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 - align existing_proto_node_id_at with visibility-filtering expectations to avoid incorrect upstream node resolution.

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

@Keavon Keavon changed the title Add new "Gradient" node Make the Gradient tool work with gradient node chains feeding a Fill node Jun 6, 2026
@Keavon Keavon enabled auto-merge June 6, 2026 03:21
@Keavon Keavon added this pull request to the merge queue Jun 6, 2026
Merged via the queue into GraphiteEditor:master with commit a3b62da Jun 6, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Paints as graphics

2 participants