BS-JD-102 - Quick add and draw-brush tool #11

Closed
opened 2026-06-06 01:46:25 -04:00 by Rbanh · 9 comments
Owner

Summary

Add brush creation via menu/context actions and a modal draw tool that places vertices on a face or floor, then extrudes to convex brush output.

Why

Brushes need a direct authoring workflow in the viewport, not only data components in the inspector.

Implementation notes

  • Add Add Brush menu/context actions.
  • Implement draw mode with viewport ray placement on floor.
  • Show outline/height preview before final commit.
  • Route mutation through undoable history.
  • Allow simple concave outlines by decomposing them into convex brush actors.
  • Normalize adjacent duplicate points and closing duplicate points.
  • Block self-intersecting outlines with status/operator text and no scene mutation.
  • Show phase-specific viewport quick hints.
  • Use a two-step flow: outline first, then mouse-adjusted height before final brush commit.

Acceptance criteria

  • User can create a basic convex brush from the viewport.
  • Preview updates before commit.
  • Escape/right-click cancels with no dirty state.
  • Commit creates one undo entry.

Tests/docs

  • cargo fmt --check
  • cargo test -p editor brush_tool
  • cargo test -p shared brush_math
  • cargo check -p editor --all-targets
  • cargo check --workspace --all-targets
  • cargo check --workspace --all-targets --all-features

Docs updated in README and docs/editor brush pages.

Committed locally as 48b1448 (Improve quick brush creation workflow). Not pushed.

## Summary Add brush creation via menu/context actions and a modal draw tool that places vertices on a face or floor, then extrudes to convex brush output. ## Why Brushes need a direct authoring workflow in the viewport, not only data components in the inspector. ## Implementation notes - Add Add Brush menu/context actions. - Implement draw mode with viewport ray placement on floor. - Show outline/height preview before final commit. - Route mutation through undoable history. - Allow simple concave outlines by decomposing them into convex brush actors. - Normalize adjacent duplicate points and closing duplicate points. - Block self-intersecting outlines with status/operator text and no scene mutation. - Show phase-specific viewport quick hints. - Use a two-step flow: outline first, then mouse-adjusted height before final brush commit. ## Acceptance criteria - [x] User can create a basic convex brush from the viewport. - [x] Preview updates before commit. - [x] Escape/right-click cancels with no dirty state. - [x] Commit creates one undo entry. ## Tests/docs - `cargo fmt --check` - `cargo test -p editor brush_tool` - `cargo test -p shared brush_math` - `cargo check -p editor --all-targets` - `cargo check --workspace --all-targets` - `cargo check --workspace --all-targets --all-features` Docs updated in README and docs/editor brush pages. Committed locally as `48b1448` (`Improve quick brush creation workflow`). Not pushed.
Rbanh added this to the M1 - Brush-based blockout milestone 2026-06-06 01:46:25 -04:00
Rbanh added the
roadmap:jackdaw
type:feature
priority:P0
area:brushes
labels 2026-06-06 01:46:25 -04:00
Author
Owner

Starting implementation for BS-JD-102 - Quick add and draw-brush tool.

Planned scope for this pass:

  • Add editor brush tool state and B shortcut.
  • Let LMB place floor-plane polygon vertices in the viewport.
  • Enter commits a visible additive brush using BrushDesc and editor history/operator status.
  • Esc/right-click cancels without mutating the scene.
  • Backspace removes the last pending vertex.
  • Add menu/command entry where it fits the existing editor command surface.
  • Add polygon validation tests and docs updates.

Will keep ticket comments updated as implementation and verification progress.

Starting implementation for `BS-JD-102 - Quick add and draw-brush tool`. Planned scope for this pass: - Add editor brush tool state and B shortcut. - Let LMB place floor-plane polygon vertices in the viewport. - Enter commits a visible additive brush using `BrushDesc` and editor history/operator status. - Esc/right-click cancels without mutating the scene. - Backspace removes the last pending vertex. - Add menu/command entry where it fits the existing editor command surface. - Add polygon validation tests and docs updates. Will keep ticket comments updated as implementation and verification progress.
Author
Owner

Completed and committed as fcd34f9 Add draw brush tool.

