Skip to content

Path points can be corners, so paths can have hard edges - #627

Closed
vangel76 wants to merge 3 commits into
storytold:mainfrom
vangel76:feat/path-corners-620
Closed

vangel76 wants to merge 3 commits into
storytold:mainfrom
vangel76:feat/path-corners-620

Conversation

@vangel76

Copy link
Copy Markdown
Contributor

Path points can now be corners: Shift+click places a point with a hard turn, and a new Corner button on the Path toolbar switches the selected point between corner and smooth. Old paths stay smooth.

Fixes #620

  • A corner point ends the smooth curve on each side, so a closed path of four corners is a straight-edged quadrilateral (also as a lasso fill).
  • Corner points are drawn as squares; toggling is one undo step and repaints the edited path.
  • Projects saved before this load unchanged.

Checked with unit, engine and UI tests (paint, core, engine, ui-egui all pass; clippy and fmt clean). Not run in the native app by hand.

Details for review
  • PathShape.corners (core) and PathState.corners are a per-point flag list. It is serde(default) and not written when no point is a corner, so smooth paths serialize exactly as before. A missing entry means smooth.
  • spline_with_corners / spline_segments_with_corners (paint) are new functions next to the old ones. Each segment next to a corner uses the corner itself in place of its outer neighbour, so the corner ends the run; two adjacent corners give a straight segment. The old spline / spline_segments call them with no flags.
  • Engine: Session::set_path_point_corner, toggle_selected_path_corner, append_path_corner, insert_path_corner. Flags stay aligned when points are inserted, appended or removed, and are part of the point undo snapshots and of the stored-path comparison. New command path.corner {index?, corner?} (default: selected point, toggle). tool.path takes corners?: [bool,...]. Documented in the command specs.
  • UI: Shift+click adds a corner (also when inserting on the curve); Alt stays camera navigation. The Corner button is disabled without a selected point. I did not change the existing hint text.
  • No tangent handles in this PR.
  • Overlap: open PR Keep 3D path points the view can't see where they are stored #555 also touches crates/paint/src/path.rs and crates/engine/src/path_tool.rs, and issue Path tool - It must only project/snap selected point. Not all. #552 is about point reprojection. I did not change point storage or reprojection; the new spline code is separate functions, so a merge should be small. My PR Path tool keeps your points when you click in the other view and tells you why #582 changes path_input in viewport.rs; I only added the Shift check at the place where a point is added.
  • New UI string (English only for now, for craft-i18n): "Corner point (Shift+click places one)".
  • Tests: paint all_corner_closed_path_is_the_straight_edged_quadrilateral, mixed_corners_split_the_spline_into_runs; engine corner_points_make_a_path_with_straight_edges, toggling_a_corner_is_one_undo_step_and_is_saved, corner_flags_follow_their_points_when_points_are_inserted_or_removed, paths_saved_without_corner_flags_load_smooth; UI shift_click_places_a_corner_point_in_one_undo_step, corner_button_toggles_the_selected_point_and_is_off_without_one. The first two engine tests fail without the corner splitting (checked).

@coderabbitai

coderabbitai Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 24 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 8347da6 and 9819094.

Files selected for processing: 9

  • crates/core/src/layer.rs
  • crates/engine/src/path_tool.rs
  • crates/engine/tests/it/path_tool.rs
  • crates/paint/src/lib.rs
  • crates/paint/src/path.rs
  • crates/ui-egui/src/toolbar.rs
  • crates/ui-egui/src/viewport.rs
  • crates/ui-egui/tests/it/path_in_view.rs
  • docs/features.md
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@vangel76

Copy link
Copy Markdown
Contributor Author

Combined into #635 together with the rest of today's UI PRs, so the Windows proof build only has to run once. Closing this one in favour of it.

@vangel76 vangel76 closed this Nov 17, 2026
chasse20 pushed a commit that referenced this pull request Nov 18, 2026
Combines 45 open pull requests so the Windows proof build runs once. Included:

