@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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @threlte/gltf
2
2
 
3
+ ## 3.0.0-next.7
4
+
5
+ ### Patch Changes
6
+
7
+ - 946e7a8: fix parser for animated assets
8
+
3
9
  ## 3.0.0-next.6
4
10
 
5
11
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@threlte/gltf",
3
- "version": "3.0.0-next.6",
3
+ "version": "3.0.0-next.7",
4
4
  "description": "GLTF to Threlte converter",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -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
- <T.Group ${options.isolated ? '' : 'bind:ref'} dispose={false} ${!options.isolated ? '{...props}' : ''}>
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
- </T.Group>
575
+ </${hasAnimations ? 'T' : 'T.Group'}>
572
576
  `
573
577
  }
574
578