Skip to content

quads chunk 3: importer quad detection (re-targeted) - #331

Merged
fernandotonon merged 1 commit into
feat/quadsfrom
feat/quads-3-importer
Apr 28, 2026
Merged

quads chunk 3: importer quad detection (re-targeted)#331
fernandotonon merged 1 commit into
feat/quadsfrom
feat/quads-3-importer

Conversation

@fernandotonon

Copy link
Copy Markdown
Owner

Summary

Chunk 3 of the quad migration (#326). Re-opening from #329 because that PR auto-closed when its base branch (feat/quads-2-gpu-upload) was deleted on chunk 2's merge.

Same content as the (now-closed) #329 — fully green CI on the previous run. No code changes since.

Changes

  • MeshImporterExporter::importer caches the source file path on the imported Ogre::Mesh via UserObjectBindings("qtme.source_path").
  • New EditableMesh::loadFromAssimpFile(path) re-imports through Assimp with aiProcess_Triangulate deliberately OFF, recording source quads as EditableFace entries.
  • Skeleton, animation, material, and tangent processing are skipped — Edit Mode operates on geometry only.

Deliberately NOT done in this chunk

EditModeController::enterEditMode is NOT yet wired to use this path. Doing so safely needs a "user has modified this mesh" flag — that's chunk 4. This chunk only adds the new code path without changing any existing flows. Net user-visible behavior: zero change.

Tests (+6 standalone)

  • Empty path / missing file rejected.
  • OBJ quad → 1 EditableFace (4 verts) + 2 fan triangles.
  • Triangle-only OBJ leaves faces empty (chunk-1 invariant).
  • Mixed tri+quad OBJ produces both face types.
  • Non-empty EditableMesh is replaced.

OBJs written via QFile to QDir::tempPath() and removed after each test.

Closes

Re-opens #329 (auto-closed due to base-branch deletion). Towards #326.

🤖 Generated with Claude Code

Adds the n-gon-aware re-import path discussed on #326. The existing
AssimpToOgreImporter pipeline is untouched; this chunk only:

  1. Caches the source file path on the imported Ogre::Mesh via
     UserObjectBindings("qtme.source_path"). MeshImporterExporter
     attaches it after every Assimp-backed import.
  2. Adds EditableMesh::loadFromAssimpFile(path) which spins up an
     independent Assimp::Importer with aiProcess_Triangulate
     deliberately OFF, so source quads survive into aiMesh::mFaces and
     get recorded as EditableFace entries. Vertex attributes
     (positions/normals/UVs/colors/bone weights) are read out of the
     same scene; skeleton, animation, material, and tangent processing
     are skipped — Edit Mode operates on geometry only.

Notes & deferred work:
  - Not yet wired into EditModeController::enterEditMode. Doing so
    safely needs a "user has modified this mesh" flag so re-importing
    doesn't discard prior edits — that's a follow-up chunk.
  - Re-import cost (~10–100ms typical, more on huge FBX) is acceptable
    as a one-time Tab-into-Edit-Mode cost.

Tests (+6, standalone):
  - empty path / missing file rejected
  - OBJ quad → 1 EditableFace (4 verts), 2 fan triangles
  - triangle-only OBJ leaves `faces` empty (chunk-1 invariant)
  - mixed tri+quad OBJ produces both face types
  - non-empty mesh is replaced

197 standalone tests green (was 191; +6).

Towards #326.

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

coderabbitai Bot commented Apr 28, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0ec01d2c-ca29-48e5-9581-d829b982e823

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/quads-3-importer

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.

@sonarqubecloud

Copy link
Copy Markdown

@fernandotonon
fernandotonon merged commit cd97a24 into feat/quads Apr 28, 2026
51 checks passed
@fernandotonon
fernandotonon deleted the feat/quads-3-importer branch April 28, 2026 15:36
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