- Fill layers can color from dark to light with a gradient map (PR #535, fixes #482)
- Front, side and top views, and F5/F6 switch between perspective and orthographic (PR #539, part of #241)
- Textures export as DDS, with compressed normal and grayscale maps for game engines (PR #543, fixes #354)
- The active layer and the eye in the Layers panel are much easier to see (PR #561, fixes #553)
- Export dialog can also write a MaterialX file for each texture set (PR #563, fixes #558)
- Layers toolbar stays on one row and cut-off layer names show on hover in small windows (PR #564, fixes #560)
- Save a layer's mask as an image file or copy it to the clipboard from the layer menu (PR #565, fixes #559)
- Shift + wheel and Ctrl + wheel change the brush size, and Ctrl+drag brush changes have a fine mode (PR #566, part of #545)
- Select several layers in the Layers panel with Shift+click, Ctrl+click and Ctrl+A (PR #567, fixes #247)
- Pressing F frames the object you are painting, so a floor plane no longer throws off the view (PR #568, fixes #478)
- Save a mask as your own smart mask and reuse it on other layers and projects (PR #569, fixes #562)
- Show one layer alone in the viewport, with or without its mask (PR #570, fixes #544)
- On-screen orbit, pan and zoom buttons let a pen tablet move the 3D and 2D views (PR #573, fixes #288)
- Decals can be mirrored to the opposite side of the mesh across X, Y or Z, with optional U or V flip (PR #576, fixes #272)
- Shift+click lines in the 3D view start at the spot you last painted, even after turning the view (PR #578, fixes #574)
- History steps now name the tool and layer and appear in the interface language (PR #580, fixes #572)
- Path tool keeps your points when you click in the other view and tells you why (PR #582, fixes #575)
- Brush, symmetry and tool settings stay when you open another project or restart the app (PR #584, fixes #571)
- Reset only the panel layout from the Window menu, and Reset UI now asks first (PR #586, fixes #577)
- Output templates ask before deleting and before dropping an unfinished edit (PR #588, fixes #579)
- Clone tool shows its source in the 2D view, forgets it when you switch texture set, and can restart at the source each stroke (PR #590, fixes #581)
- Move the symmetry plane to the model's middle or to a clicked point in one click (PR #591, fixes #585)
- Projection stencil can be dropped in from Assets, moved and reset with fields, turned in snapped steps, and the 2D view says projection works in 3D (PR #593, fixes #583)
- Smudge now shows which channels it drags and lets you switch them (PR #594, fixes #587)
- Save panel layouts under a name and switch between them from the Window menu (PR #595, fixes #589)
- Clone and Smudge now work on layer masks (PR #596, fixes #592)
- A layer image menu test no longer fails when another test switches the interface language (PR #597)
- Clicking a material in the shelf now paints with it instead of adding a layer (PR #599, fixes #305)
- Alt+click on a mask thumbnail now labels the mask view and blanks the other texture sets (PR #605, fixes #600)
- Painting on a texture set that is not active now shows a hint why nothing happens (PR #607, fixes #601)
- Ctrl+Shift+click draws straight lines that snap to 15 degree steps (PR #609, fixes #604)
- Output template channels can be inverted (PR #611, fixes #603)
- Smudge now follows the mirror and radial symmetry planes (PR #613, fixes #602)
- The shortcut list now shows the stencil, clone source, straight line and path gestures (PR #614, fixes #608)
- Symmetry now also mirrors strokes painted in the 2D view (PR #615, fixes #610)
- Decals keep their image's proportions while sizing and can be flipped (PR #617, fixes #606)
- Polygon fill now also fills the mirrored side when symmetry is on (PR #619, fixes #612)
- A decal dragged over a curved or differently facing surface now turns with it instead of tilting or flipping (PR #622, fixes #616)
- Every brush alpha now has size, roundness, contrast and invert settings (PR #623, part of #598)
- Decals placed as a mask can now be sized, turned and moved from Properties like decal layers (PR #624, fixes #618)
- Renaming effects and linking fills to mask anchor points are now tested in the interface (PR #626, fixes #621)
- Path points can be corners, so paths can have hard edges (PR #627, fixes #620)
- Layer menu can apply a layer's blending mode and opacity to all channels, and copy/paste channel blending (PR #631, fixes #629)
- Display Settings can now set glow, vignette, sharpen and film grain (PR #632, fixes #630)
- Every command a key can run can now get a keyboard shortcut (PR #633, fixes #628)

Fixes found while combining them: the named layouts window is drawn again, layer remove/duplicate/group/visibility stay bindable to keys, the Clone tool's Aligned switch is kept with the other tool settings, smudge copies in the 2D view keep their own trails, and a UI or control-channel camera command during a view glide is no longer undone by the glide.
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.

Path points can be corners, so paths can have hard edges

1 participant