fix(loader): always create GLTF_ROOT container for consistent animation paths#2943
Conversation
…on paths (galacean#2942) Remove single-root vs multi-root branching in GLTFSceneParser, always creating a GLTF_ROOT wrapper entity. This ensures animation bone paths are consistent across different glTF files, fixing cross-file animation clip retargeting.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
WalkthroughThe GLTFSceneParser now always creates a "GLTF_ROOT" container entity and attaches all scene nodes as its children; tests and e2e code were updated to account for the added container level and to verify the new defaultSceneRoot structure. Changes
Sequence Diagram(s)sequenceDiagram
participant Parser as GLTFSceneParser
participant Context as GLTFParserContext
participant Root as "Entity\n(GLTF_ROOT)" rect rgba(100,150,250,0.5)
participant Node as "Entity\n(scene node)" rect rgba(150,200,150,0.5)
participant Animator as Animator
Parser->>Context: parse sceneNodes[]
Parser->>Root: new Entity("GLTF_ROOT") / _markAsTemplate(glTFResource)
loop for each sceneNode
Parser->>Context: context.get(Entity, sceneNode)
Context-->>Node: return Entity for node
Root->>Node: addChild(node)
end
Note right of Root: defaultSceneRoot -> GLTF_ROOT
Animator->>Root: findByPath("skeletonRoot/...")
Root-->>Animator: resolve child paths (consistent since skeleton root included)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev/2.0 #2943 +/- ##
===========================================
+ Coverage 77.07% 77.26% +0.18%
===========================================
Files 899 899
Lines 98229 98292 +63
Branches 9683 9682 -1
===========================================
+ Hits 75706 75941 +235
+ Misses 22355 22184 -171
+ Partials 168 167 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
🤖 Augment PR SummarySummary: Always wrap parsed glTF scenes in a 🤖 Was this summary useful? React with 👍 or 👎 |
- animator-blendShape: use getComponentsIncludeChildren to find SkinnedMeshRenderer on child entity - animator-multiSubMeshBlendShape: place Animator on actual model root (children[0]) so curve bindings with empty path resolve correctly
Summary
Fixes #2942
GLTFSceneParser, always creating aGLTF_ROOTwrapper entityBreaking Change
Single-root glTF files now have one extra nesting level (
GLTF_ROOT→ original root). Code that references entities by path or index frominstantiateSceneRoot()may need adjustment.Test plan
GLTF_ROOTcontainerSummary by CodeRabbit
Refactor
Tests