Skip to content

Soft selection heat map and logarithmic radius slider - #283

Merged
fernandotonon merged 3 commits into
masterfrom
feat/soft-selection-visuals
Apr 12, 2026
Merged

Soft selection heat map and logarithmic radius slider#283
fernandotonon merged 3 commits into
masterfrom
feat/soft-selection-visuals

Conversation

@fernandotonon

@fernandotonon fernandotonon commented Apr 12, 2026

Copy link
Copy Markdown
Owner

Summary

  • Vertex overlay shows weight-based heat map colors (red→blue gradient) when soft selection is active
  • Radius slider uses logarithmic mapping for fine precision at small values and coarser control at large values
  • Extracted weightToColor() static helper with unit tests
  • Version bump to 2.25.1

Test plan

  • Unit tests for weightToColor() heat map (5 new tests, all pass)
  • Manual: enter edit mode, enable soft selection, select vertex — verify heat map gradient on nearby vertices
  • Manual: verify slider gives fine control near 0.01 and coarser control near 20.0

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Color gradient visualization for soft-selected vertices (blue→red) reflecting selection weight.
    • Soft selection radius slider now uses logarithmic scaling and stays synchronized with external changes for finer control.
  • Tests

    • Added unit tests validating the weight-to-color mapping, endpoints, midpoints, continuity, and alpha behavior.
  • Version

    • Project version updated to 2.25.1.

- Vertex overlay now shows weight-based heat map colors when soft
  selection is active: red (1.0) → orange → yellow → green → cyan → blue (0.0)
- Extract weightToColor() static helper for testability
- Radius slider uses logarithmic mapping for fine precision at small
  values (0.01) and coarser control at large values (20.0)
- Bump version to 2.25.1

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Apr 12, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 74128866-9c9d-49e9-aa4e-9e0a912be048

📥 Commits

Reviewing files that changed from the base of the PR and between 376308a and 1a97530.

📒 Files selected for processing (1)
  • src/EditModeController.cpp

📝 Walkthrough

Walkthrough

Version bumped to 2.25.1; the soft-selection radius slider was changed to a normalized logarithmic control and synchronized with EditModeController.softSelectionRadius; vertex overlay rendering now maps soft-selection weights to a heat-map via a new weightToColor() utility; new GTest coverage added for the mapping.

Changes

Cohort / File(s) Summary
Version Update
CMakeLists.txt
Project version updated from 2.25.02.25.1, adjusting ${PROJECT_VERSION} and -DQTMESHEDITOR_VERSION.
Soft Selection UI
qml/PropertiesPanel.qml
Replaced linear radius slider with normalized 0.0–1.0 slider using a log-mapping to compute/display actual radius; user input is converted back to radius before setting EditModeController.softSelectionRadius; added synchronization guard to avoid feedback loops when the radius is changed externally.
Selection Visualization
src/EditModeController.h, src/EditModeController.cpp
Added static weightToColor(float) declaration and implementation to map weights (0..1) to a heat-map (blue→cyan→green→yellow→orange→red); updated updateSelectionOverlay() to color vertices by soft-selection weight when soft selection is enabled, otherwise retain previous fixed-color behavior.
Tests
src/EditModeController_test.cpp
Added GTest suite validating weightToColor() endpoints, mid-point behavior, alpha consistency, monotonic red-channel property, and boundary continuity checks.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant PropertiesPanel as QML\\ PropertiesPanel
    participant EditMode as EditModeController
    participant Renderer as VertexOverlay

    User->>PropertiesPanel: adjust normalized slider (0.0–1.0)
    PropertiesPanel->>EditMode: set softSelectionRadius (log-mapped from slider)
    EditMode->>EditMode: compute/update per-vertex soft-selection weights
    EditMode->>Renderer: provide per-vertex (index, weight) pairs
    Renderer->>Renderer: map weight -> color via weightToColor()
    Renderer->>User: render colored vertices in overlay
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

🐰 I hopped the log-slider, one to zero to one,
Colors unfurl where the soft weights run.
From blue little hints to red's bright art,
Each vertex now wears a warm-hearted part.
Hooray — a rabbit paints the mesh with fun!

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive The PR description covers key changes and test plan, but is missing a structured format matching the template (Features/Bugfixes sections). Reorganize the summary into the template's Features and Bugfixes sections for better clarity and consistency.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the two main changes: soft selection heat map visualization and logarithmic radius slider improvements.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/soft-selection-visuals

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 035a8d2805

ℹ️ 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".

