From 07064c32a34dcc18425482058be693d78480cc27 Mon Sep 17 00:00:00 2001 From: Georg Nagel Date: Fri, 26 Nov 2021 11:20:29 +0100 Subject: [PATCH] Models: add before-load event --- src/models/FBX.ts | 1 + src/models/GLTF.ts | 1 + src/models/Model.ts | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/models/FBX.ts b/src/models/FBX.ts index 80f2f0f..2886940 100644 --- a/src/models/FBX.ts +++ b/src/models/FBX.ts @@ -6,6 +6,7 @@ export default defineComponent({ extends: Model, created() { const loader = new FBXLoader() + this.$emit('before-load', loader) loader.load(this.src, (fbx) => { this.onLoad(fbx) }, this.onProgress, this.onError) diff --git a/src/models/GLTF.ts b/src/models/GLTF.ts index 915f160..dde37cc 100644 --- a/src/models/GLTF.ts +++ b/src/models/GLTF.ts @@ -6,6 +6,7 @@ export default defineComponent({ extends: Model, created() { const loader = new GLTFLoader() + this.$emit('before-load', loader) loader.load(this.src, (gltf) => { this.onLoad(gltf.scene) }, this.onProgress, this.onError) diff --git a/src/models/Model.ts b/src/models/Model.ts index d3af39d..a37dfa3 100644 --- a/src/models/Model.ts +++ b/src/models/Model.ts @@ -4,7 +4,7 @@ import Object3D from '../core/Object3D' export default defineComponent({ extends: Object3D, - emits: ['load', 'progress', 'error'], + emits: ['load', 'progress', 'error', 'before-load'], props: { src: { type: String, required: true }, },