Implemented:

  • Added shared brush polygon validation in shared::brush_math.
  • Added BrushDesc::extruded_prism for floor-polygon prism brushes.
  • Added modal Draw Brush tool (B, toolbar pencil, command brush.draw).
  • LMB places snapped floor points, Backspace removes the last point, Enter commits a brush through spawn_with_history, Esc/right-click cancels without scene mutation.
  • Added preview gizmo lines/points for base/top/height while drawing.
  • Selection ignores viewport clicks while Draw Brush is active so the tool owns LMB.
  • Updated README and brush docs.

Verification:

  • cargo fmt --check
  • cargo test -p shared brush
  • cargo test -p editor brush_tool
  • cargo check --workspace --all-targets
  • cargo check --workspace --all-targets --all-features
Completed and committed as `fcd34f9 Add draw brush tool`. Implemented: - Added shared brush polygon validation in `shared::brush_math`. - Added `BrushDesc::extruded_prism` for floor-polygon prism brushes. - Added modal Draw Brush tool (`B`, toolbar pencil, command `brush.draw`). - LMB places snapped floor points, Backspace removes the last point, Enter commits a brush through `spawn_with_history`, Esc/right-click cancels without scene mutation. - Added preview gizmo lines/points for base/top/height while drawing. - Selection ignores viewport clicks while Draw Brush is active so the tool owns LMB. - Updated README and brush docs. Verification: - `cargo fmt --check` - `cargo test -p shared brush` - `cargo test -p editor brush_tool` - `cargo check --workspace --all-targets` - `cargo check --workspace --all-targets --all-features`
Rbanh closed this issue 2026-06-06 05:53:14 -04:00
Rbanh reopened this issue 2026-06-06 13:22:57 -04:00
Author
Owner

Reopened during M1 QA.

QA finding: Draw Brush creates the actor and Backspace/cancel/commit flow works, but newly-created simple convex brushes are immediately flagged invalid. Inspector diagnostics report Face plane normal is inverted relative to its vertices on generated faces such as face:+y.

Likely root cause: generated prism face winding and stored plane normals disagree after the expanded validator added winding-vs-plane checks. Fixing validator/schema generation before continuing QA.

Reopened during M1 QA. QA finding: Draw Brush creates the actor and Backspace/cancel/commit flow works, but newly-created simple convex brushes are immediately flagged invalid. Inspector diagnostics report `Face plane normal is inverted relative to its vertices` on generated faces such as `face:+y`. Likely root cause: generated prism face winding and stored plane normals disagree after the expanded validator added winding-vs-plane checks. Fixing validator/schema generation before continuing QA.
Author
Owner

Local fix is implemented and staged for QA, but not committed or pushed per QA signoff rule.

What changed locally:

  • Fixed BrushDesc::extruded_prism top/bottom face winding so valid draw-brush prisms no longer fail shared brush validation with inverted face-normal diagnostics.
  • Draw Brush now gives immediate invalid-outline feedback: invalid >=3 point outlines preview red, status/operator text explains the blocker, and pressing Enter on a blocked shape logs the failed attempt with point data while leaving the scene unchanged.
  • Added focused regression tests for prism winding and actionable Draw Brush invalid-shape status.
  • Updated docs/editor/brushes.md with the new invalid-outline feedback behavior.

Verification passed locally:

  • cargo fmt --check
  • cargo test -p editor brush_tool
  • cargo test -p shared brush
  • cargo check -p editor --all-targets
  • cargo check --workspace --all-targets
  • cargo check --workspace --all-targets --all-features

Awaiting user QA before closing or pushing.

Local fix is implemented and staged for QA, but not committed or pushed per QA signoff rule. What changed locally: - Fixed `BrushDesc::extruded_prism` top/bottom face winding so valid draw-brush prisms no longer fail shared brush validation with inverted face-normal diagnostics. - Draw Brush now gives immediate invalid-outline feedback: invalid >=3 point outlines preview red, status/operator text explains the blocker, and pressing Enter on a blocked shape logs the failed attempt with point data while leaving the scene unchanged. - Added focused regression tests for prism winding and actionable Draw Brush invalid-shape status. - Updated `docs/editor/brushes.md` with the new invalid-outline feedback behavior. Verification passed locally: - `cargo fmt --check` - `cargo test -p editor brush_tool` - `cargo test -p shared brush` - `cargo check -p editor --all-targets` - `cargo check --workspace --all-targets` - `cargo check --workspace --all-targets --all-features` Awaiting user QA before closing or pushing.
Author
Owner

