Skip to content

Commit

Permalink
feat: Make it able to load VRMA without specVersion
Browse files Browse the repository at this point in the history
VRMAs exported from UniVRM prior to v0.120 doesn't have specVersion

See: vrm-c/UniVRM#2251

Original discussion: #1563
  • Loading branch information
0b5vr committed Dec 25, 2024
1 parent 9ce14ae commit c5d91ec
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions packages/three-vrm-animation/src/VRMAnimationLoaderPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,20 @@ export class VRMAnimationLoaderPlugin implements GLTFLoaderPlugin {
}

const specVersion = defExtension.specVersion;
if (!POSSIBLE_SPEC_VERSIONS.has(specVersion)) {
console.warn(`VRMAnimationLoaderPlugin: Unknown VRMC_vrm_animation spec version: ${specVersion}`);
return;
}
if (specVersion === '1.0-draft') {
if (specVersion == null) {
console.warn(
'VRMAnimationLoaderPlugin: Using a draft spec version: 1.0-draft. Some behaviors may be different. Consider updating the animation file.',
'VRMAnimationLoaderPlugin: specVersion of the VRMA is not defined. Consider updating the animation file. Assuming the spec version is 1.0.',
);
} else {
if (!POSSIBLE_SPEC_VERSIONS.has(specVersion)) {
console.warn(`VRMAnimationLoaderPlugin: Unknown VRMC_vrm_animation spec version: ${specVersion}`);
return;
}
if (specVersion === '1.0-draft') {
console.warn(
'VRMAnimationLoaderPlugin: Using a draft spec version: 1.0-draft. Some behaviors may be different. Consider updating the animation file.',
);
}
}

const nodeMap = this._createNodeMap(defExtension);
Expand Down

0 comments on commit c5d91ec

Please sign in to comment.