feat(import): auto-scale sub-unit meshes to ~3 units#539
Conversation
The auto-scale heuristic for mm-scale FBX / photogrammetry assets previously brought the largest bounding-box dimension to ~1 unit. At that target the imported model lands well inside the default camera framing and feels visually small — users had to manually scale up after every sub-unit import. Bump the target to 3 units so models come in at a more comfortable working size. Threshold (0.01) and behavior for sensible-scale assets unchanged. Test comments + expected factor description updated; the existing `>= 50` assertion still holds (factor for 0.005 extent: ~200 → ~600). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
📝 WalkthroughWalkthroughThe importer's sub-unit mesh auto-scaling logic is adjusted to apply a larger scale factor ( ChangesSub-unit mesh auto-scaling adjustment
Possibly Related PRs
Poem
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/MeshImporterExporter.cpp (1)
2113-2119:⚠️ Potential issue | 🟠 Major | ⚡ Quick winAdd Sentry breadcrumb for auto-scale import action.
Line 2113 changes import behavior materially, but this significant import-side operation is only logged to Ogre logs; it should also emit a
file.importbreadcrumb for traceability.Suggested patch
if (maxExtent > 0.0f && maxExtent < 0.01f) { const Ogre::Real factor = 3.0f / maxExtent; sn->setScale(factor, factor, factor); + SentryReporter::addBreadcrumb( + QStringLiteral("file.import"), + QStringLiteral("Auto-scaled sub-unit mesh '%1' by %2 (maxExtent=%3)") + .arg(QString::fromStdString(en->getName())) + .arg(factor) + .arg(maxExtent)); Ogre::LogManager::getSingleton().logMessage( "MeshImporterExporter: auto-scaled '" + en->getName() + "' by " + std::to_string(factor) + " (source max-extent " + std::to_string(maxExtent) + " was inside the near-clip plane)"); }As per coding guidelines: "All user-facing actions and significant operations must be tracked with SentryReporter::addBreadcrumb(category, message). Use 'file.import' / 'file.export' for I/O operations."
🤖 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/MeshImporterExporter.cpp` around lines 2113 - 2119, Auto-scaling during import is only logged to Ogre but needs a Sentry breadcrumb for traceability; after computing factor and calling sn->setScale(...) (in the MeshImporterExporter import path where factor, maxExtent and en->getName() are available), add a call to SentryReporter::addBreadcrumb("file.import", <message>) with a concise message similar to the Ogre log (include en->getName(), factor and maxExtent). Ensure SentryReporter is included/available in this translation unit and the breadcrumb call mirrors the existing Ogre log text for consistency.
🤖 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.
Outside diff comments:
In `@src/MeshImporterExporter.cpp`:
- Around line 2113-2119: Auto-scaling during import is only logged to Ogre but
needs a Sentry breadcrumb for traceability; after computing factor and calling
sn->setScale(...) (in the MeshImporterExporter import path where factor,
maxExtent and en->getName() are available), add a call to
SentryReporter::addBreadcrumb("file.import", <message>) with a concise message
similar to the Ogre log (include en->getName(), factor and maxExtent). Ensure
SentryReporter is included/available in this translation unit and the breadcrumb
call mirrors the existing Ogre log text for consistency.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 4b84b122-1d8e-4864-99fa-91bd2221507c
📒 Files selected for processing (2)
src/MeshImporterExporter.cppsrc/MeshImporterExporter_test.cpp
|



Summary
maxExtent < 0.01) and behavior for sensible-scale assets unchanged.EXPECT_GE(scale, 50.0f)assertion still holds (factor for 0.005 extent: ~200 → ~600).Test plan
Importer_SubUnitMesh_AutoScalesParentNodestill passes.Importer_NormalSizedMesh_KeepsScale1still passes (corollary — above-threshold meshes are not touched).🤖 Generated with Claude Code
Summary by CodeRabbit