Repository navigation
Fix incorrect FBX connection order - #6421
Conversation
PR assimp#6120 fixed a macro which previously prevented std::unordered_multimap from being used during FBX import when compiled with GCC. This caused FBX::Element properties to be stored in arbitrary order, but the order of connections ("C" properties) in FBX files matters. The main issue I saw was incorrect materials. This changes the type of FBX::ElementMap to always use std::multimap (i.e., ordered). This was the behavior for years under GCC while the broken macro was in use. Unordered containers are still used elsewhere in the FBX importer to benefit from their performance.
WalkthroughThe change replaces a custom unordered multimap type with the standard ordered multimap in the FBX parser's public type alias. This modifies iteration order guarantees and lookup performance characteristics for Element storage within Scope, while preserving the public API surface. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
code/AssetLib/FBX/FBXParser.h (1)
67-69: Switch tostd::multimapcorrectly restores deterministic element orderingUsing
std::multimap<std::string, Element*>forElementMaplooks consistent with the intent to have stable, deterministic iteration order forScope::elements. Existing usages (find,equal_range, iteration inFindElementCaseInsensitive) remain valid; the only change is the expected O(log n) lookup complexity, which seems like a reasonable tradeoff given the ordering bug you’re fixing.SonarCloud’s suggestion about a transparent comparator could be addressed like:
using ElementMap = std::multimap<std::string, Element*, std::less<>>;This would allow heterogeneous lookup (e.g.,
const char*,std::string_view) without constructing astd::string. However, since all current lookups here useconst std::string&, the practical benefit is minimal, and adoptingstd::less<>assumes a C++14-or-newer standard library. I’d treat this as an optional follow‑up only if the project’s baseline and other FBX containers already rely on transparent comparators.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
code/AssetLib/FBX/FBXParser.h(1 hunks)
🧰 Additional context used
🪛 GitHub Check: SonarCloud Code Analysis
code/AssetLib/FBX/FBXParser.h
[warning] 67-67: Use the transparent comparator "std::less<>" with this associative string container.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (9)
- GitHub Check: ubuntu-latest-clang++-build-and-test
- GitHub Check: ubuntu-latest-g++-build-and-test
- GitHub Check: macos-latest-clang++-build-and-test
- GitHub Check: windows-hunter-latest-cl.exe-build-and-test
- GitHub Check: windows-latest-clang.exe-build-and-test
- GitHub Check: windows-latest-cl.exe-build-and-test
- GitHub Check: adress-sanitizer
- GitHub Check: undefined-behavior-sanitizer
- GitHub Check: Fuzzing
|
|
Merged, thanks a lot for your contribution. |
|
Happy to help. Thanks for the fast response, and for this project. Question: is there a rough release schedule/cadence documented somewhere? Or a list of remaining work before the next release? I took a look at the DevOps backlog board but couldn't find it. There has been a lot of great work since the previous release. It would be nice to be able to get the latest improvements and fixes via a package manager. That would also help with downstream build automation for library consumers. Thanks again. |
PR #6120 fixed a macro which previously prevented std::unordered_multimap from being used during FBX import when compiled with GCC. This caused FBX::Element properties to be stored in arbitrary order, but the order of connections ("C" properties) in FBX files matters. The main issue I saw was incorrect materials. This changes the type of FBX::ElementMap to always use std::multimap (i.e., ordered). This was the behavior for years under GCC while the broken macro was in use. Unordered containers are still used elsewhere in the FBX importer to benefit from their performance. Co-authored-by: Kim Kulling <[email protected]>
PR assimp#6120 fixed a macro which previously prevented std::unordered_multimap from being used during FBX import when compiled with GCC. This caused FBX::Element properties to be stored in arbitrary order, but the order of connections ("C" properties) in FBX files matters. The main issue I saw was incorrect materials. This changes the type of FBX::ElementMap to always use std::multimap (i.e., ordered). This was the behavior for years under GCC while the broken macro was in use. Unordered containers are still used elsewhere in the FBX importer to benefit from their performance. Co-authored-by: Kim Kulling <[email protected]>

PR #6120 fixed a macro which previously prevented
std::unordered_multimapfrom being used during FBX import when compiled with GCC (50e661a).This caused
FBX::Elementproperties to be stored in arbitrary order, but the order of connections ("C" properties) in FBX files matters.Connections are comparedConnections during retrievalThe main issue I saw was incorrect materials.
This PR changes the type of
FBX::ElementMapto always usestd::multimap(i.e., ordered). This was the behavior for years under GCC while the broken macro was in use. Unordered containers are still used elsewhere in the FBX importer to benefit from their performance.Another way to fix this, for example, is to store the ordering in the
Element. Let me know if you prefer that. I erred on the side of simplicity and history.Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.