Comment thread qml/PropertiesPanel.qml Outdated
}
Connections {
target: EditModeController
function onSoftSelectionRadiusChanged() {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Listen to emitted softSelectionChanged signal

Connections is wired to onSoftSelectionRadiusChanged, but EditModeController does not emit a softSelectionRadiusChanged signal (its softSelectionRadius property uses NOTIFY softSelectionChanged in src/EditModeController.h). As a result this handler never runs, so if the radius is changed from anywhere other than this slider (e.g. restored settings or programmatic calls), the slider/value label will not update and the UI drifts out of sync with controller state.

Useful? React with 👍 / 👎.

Comment thread src/EditModeController.cpp Outdated
return Ogre::ColourValue(1.0f, 0.6f + 0.4f * (1.0f - t), 0.0f, 1.0f);
} else if (weight > 0.4f) {
float t = (weight - 0.4f) / 0.2f;
return Ogre::ColourValue(1.0f - t, 1.0f, 0.0f, 1.0f);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Fix reversed midrange interpolation in weightToColor

The 0.4–0.6 branch computes red as 1.0f - t, so increasing weight in that interval decreases red (yellow→green) instead of increasing it (green→yellow) as described by the function comment. This also creates a visible color discontinuity at the 0.6 boundary when the next branch jumps red back up, producing incorrect heat-map gradients for common soft-selection weights.

Useful? React with 👍 / 👎.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
src/EditModeController_test.cpp (1)

130-169: Add seam-point assertions for the piecewise gradient.

Nice coverage overall. Please add explicit checks at 0.2/0.4/0.6/0.8 to lock continuity and prevent transition regressions.

As per coding guidelines: "Add Google Test unit tests for new functionality. Test files live alongside source in src/ with _test.cpp suffix (e.g., Manager_test.cpp)."

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/EditModeController_test.cpp` around lines 130 - 169, Add explicit unit
assertions for the seam points of the piecewise gradient by adding tests that
call EditModeController::weightToColor at weights 0.2, 0.4, 0.6, and 0.8 and
assert the expected R/G/B/A continuity (e.g., monotonic relationship across
adjacent seam points and alpha == 1.0). Create new TEST cases (or extend
WeightToColorGradientMonotonic) that compute colors at these seam weights and
compare them with neighboring values using EXPECT_LE/EXPECT_GE for the channels
that should be monotonic and EXPECT_FLOAT_EQ(c.a, 1.0f) for alpha to lock the
transitions and prevent regressions.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@qml/PropertiesPanel.qml`:
- Around line 363-369: The QML Connections block listens to EditModeController
but uses the wrong handler name (onSoftSelectionRadiusChanged) so updates from
the C++ NOTIFY signal are missed; change the handler to onSoftSelectionChanged
and keep the body that sets softRadiusSlider.updating/value/updating to
true/false using EditModeController.softSelectionRadius, and audit other
handlers (e.g., onSoftSelectionFalloffChanged, onSoftSelectionEnabledChanged)
for similar mismatches against the C++ NOTIFY names.

In `@src/EditModeController.cpp`:
- Around line 502-516: weightToColor has discontinuities at segment boundaries
and the 0.4–0.6 segment interpolates r in the wrong direction; fix by clamping
weight to [0,1], compute a normalized t = (weight - segmentLow) / (segmentHigh -
segmentLow) for each branch, and interpolate from the correct startColor to
endColor so that each boundary value yields identical colours (no jumps) and the
0.4–0.6 branch increases r as weight increases; update the branches in
weightToColor to use these normalized t values and explicit start/end colours
for each segment to ensure continuous, correctly directed interpolation.

---

Nitpick comments:
In `@src/EditModeController_test.cpp`:
- Around line 130-169: Add explicit unit assertions for the seam points of the
piecewise gradient by adding tests that call EditModeController::weightToColor
at weights 0.2, 0.4, 0.6, and 0.8 and assert the expected R/G/B/A continuity
(e.g., monotonic relationship across adjacent seam points and alpha == 1.0).
Create new TEST cases (or extend WeightToColorGradientMonotonic) that compute
colors at these seam weights and compare them with neighboring values using
EXPECT_LE/EXPECT_GE for the channels that should be monotonic and
EXPECT_FLOAT_EQ(c.a, 1.0f) for alpha to lock the transitions and prevent
regressions.
🪄 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: 0ff7aaf9-c052-4989-a583-44dec38c9e9a

📥 Commits

Reviewing files that changed from the base of the PR and between 37893ba and 035a8d2.

📒 Files selected for processing (5)
  • CMakeLists.txt
  • qml/PropertiesPanel.qml
  • src/EditModeController.cpp
  • src/EditModeController.h
  • src/EditModeController_test.cpp

Comment thread qml/PropertiesPanel.qml
Comment thread src/EditModeController.cpp Outdated
- Fix weightToColor() segment direction for 0.4-0.6 range and add
  std::clamp; rewrite as ascending low-to-high for clarity
- Fix QML Connections handler: onSoftSelectionRadiusChanged →
  onSoftSelectionChanged to match the C++ NOTIFY signal
- Add boundary continuity test for weightToColor

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/EditModeController.cpp`:
- Around line 1335-1345: The code always calls getSoftSelectionWeights() and
maps weights to colours, causing selected vertices to be heat-mapped even when
soft selection is off; change the logic to branch on m_softSelectionEnabled:
when true, use getSoftSelectionWeights() and colour via weightToColor(weight) as
now, but when false, iterate the selected vertex indices (use the same
globalToLocal(...) loop over the selection set) and call
m_overlayVertices->colour(...) with the legacy fixed selection colour (replace
weightToColor call with the fixed selection colour used elsewhere in the
codebase), keeping m_overlayVertices->position(...) and the bounds checks on
m_editableMesh unchanged.
🪄 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: 15eaae28-9f4d-4512-b61b-fce7dc9d2d9f

📥 Commits

Reviewing files that changed from the base of the PR and between 035a8d2 and 376308a.

📒 Files selected for processing (3)
  • qml/PropertiesPanel.qml
  • src/EditModeController.cpp
  • src/EditModeController_test.cpp
🚧 Files skipped from review as they are similar to previous changes (2)
  • qml/PropertiesPanel.qml
  • src/EditModeController_test.cpp

Comment thread src/EditModeController.cpp Outdated
Heat map colors only apply when soft selection is enabled.
With soft selection off, selected vertices use the original
fixed orange color.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

@fernandotonon
fernandotonon merged commit ddf4ddb into master Apr 12, 2026
19 checks passed
@fernandotonon
fernandotonon deleted the feat/soft-selection-visuals branch April 12, 2026 08:01
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