Skip to content

Commit

Permalink
chore: accept an array of 3D objects, remove unnesessary ref
Browse files Browse the repository at this point in the history
  • Loading branch information
JaimeTorrealba committed Dec 6, 2023
1 parent 7deeb74 commit 9cdf0e0
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/core/misc/useGLTFExporter.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { GLTFExporter } from 'three-stdlib'
import { ref } from 'vue'
import type { AnimationClip, Object3D } from 'three'
import { useLogger } from '@tresjs/core'

Expand All @@ -16,15 +15,14 @@ interface gltfExporterOptions {
}

export async function useGLTFExporter(
object3D: Object3D,
object3D: Object3D | Object3D[],
options?: gltfExporterOptions,
) {
const exporter = new GLTFExporter()
const objectToDownload = ref(object3D)
const name = options?.fileName || object3D.name || 'scene'
const name = options?.fileName || 'scene'

exporter.parse(
objectToDownload.value,
object3D,
(gltf) => {
if (gltf instanceof ArrayBuffer) {
saveArrayBuffer(gltf, `${name}.glb`)
Expand Down

0 comments on commit 9cdf0e0

Please sign in to comment.