Closed SavAct closed 2 days ago
Sorry for the late response. The pmx loader has nothing to do with the runtime, so using a different runtime instance type doesn't change the logic of loading. It sounds like the issue is related to the CORS policy.
I've tried, but I can't reproduce the issue. It seems like there are probably other factors involved.
No problem, I really appreciate your work and time you put into this project.
I finally managed to narrow down the problem. It wasn't the change from MPR to SPR; it was the change in the import path. Since babylon-mmd version 0.54.0, whenever you import anything from babylon-mmd
or babylon-mmd/esm
, it won't load textures anymore, when dropping pmx files. That is not the case on previouse versions or with other files.
You have to specify the complete path to each class, like:
babylon-mmd/esm/Loader/vmdLoader
or
babylon-mmd/esm/Runtime/Optimized/InstanceType/singlePhysicsRelease
You can reproduce that with the Viewer template by changing
import { MmdWasmInstanceTypeMPR } from "babylon-mmd/esm/Runtime/Optimized/InstanceType/singlePhysicsRelease";
to
import { MmdWasmInstanceTypeMPR } from "babylon-mmd";
and update babylon-mmd to version 0.54.0 or newer.
I never expected this, since VS Code directs you to the same library files in all cases.
I think 0.54.0 will definitely have that type of issue. https://github.com/noname0310/babylon-mmd/releases/tag/v0.54.0
Starting with version 0.54.0, I changed the loader module load mechanism.
I've seen it reproduced and am working on fixing it now. I'll keep this issue updated with any new updates, thank you.
After analyzing the issue, it looks more like a broken backwards compatibility than a bug.
Since version 0.54.0, you need to use the new loader parameter method to pass referenceFiles
.
You can see an example of using pluginOptions
to pass load parameters here. Use this code to guide your migration
https://github.com/noname0310/babylon-mmd/blob/main/src/Test/Scene/pmxConverterScene.ts#L138-L156
SceneLoader.GetPluginForExtension
should not be used.
The behavior itself would have been very confusing. I'm sorry about that.
If applying this migration resolved your issue, please close the issue. If you have additional questions about how to migrate, please let me know.
Thanks for the help. I will try to migrate the viewer template, because my project has the same structure.
Changing
MmdWasmInstanceTypeMPR
toMmdWasmInstanceTypeSPR
allows most files to load correctly, except for one scenario: When the user drops a folder, containing a PMX file with its reference files. The textures either fail to load or the loading process breaks. This occurs regardless of whetherSceneLoader.LoadAssetContainerAsync
orSceneLoader.ImportMeshAsync
is used.The foreground shows a model demonstrating the texture loading issue, while the background shows a properly loaded PMX model (behind a button) that was accessed via URL.