Skip to content

[BrushGraph 1/7]: Add core data models and validation#60

Open
maxmmitchell wants to merge 2 commits intoadd-brush-designer-uifrom
brush-graph/1-data
Open

[BrushGraph 1/7]: Add core data models and validation#60
maxmmitchell wants to merge 2 commits intoadd-brush-designer-uifrom
brush-graph/1-data

Conversation

@maxmmitchell
Copy link
Copy Markdown

@maxmmitchell maxmmitchell commented Apr 27, 2026

Description

This is the first PR in a stacked series to introduce the Brush Graph feature. This PR adds the foundational data structures and validation logic.

Details

  • BrushGraph: An immutable snapshot of the entire graph state (nodes and edges).

  • GraphNode: Represents a node on the canvas. It wraps a NodeData payload and holds UI state (expanded, error, disabled).

  • NodeData (Sealed Interface): The core domain model wrapping various Proto types (Tip, Paint, Behavior, Coat, Family).

  • Port (Sealed Class): Defines input, output, and dynamic "Add" ports for nodes.

  • update strings.xml (needed so all PRs' code can compile, many references to string resources throughout)

  • preserveEdgesOnTypeChange: A mapping algorithm that preserves incoming user connections when a node's operation type is changed (e.g., changing a BinaryOp from ADD to MULTIPLY).

  • GraphValidator encodes semantic rules about node connections and many general BrushFamily validation rules at the graph level, so errors can be propagated to the user and link to erroneous nodes in graph space.

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 a comprehensive data model and validation system for a brush behavior graph, including UI display utilities and a guided tutorial framework. Feedback focuses on improving the robustness of the graph validation logic, specifically addressing potential index out-of-bounds errors, fixing nested list structures in error messages, and ensuring locale-independent string formatting for technical values. Additionally, a more reliable deduplication method for validation exceptions was suggested.

Comment thread app/src/main/java/com/example/cahier/developer/brushgraph/data/GraphValidator.kt Outdated
Comment thread app/src/main/java/com/example/cahier/developer/brushgraph/data/GraphDataModel.kt Outdated
Comment thread app/src/main/java/com/example/cahier/developer/brushgraph/data/GraphValidator.kt Outdated
Comment thread app/src/main/java/com/example/cahier/developer/brushgraph/data/GraphValidator.kt Outdated
@maxmmitchell maxmmitchell marked this pull request as ready for review April 27, 2026 13:32
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.

2 participants