Skip to content

Refactor Fill/Stroke to use graphic-list values in attributes#4257

Open
YohYamasaki wants to merge 17 commits into
GraphiteEditor:masterfrom
YohYamasaki:use-graphic-list-in-fill-stroke-nodes
Open

Refactor Fill/Stroke to use graphic-list values in attributes#4257
YohYamasaki wants to merge 17 commits into
GraphiteEditor:masterfrom
YohYamasaki:use-graphic-list-in-fill-stroke-nodes

Conversation

@YohYamasaki

@YohYamasaki YohYamasaki commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Part of #2779

This PR refactors fill and stroke for Vector to use graphic-list values in attributes instead of the legacy Fill enum and Stroke.color throughout the graph flow.

fill-stroke-with-graphic-list.mp4

Notes

  • Store fill and stroke paint as List<Graphic> attributes.
  • Keep stroke shape settings on Stroke struct, but move the paint itself to the stroke attribute.
  • Other nodes that read or write fills and strokes now use the values from the corresponding attributes.

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

Copy link
Copy Markdown
Contributor

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 refactors the Fill and Stroke nodes to use a modern value-model, introducing the type-erased AnyGraphicListDyn to accept various renderable list types without monomorphization. It updates properties UI, document migration logic, and tests to align with these changes. Feedback on the changes highlights an issue where setting a gradient fill on a previously node-connected input fails to utilize the new value-model because get_fill_node_id_with_value returns None. To resolve this, it is suggested to explicitly set the FillInput to a literal Gradient value at the start of the Fill::Gradient match arm to disconnect any upstream node.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@YohYamasaki YohYamasaki force-pushed the use-graphic-list-in-fill-stroke-nodes branch 3 times, most recently from 235f417 to 93582a3 Compare June 22, 2026 01:00
@YohYamasaki YohYamasaki changed the title Use any graphic List<T> in 'Fill' and 'stroke' nodes Move Fill/Stroke paint flow to graphic-list values Jun 22, 2026
@YohYamasaki YohYamasaki force-pushed the use-graphic-list-in-fill-stroke-nodes branch from a6c43a5 to 1eba280 Compare June 23, 2026 04:44
@YohYamasaki YohYamasaki changed the title Move Fill/Stroke paint flow to graphic-list values Refactor Fill/Stroke to use graphic-list values Jun 23, 2026
@YohYamasaki YohYamasaki changed the title Refactor Fill/Stroke to use graphic-list values Refactor Fill/Stroke to use graphic-list values in attributes Jun 23, 2026
@YohYamasaki YohYamasaki marked this pull request as ready for review June 23, 2026 07:12

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

6 issues found across 30 files

Confidence score: 2/5

  • In node-graph/interpreted-executor/src/node_registry.rs, AnyGraphicListDyn is registered for MonitorNode but not MemoizeNode, which can cause runtime constructor lookup failures when memoization is needed and break graph execution paths—add the missing MemoizeNode registration and a targeted runtime lookup test before merging.
  • In editor/src/messages/portfolio/document/graph_operation/utility_types.rs, using set_input when creating a missing gradient value node can overwrite an existing upstream link instead of splicing into it, potentially disconnecting gradient transform/type/spread nodes and corrupting document graphs—switch to splice-style insertion and cover this with a graph rewiring test.
  • In node-graph/libraries/vector-types/src/gradient.rs, initial_gradient_transform_for_bbox ignores bbox vertical position/height, so gradients can render with incorrect placement and scale for many shapes—include Y/height in the transform calculation and verify with bbox-based rendering/unit tests.
  • In editor/src/messages/portfolio/document_migration.rs, fill migration drops the original exposed state, and editor/src/messages/tool/tool_messages/fill_tool.rs tests now only check the first fill entry, which can let invalid multi-entry/stale fill states slip through—preserve exposed during migration and tighten tests to enforce the expected simple solid fill semantics.

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

Re-trigger cubic

Comment thread node-graph/interpreted-executor/src/node_registry.rs
Comment thread node-graph/libraries/vector-types/src/gradient.rs
Comment thread editor/src/messages/tool/tool_messages/fill_tool.rs
Comment thread node-graph/libraries/vector-types/src/gradient.rs
Comment thread editor/src/messages/portfolio/document_migration.rs

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

2 issues found across 19 files (changes from recent commits).

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

Re-trigger cubic

Comment thread editor/src/node_graph_executor.rs Outdated
Comment thread editor/src/messages/tool/common_functionality/graph_modification_utils.rs Outdated

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

1 issue found across 19 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="editor/src/messages/tool/tool_messages/gradient_tool.rs">

<violation number="1" location="editor/src/messages/tool/tool_messages/gradient_tool.rs:373">
P2: Legacy document upgrade regression: missing `TransformInput` on Fill nodes now falls back to `DAffine2::IDENTITY` instead of `initial_gradient_transform_for_bbox`, breaking gradient positioning for pre-refactor documents.</violation>
</file>

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread editor/src/messages/tool/tool_messages/gradient_tool.rs
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.

1 participant