Skip to content

fix(import): restore textured viewport and paint preview on File→Open#757

Merged
fernandotonon merged 4 commits into
masterfrom
fix/import-texture-rendering
Jun 24, 2026
Merged

fix(import): restore textured viewport and paint preview on File→Open#757
fernandotonon merged 4 commits into
masterfrom
fix/import-texture-rendering

Conversation

@fernandotonon

Copy link
Copy Markdown
Owner

Summary

  • Rebind RTSS materials for entities imported via File → Open (importMeshs), matching the post-import path cloud downloads already used — fixes white/untextured models in the 3D viewport on Linux.
  • Extract textureSearchRootsForImportFile() so cloud and local imports share the same sidecar texture search roots.
  • Fix blank Texture Paint 2D preview by loading the paint buffer from embedded FBX bytes and on-disk paths before GPU readback (which is unreliable for imported textures).

Scope

This PR intentionally does not include UV Editor work (epic #458). UV editor will be restarted slice-by-slice in follow-up PRs.

Test plan

  • File → Open an FBX with external textures (e.g. Mixamo character) — 3D viewport shows diffuse maps, not flat white
  • Enable Texture Paint on that mesh — 2D preview shows the albedo, not a blank/white canvas
  • Cloud project download import still shows textures (regression)
  • Linux build (QtMeshEditor target)

Made with Cursor

Rebind RTSS materials for newly imported entities (same path cloud downloads
already used) and load texture-paint buffers from embedded/disk sources before
GPU readback, which fails for many imported FBX textures on Linux.

Co-authored-by: Cursor <cursoragent@cursor.com>
@coderabbitai

coderabbitai Bot commented Jun 23, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@fernandotonon, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 58 minutes and 28 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate.

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, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4b88b4ef-4219-4d91-8498-f1e64bf689bb

📥 Commits

Reviewing files that changed from the base of the PR and between 486704c and 6197bb4.

📒 Files selected for processing (7)
  • CMakeLists.txt
  • README.md
  • src/MeshImporterExporter.cpp
  • src/MeshImporterExporter.h
  • src/TexturePaintController.cpp
  • src/mainwindow.cpp
  • website/src/hooks/useQtmeshActionRef.js
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/import-texture-rendering

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.

@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: bbf62a7e71

ℹ️ 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 src/mainwindow.cpp Outdated
Comment on lines +3954 to +3955
MeshImporterExporter::rebindEntityMaterials(static_cast<Ogre::Entity*>(obj),
textureSearchRoots);

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 Rebind imports with per-file texture roots

When File→Open imports multiple meshes from different directories, this passes one merged textureSearchRoots list to every new entity. hydrateEntityTexturesFromSearchPaths() keys sidecar files by basename/relative path and keeps the first match it sees, so two assets that both reference common names like diffuse.png will cause later entities to be rebound using the first asset's texture instead of their own. Please scope the roots to the entity's source file (or otherwise preserve a per-import mapping) before rebinding.

Useful? React with 👍 / 👎.

Use each mesh's qtme.source_path binding for sidecar texture lookup so
multi-file File→Open imports cannot cross-bind common texture basenames.

Co-authored-by: Cursor <cursoragent@cursor.com>
@fernandotonon

Copy link
Copy Markdown
Owner Author

Addressed Codex P2 feedback in b2fd106: texture rebind now uses each entity's qtme.source_path via textureSearchRootsForEntity(), so multi-file File→Open cannot cross-bind common texture basenames.

@fernandotonon

Copy link
Copy Markdown
Owner Author

Merged latest master (Xcode 26.3 pin + MACOS_CACHE_VERSION bump) to fix the libz.tbd / build-n-cache-ogre-macos CI failure.

Sync README and website pinned refs via sync-doc-versions-from-cmake.sh.

Co-authored-by: Cursor <cursoragent@cursor.com>
@fernandotonon fernandotonon merged commit db5a1df into master Jun 24, 2026
19 checks passed
@fernandotonon fernandotonon deleted the fix/import-texture-rendering branch June 24, 2026 01:46
@sonarqubecloud

Copy link
Copy Markdown

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