[codex] resolve asset dependencies by virtual path - #3090
[codex] resolve asset dependencies by virtual path#3090cptbtptpbcptdtptp wants to merge 6 commits into
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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 #3090 +/- ##
===========================================
+ Coverage 85.42% 85.57% +0.15%
===========================================
Files 811 811
Lines 94654 94680 +26
Branches 11512 11559 +47
===========================================
+ Hits 80854 81022 +168
+ Misses 13710 13568 -142
Partials 90 90
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
要解决的问题
Galacean 编辑器导出的
project.json中同时记录了资产的virtualPath和真实远端path。其中:virtualPath是资产在项目文件系统中的唯一身份,也是所有资产引用的基准。path只是该资产最终请求时使用的物理地址,可能是经过 hash 处理、没有原始目录结构的 CDN 地址。此前 runtime 在资产进入 Loader 之前就过早地把 virtualPath 替换成了远端 path。这样一来,如果
Assets/UI/Hero.atlas被映射到一个没有目录结构的 CDN 地址,Atlas 中的../Textures/Hero.png就会基于 CDN 地址解析,而不是基于Assets/UI/Hero.atlas解析,最终无法定位到Assets/Textures/Hero.png,也就无法通过project.json找到图片真正的远端地址。同样的问题还影响了:
KHR_texture_basisu纹理的相对路径。getAssetPath:这些流程使用远端 path 作为身份时,两个不同 virtualPath 如果映射到同一个远端地址,会被错误地视为同一个资产。Assets被解析成assets,导致无法命中区分大小写的 virtualPath 映射。根因
Runtime 混用了两套路径语义:
但原有流程在
ResourceManager._loadSingleItem中提前完成了 virtualPath 到 remote path 的转换,后续 Loader、缓存和内容恢复流程只能看到物理地址,因此无法再按照编辑器虚拟文件系统的目录关系解析依赖。修复方案
getAssetPath统一使用 virtualPath 作为逻辑身份。_request等实际请求边界。/。FontFace请求边界使用 remote path,字体资源身份仍保持为 virtualPath。修复后的完整链路为:
验证
pnpm run b:types通过。git diff --check通过。