From 648e038d60a8f0d8c15dc8d62b81bcc22a320aeb Mon Sep 17 00:00:00 2001 From: luzhuang <364439895@qq.com> Date: Wed, 1 Sep 2021 19:17:07 +0800 Subject: [PATCH 1/2] fix: bugfix --- packages/loader/src/scene-loader/resources/GLTFResource.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/loader/src/scene-loader/resources/GLTFResource.ts b/packages/loader/src/scene-loader/resources/GLTFResource.ts index d77417b577..04334b13a3 100644 --- a/packages/loader/src/scene-loader/resources/GLTFResource.ts +++ b/packages/loader/src/scene-loader/resources/GLTFResource.ts @@ -113,7 +113,7 @@ export class GLTFResource extends SchemaResource { newMaterial.push(matStructure); }); }); - const loadAttachedController = animatorControllerLoadPromise.then((res) => { + const loadAttachedController = animatorControllerLoadPromise ? animatorControllerLoadPromise.then((res) => { const { animatorControllers } = result.structure.props; const controllerStructure = res.structure; const controllerResource = res.resources[controllerStructure.index]; @@ -129,7 +129,7 @@ export class GLTFResource extends SchemaResource { } } animatorControllers.push(controllerStructure); - }); + }) : Promise.resolve(); Promise.all([loadAttachedMaterial, loadAttachedController]).then(() => { resolve(result); }); From 01ee45ed71a5bdba393f7e9cac9cd19761a7a13d Mon Sep 17 00:00:00 2001 From: luzhuang <364439895@qq.com> Date: Thu, 2 Sep 2021 16:13:54 +0800 Subject: [PATCH 2/2] fix: bug fix --- .../src/scene-loader/resources/AnimatorControllerResource.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/loader/src/scene-loader/resources/AnimatorControllerResource.ts b/packages/loader/src/scene-loader/resources/AnimatorControllerResource.ts index 1eb8b6e0c4..cb39e3765f 100644 --- a/packages/loader/src/scene-loader/resources/AnimatorControllerResource.ts +++ b/packages/loader/src/scene-loader/resources/AnimatorControllerResource.ts @@ -98,8 +98,9 @@ export class AnimatorControllerResource extends SchemaResource { } _initAnimatorController(animatorControllerData) { - const { animations } = this.gltf; + const { animations } = this.gltf || {}; const { layers } = animatorControllerData; + if (!animations || !layers) return; this._resource.clearLayers(); for (let i = 0, length = layers.length; i < length; ++i) { const { name, blending, weight, stateMachine: stateMachineData } = layers[i];