Scope decision from QA discussion:

  • For M1, Draw Brush should allow simple concave outlines by decomposing them into a composition of convex brush pieces instead of storing first-class concave brush faces.
  • Adjacent duplicate points and a closing duplicate point should be normalized/merged where unambiguous.
  • Self-intersecting outlines should remain blocked with clear status/operator text and no scene mutation.
  • Full first-class concave brush and robust arbitrary CSG architecture is deferred to the post-Jackdaw geometry-kernel milestone/ticket.
Scope decision from QA discussion: - For M1, Draw Brush should allow simple concave outlines by decomposing them into a composition of convex brush pieces instead of storing first-class concave brush faces. - Adjacent duplicate points and a closing duplicate point should be normalized/merged where unambiguous. - Self-intersecting outlines should remain blocked with clear status/operator text and no scene mutation. - Full first-class concave brush and robust arbitrary CSG architecture is deferred to the post-Jackdaw geometry-kernel milestone/ticket.
Author
Owner

Local implementation updated for the concave/duplicate draw-brush scope and staged for QA. Not committed or pushed.

What changed locally:

  • Draw Brush now accepts simple concave floor outlines by decomposing them into multiple convex prism brush actors.
  • Concave commits are one undoable history item via a new SpawnMany/spawn_many_with_history path, with all generated parts selected after commit/redo.
  • Preview shows the normal outline plus internal convex-part boundaries for concave shapes.
  • Status/operator text reports when Enter will create multiple convex brush parts.
  • Adjacent duplicate clicks and a closing duplicate point are normalized/merged before validation/commit.
  • Self-intersecting outlines remain blocked, preview red, log failed Enter attempts, and leave the scene unchanged.
  • BrushDesc::extruded_prism now normalizes floor points before building faces, while preserving convex brush storage/hydration.
  • README and editor brush docs updated for the new workflow.

Verification passed locally:

  • cargo fmt --check
  • cargo test -p editor brush_tool
  • cargo test -p shared brush
  • cargo check -p editor --all-targets
  • cargo check --workspace --all-targets
  • cargo check --workspace --all-targets --all-features

Awaiting user QA before closing, committing, or pushing.

Local implementation updated for the concave/duplicate draw-brush scope and staged for QA. Not committed or pushed. What changed locally: - Draw Brush now accepts simple concave floor outlines by decomposing them into multiple convex prism brush actors. - Concave commits are one undoable history item via a new `SpawnMany`/`spawn_many_with_history` path, with all generated parts selected after commit/redo. - Preview shows the normal outline plus internal convex-part boundaries for concave shapes. - Status/operator text reports when Enter will create multiple convex brush parts. - Adjacent duplicate clicks and a closing duplicate point are normalized/merged before validation/commit. - Self-intersecting outlines remain blocked, preview red, log failed Enter attempts, and leave the scene unchanged. - `BrushDesc::extruded_prism` now normalizes floor points before building faces, while preserving convex brush storage/hydration. - README and editor brush docs updated for the new workflow. Verification passed locally: - `cargo fmt --check` - `cargo test -p editor brush_tool` - `cargo test -p shared brush` - `cargo check -p editor --all-targets` - `cargo check --workspace --all-targets` - `cargo check --workspace --all-targets --all-features` Awaiting user QA before closing, committing, or pushing.
Author
Owner

Additional local update staged for QA: Draw Brush now shows viewport key hints while active.

Details:

  • Added an in-viewport Draw Brush hint panel listing LMB point placement, Enter create, Backspace remove, Esc cancel, and RMB cancel.
  • The panel shows current point count and switches from placing-points to ready state once enough points exist.
  • Updated README and brush docs to mention the viewport quick hints.

Additional verification passed locally:

  • cargo fmt --check
  • cargo test -p editor brush_tool
  • cargo check -p editor --all-targets
  • cargo check --workspace --all-targets
  • cargo check --workspace --all-targets --all-features

