Skip to content

Commit

Permalink
Models: add before-load event
Browse files Browse the repository at this point in the history
  • Loading branch information
schelmo committed Nov 26, 2021
1 parent f109069 commit 07064c3
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/models/FBX.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions src/models/GLTF.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/models/Model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
},
Expand Down

0 comments on commit 07064c3

Please sign in to comment.