From c5d91ecdb67ae13d20c73b19d674807846df20d1 Mon Sep 17 00:00:00 2001 From: 0b5vr <0b5vr@0b5vr.com> Date: Wed, 25 Dec 2024 17:40:27 +0900 Subject: [PATCH] feat: Make it able to load VRMA without specVersion VRMAs exported from UniVRM prior to v0.120 doesn't have specVersion See: https://github.com/vrm-c/UniVRM/pull/2251 Original discussion: https://github.com/pixiv/three-vrm/discussions/1563 --- .../src/VRMAnimationLoaderPlugin.ts | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/packages/three-vrm-animation/src/VRMAnimationLoaderPlugin.ts b/packages/three-vrm-animation/src/VRMAnimationLoaderPlugin.ts index 0eb8a686b..1f40e39b3 100644 --- a/packages/three-vrm-animation/src/VRMAnimationLoaderPlugin.ts +++ b/packages/three-vrm-animation/src/VRMAnimationLoaderPlugin.ts @@ -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);