Skip to content

feat(paint): QML falloff slider + vertex color preview toggle - #350

Closed
fernandotonon wants to merge 12 commits into
masterfrom
feat/vertex-paint-falloff-preview-qml
Closed

feat(paint): QML falloff slider + vertex color preview toggle#350
fernandotonon wants to merge 12 commits into
masterfrom
feat/vertex-paint-falloff-preview-qml

Conversation

@fernandotonon

Copy link
Copy Markdown
Owner

Summary

  • Add Vertex Paint controls to the QML Inspector (Edit Mode Tools): radius, strength, falloff.
  • Add a Vertex Color Preview toggle that applies a non-destructive per-entity material override in Edit Mode.
  • Make brush falloff configurable (distance weight exponent).

Closes #315.

Test plan

  • Build UnitTests and run EditModeControllerGeometry.ApplyVertexColorBrushAffectsVerticesWithinRadius.
  • In GUI: enter Edit Mode, enable Vertex Paint, adjust radius/strength/falloff and paint; toggle preview on/off and verify original materials restore.

Made with Cursor

Assimp-based exports now emit vertex colors from VES_DIFFUSE and FBX exports write LayerElementColor. Also load exported .material sidecars when reimporting .mesh so material names don't fall back to BaseWhite.

Made-with: Cursor
Deferred GPU upload from vertex painting could leave Ogre buffers stale when export ran in the same frame. Sync EditableMesh colors to the entity before reading geometry for Assimp and FBX paths (including scene glTF export).

Made-with: Cursor
…x colors

- Sidecar material test: destroy export entity, release material handle, remove
  from MaterialManager when still loaded so reimport must parse .material.
- FBX vertex color test: assert ByPolygonVertex Colors array length and RGBA
  order after reversed winding (v0 red, v2 blue, v1 green).
- exportCurrentPose: copy VES_DIFFUSE from bind-pose buffers like UVs.
- Shorten flushPendingVertexPaintForEntity doc comment.

Made-with: Cursor
ensureResourceGroup initialises the mesh folder before tryLoadSidecarMaterialScript;
a second initialiseResourceGroup is a no-op, so materials from the in-memory
parse never reached a loaded state and mesh import fell back to BaseWhite.

Made-with: Cursor
- Use mutable QByteArray and read-only MemoryDataStream instead of
  (void*)constData() (const-correctness / Sonar).
- Extract loadUnloadedOgreMaterialsInGroup to keep tryLoadSidecarMaterialScript
  simpler.
- Keep explicit load of UNLOADED materials in the mesh folder group so .mesh
  reimport resolves sidecar materials after parseScript.

Made-with: Cursor
…aterials

- Resolve sidecar as completeBaseName.material so model.v2.mesh finds model.v2.material.
- After parseScript, load only materials declared on Ogre material script lines (prefix material + name);
  remove loadResourceGroup and full-group material iteration so unrelated broken scripts cannot fail import.
- FBX vertex-color test: unique mesh/node names, ASSERT_NE(objects).
- EditModeController: file.export Sentry breadcrumb in flushPendingVertexPaintForEntity;
  expand flush API doc comment (CodeRabbit docstring / observability).

Made-with: Cursor
- Run loadResourceGroup immediately after parseScript (matches CI-passing flow).
- Keep declared-name loads, then sweep only UNLOADED materials in the mesh folder group.
- Removes try/catch that could mask load failures; declared-name trim/load unchanged.

Made-with: Cursor
- loadMaterialsDeclaredInOgreMaterialScript returns whether any declared
  material exists in the mesh folder group after disk init
- Run memory parseScript only when none were found (avoids duplicate-
  material exceptions that skipped loadResourceGroup and left BaseWhite)
- Keep unload sweep after each load path

Made-with: Cursor
MeshSerializer writes SubMesh::getMaterialName(); SubEntity::setMaterial
does not update the mesh asset. Without this the exported .mesh did not
reference SidecarMaterial and reimport always resolved to BaseWhite.

Made-with: Cursor
- Add Vertex Paint section to QML Edit Mode Tools with radius/strength/falloff
- Expose brush falloff parameter and apply it in distance weighting
- Add per-entity vertex color preview material override toggle

Made-with: Cursor
@coderabbitai

coderabbitai Bot commented Apr 30, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@fernandotonon has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 49 minutes before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7bcb91bf-f38e-47f1-89bc-ef868cd55c66

📥 Commits

Reviewing files that changed from the base of the PR and between 3e8d507 and 13f3e19.

📒 Files selected for processing (8)
  • qml/PropertiesPanel.qml
  • src/EditModeController.cpp
  • src/EditModeController.h
  • src/EditModeController_test.cpp
  • src/FBX/FBXExporter.cpp
  • src/FBX/FBXExporter_test.cpp
  • src/MeshImporterExporter.cpp
  • src/MeshImporterExporter_test.cpp
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/vertex-paint-falloff-preview-qml

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
Review rate limit: 0/1 reviews remaining, refill in 49 minutes.

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

@fernandotonon

Copy link
Copy Markdown
Owner Author

Closing in favor of #351 (clean branch off master with only paint UI changes).

@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: 13f3e19233

ℹ️ 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 on lines +5265 to +5266
if (m_vertexColorPreviewEnabled)
applyVertexColorPreviewMaterials();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Preserve original preview snapshot when toggling wireframe

When m_vertexColorPreviewEnabled is already true, this call re-enters applyVertexColorPreviewMaterials(), which clears m_vertexColorPreviewSavedMaterials and re-snapshots whatever override is currently applied. In the sequence “enable preview → toggle wireframe → disable preview”, the saved map is overwritten with preview/wireframe materials instead of the original sub-entity materials, so turning preview off no longer restores the true originals (and can leave the preview material stuck after exiting edit mode).

Useful? React with 👍 / 👎.

@fernandotonon
fernandotonon deleted the feat/vertex-paint-falloff-preview-qml branch May 14, 2026 03:04
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.

Paint: Vertex Paint UI in Inspector (QML)

1 participant