Still awaiting user QA before closing, committing, or pushing.

Additional local update staged for QA: Draw Brush now shows viewport key hints while active. Details: - Added an in-viewport Draw Brush hint panel listing LMB point placement, Enter create, Backspace remove, Esc cancel, and RMB cancel. - The panel shows current point count and switches from placing-points to ready state once enough points exist. - Updated README and brush docs to mention the viewport quick hints. Additional verification passed locally: - `cargo fmt --check` - `cargo test -p editor brush_tool` - `cargo check -p editor --all-targets` - `cargo check --workspace --all-targets` - `cargo check --workspace --all-targets --all-features` Still awaiting user QA before closing, committing, or pushing.
Author
Owner

Additional local update staged for QA: optimized convex composition generation.

Details:

  • Concave decomposition still starts from robust ear clipping, but now greedily merges adjacent pieces when their union remains a valid convex polygon.
  • Common L-shaped/simple concave outlines now generate fewer brush actors; added regression coverage for an L shape decomposing to 2 convex parts instead of triangle-only output.
  • Editor brush snapshot test now expects the simpler concave example to create 2 brush parts.

Additional verification passed locally:

  • cargo fmt --check
  • cargo test -p shared brush_math
  • cargo test -p editor brush_tool
  • cargo check -p editor --all-targets
  • cargo check --workspace --all-targets
  • cargo check --workspace --all-targets --all-features

Still awaiting user QA before closing, committing, or pushing.

Additional local update staged for QA: optimized convex composition generation. Details: - Concave decomposition still starts from robust ear clipping, but now greedily merges adjacent pieces when their union remains a valid convex polygon. - Common L-shaped/simple concave outlines now generate fewer brush actors; added regression coverage for an L shape decomposing to 2 convex parts instead of triangle-only output. - Editor brush snapshot test now expects the simpler concave example to create 2 brush parts. Additional verification passed locally: - `cargo fmt --check` - `cargo test -p shared brush_math` - `cargo test -p editor brush_tool` - `cargo check -p editor --all-targets` - `cargo check --workspace --all-targets` - `cargo check --workspace --all-targets --all-features` Still awaiting user QA before closing, committing, or pushing.
Author
Owner

Additional local update staged for QA: two-step height setting for quick brush creation.

Details:

  • Draw Brush now has two phases: Outline and Height.
  • In Outline phase, LMB places points, Backspace removes points, and Enter locks the outline instead of immediately creating the brush.
  • In Height phase, moving the mouse up/down adjusts brush height with a live preview. Enter or LMB commits the final brush; Backspace returns to outline editing; Esc/RMB cancels.
  • Viewport quick hints now change by phase and show the current height while setting height.
  • Status/operator text reports the selected height and convex part count.
  • README and brush docs updated for the two-step workflow.

Verification passed locally:

  • cargo fmt --check
  • cargo test -p editor brush_tool
  • cargo test -p shared brush_math
  • cargo check -p editor --all-targets
  • cargo check --workspace --all-targets
  • cargo check --workspace --all-targets --all-features

Still awaiting user QA before closing, committing, or pushing.

Additional local update staged for QA: two-step height setting for quick brush creation. Details: - Draw Brush now has two phases: Outline and Height. - In Outline phase, LMB places points, Backspace removes points, and Enter locks the outline instead of immediately creating the brush. - In Height phase, moving the mouse up/down adjusts brush height with a live preview. Enter or LMB commits the final brush; Backspace returns to outline editing; Esc/RMB cancels. - Viewport quick hints now change by phase and show the current height while setting height. - Status/operator text reports the selected height and convex part count. - README and brush docs updated for the two-step workflow. Verification passed locally: - `cargo fmt --check` - `cargo test -p editor brush_tool` - `cargo test -p shared brush_math` - `cargo check -p editor --all-targets` - `cargo check --workspace --all-targets` - `cargo check --workspace --all-targets --all-features` Still awaiting user QA before closing, committing, or pushing.
Rbanh closed this issue 2026-06-06 14:16:25 -04:00
Sign in to join this conversation.
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: Falling-Metal-Interactive/Blacksite#11
No description provided.