@threlte/gltf 3.0.0-next.6 → 3.0.0-next.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/package.json +1 -1
- package/src/utils/parser.js +6 -2
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
package/src/utils/parser.js
CHANGED
|
@@ -472,6 +472,7 @@ function parse(fileName, gltf, options = {}) {
|
|
|
472
472
|
|
|
473
473
|
const imports = `
|
|
474
474
|
${options.types ? `\nimport type * as THREE from 'three'` : ''}
|
|
475
|
+
${hasAnimations ? `import { Group } from 'three'` : ''}
|
|
475
476
|
${options.types ? `import type { Snippet } from 'svelte'` : ''}
|
|
476
477
|
import { ${['T', options.types && !options.isolated ? 'type Props' : '']
|
|
477
478
|
.filter(Boolean)
|
|
@@ -546,9 +547,12 @@ ${
|
|
|
546
547
|
|
|
547
548
|
${!options.preload && options.suspense ? 'const suspend = useSuspense()' : ''}
|
|
548
549
|
|
|
550
|
+
${hasAnimations && options.isolated ? 'const ref = new Group()' : hasAnimations ? 'ref = new Group()' : ''}
|
|
551
|
+
|
|
549
552
|
${options.types && !options.preload ? printThrelteTypes(objects, animations) : ''}
|
|
550
553
|
|
|
551
554
|
${!options.preload ? `const gltf = ${useGltf}` : 'const gltf = load()'}
|
|
555
|
+
|
|
552
556
|
${
|
|
553
557
|
hasAnimations
|
|
554
558
|
? `export const { actions, mixer } = useGltfAnimations${
|
|
@@ -558,7 +562,7 @@ ${
|
|
|
558
562
|
}
|
|
559
563
|
</script>
|
|
560
564
|
|
|
561
|
-
|
|
565
|
+
<${hasAnimations ? 'T is={ref}' : 'T.Group'} ${!hasAnimations && !options.isolated ? 'bind:ref' : ''} dispose={false} ${!options.isolated ? '{...props}' : ''}>
|
|
562
566
|
{#await gltf}
|
|
563
567
|
{@render fallback?.()}
|
|
564
568
|
{:then gltf}
|
|
@@ -568,7 +572,7 @@ ${
|
|
|
568
572
|
{/await}
|
|
569
573
|
|
|
570
574
|
{@render children?.(${options.isolated ? '' : '{ ref }'})}
|
|
571
|
-
|
|
575
|
+
</${hasAnimations ? 'T' : 'T.Group'}>
|
|
572
576
|
`
|
|
573
577
|
}
|
|
574
578
|
|