feat(paint): Slice A — gradient ramp brushes (#544) - #915
Conversation
Add BrushEngine colour sources (solid | gradient) with linear / radial / angular modes, six bundled CC0 ramps, FG/BG quick mode, custom ramp editor with AppData save/load, and paint.brush.gradient breadcrumbs. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Warning Review limit reached
Next review available in: 23 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (7)
📝 WalkthroughWalkthroughAdds gradient ramp data and presets, linear/radial/angular brush sampling, custom ramp persistence and editing, controller settings and stroke integration, and QML controls for selecting and editing gradient ramps. ChangesGradient Ramp Brush
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant User
participant MainWindow
participant TexturePaintController
participant BrushEngine
participant TexturePaintBuffer
User->>MainWindow: Select gradient source and mode
MainWindow->>TexturePaintController: Update gradient settings
User->>TexturePaintController: Paint stroke
TexturePaintController->>BrushEngine: Sample gradient color
BrushEngine-->>TexturePaintController: Return RGBA result
TexturePaintController->>TexturePaintBuffer: Paint callback-generated colors
TexturePaintBuffer-->>User: Update painted texture
Possibly related issues
Possibly related PRs
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a89747b0bc
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Native QColorDialog blocks against the Ogre render surface on Linux; DontUseNativeDialog matches the existing background-color picker path. Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/GradientRamp.cpp`:
- Around line 245-308: Prevent sanitized-stem collisions in saveCustom and
deleteCustom by reading any existing JSON file at the computed path and
verifying that it belongs to the requested ramp/name before overwriting or
removing it. If ownership cannot be confirmed, make saveCustom fail without
modifying the file and make deleteCustom return false; preserve normal behavior
when the file is absent or matches the requested ramp.
In `@src/TexturePaintController.cpp`:
- Around line 297-303: Update the vertexPaintChanged connection in
TexturePaintController to call reloadActiveRamp() only when m_useFgBgRamp is
true. Remove the m_colorSource == ColorGradient condition so static/custom ramps
are not reloaded during repeated brush-setting changes.
- Around line 781-785: Remove the duplicate
qmlRegisterSingletonType<TexturePaintController> call, relying on the existing
PropertiesPanel registration in mainwindow.cpp. Also update the surrounding load
signal connection so handled is not captured by reference beyond its lifetime,
or disconnect the connection before load returns.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 8e6a23e2-5752-42f0-90c4-6fad8a23a940
📒 Files selected for processing (16)
qml/GradientRampEditor.qmlqml/PropertiesPanel.qmlsrc/AppSettingsKeys.hsrc/BrushEngine.cppsrc/BrushEngine.hsrc/CMakeLists.txtsrc/GradientRamp.cppsrc/GradientRamp.hsrc/GradientRamp_test.cppsrc/TexturePaintBuffer.cppsrc/TexturePaintBuffer.hsrc/TexturePaintController.cppsrc/TexturePaintController.hsrc/mainwindow.cppsrc/qml_resources.qrctests/CMakeLists.txt
Keep Solid/Gradient, mode, ramp picker, FG/BG, stepped, and jitter next to radius/strength/falloff on the paint tool menu; drop the inspector copy. Co-authored-by: Cursor <cursoragent@cursor.com>
When the CPU buffer could not load the model texture (blank fallback), in-place blit still targeted the original GPU texture at a different resolution and could crash the driver. Skip in-place upload on mismatch, drop the original handle on blank sessions, and create the texture session eagerly when switching to texture paint. Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/mainwindow.cpp (1)
1918-2110: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winConsider adding
SentryReporter::addBreadcrumbfor the new gradient controls.None of the new source/mode/ramp/FG-BG/stepped/jitter/edit controls record a breadcrumb. As per coding guidelines, "Track all user-facing actions and significant operations with
SentryReporter::addBreadcrumb; useui.actionfor toolbar/menu actions". Sibling sliders (radius/strength/falloff/shape) in this same popup have the same gap, so this isn't a new pattern, but it's worth closing for the new controls while touching this area.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/mainwindow.cpp` around lines 1918 - 2110, Add SentryReporter::addBreadcrumb calls for each new gradient control action in the setup around syncGradientUi: source selection, gradient mode, ramp selection/editing, FG/BG, stepped, and jitter changes. Use the ui.action category for the user-facing menu controls and include meaningful action details, while preserving the existing controller updates.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/mainwindow.cpp`:
- Around line 1924-1935: The color-source buttons currently share an implicit
exclusive group with the shape buttons through their common parent. In the
paint-settings setup around srcSolid and srcGradient, create a dedicated
QButtonGroup parented to paintSettings, add both color-source buttons to it, and
preserve their checkable and exclusive behavior independently of shapeRound and
shapeSquare.
---
Nitpick comments:
In `@src/mainwindow.cpp`:
- Around line 1918-2110: Add SentryReporter::addBreadcrumb calls for each new
gradient control action in the setup around syncGradientUi: source selection,
gradient mode, ramp selection/editing, FG/BG, stepped, and jitter changes. Use
the ui.action category for the user-facing menu controls and include meaningful
action details, while preserving the existing controller updates.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 84656a8a-dd54-4683-9b66-56604c354ee4
📒 Files selected for processing (4)
qml/PropertiesPanel.qmlsrc/TexturePaintBuffer.cppsrc/TexturePaintController.cppsrc/mainwindow.cpp
🚧 Files skipped from review as they are similar to previous changes (2)
- src/TexturePaintBuffer.cpp
- src/TexturePaintController.cpp
Rebind the viewport to the paint texture at session start (not on first stroke) and stop requiring direct entity selection — node/sub-entity picks were skipping rebind so pixels only updated in the 2D preview. Use dirty-rect GPU uploads on Linux/Windows and batch flushes at 33ms. Co-authored-by: Cursor <cursoragent@cursor.com>
Improve stroke visibility with tiled GPU uploads and hit-cache sampling, restore solid as the default colour source, and fix ramp persistence: custom ramps win over bundled presets, stepped mode loads from saved JSON, FG/BG-only reload on colour changes, hash-suffixed custom filenames, and isolated color-source button groups with Sentry breadcrumbs. Co-authored-by: Cursor <cursoragent@cursor.com>
|
|
Addressed review feedback in 21a07cd:
CI on this commit is green (Linux/macOS/Windows builds, unit tests, SonarCloud). |



Summary
Implements Paint v2 Slice A (#544) from epic #543: paint with gradient ramps instead of a single solid colour.
GradientRamp— stop list + linear/stepped interpolator, 6 bundled CC0 presets (Greyscale, Hue, Gold to Rust, Sunset, Ocean, Skin Tones), JSON save/load under<AppData>/paint/ramps/BrushEngine— colour sourcesolid | gradientwith linear (stroke path length), radial, and angular modes + optional per-stroke phase jitterTexturePaintBuffer— per-pixel colour callback overload for radial/angular stampsTexturePaintController— QML properties, FG/BG quick ramp, eyedropper-from-texture seeding, ramp editor window, Sentrypaint.brush.gradientbreadcrumbs; strokes stay single undo commandsGradientRampEditor.qmlTest plan
UnitTests --gtest_filter='GradientRamp*:BrushEngine*'— 10/10 passedTexturePaintBuffer*suite still passespaint.brush.gradientfires with modeMade with Cursor
Summary by CodeRabbit