@threlte/gltf 0.0.5 → 1.0.0-next.0

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
+ ## 1.0.0-next.0
4
+
5
+ ### Major Changes
6
+
7
+ - 3a5376e2: Adapted gltf package to Threlte 6 T syntax
8
+
3
9
  ## 0.0.5
4
10
 
5
11
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@threlte/gltf",
3
- "version": "0.0.5",
3
+ "version": "1.0.0-next.0",
4
4
  "description": "GLTF to Threlte converter",
5
5
  "type": "module",
6
6
  "keywords": [
package/readme.md CHANGED
@@ -58,20 +58,20 @@ Command: npx gltfjsx@0.0.1 ./stacy.glb
58
58
  -->
59
59
  <script>
60
60
  import { Group } from 'three'
61
- import { T, Three } from '@threlte/core'
61
+ import { T } from '@threlte/core'
62
62
  import { useGltf, useGltfAnimations } from '@threlte/extras'
63
63
 
64
64
  export const ref = new Group()
65
65
 
66
- const { gltf } = useGltf('/stacy.glb')
66
+ const gltf = useGltf('/stacy.glb')
67
67
  export const { actions, mixer } = useGltfAnimations(gltf, ref)
68
68
  </script>
69
69
 
70
70
  {#if $gltf}
71
- <Three type={ref} {...$$restProps}>
71
+ <T is={ref} {...$$restProps}>
72
72
  <T.Group name="Scene">
73
73
  <T.Group name="Stacy" rotation={[Math.PI / 2, 0, 0]} scale={0.01}>
74
- <Three type={$gltf.nodes.mixamorigHips} />
74
+ <T is={$gltf.nodes.mixamorigHips} />
75
75
  <T.SkinnedMesh
76
76
  name="stacy"
77
77
  geometry={$gltf.nodes.stacy.geometry}
@@ -84,7 +84,7 @@ Command: npx gltfjsx@0.0.1 ./stacy.glb
84
84
  </T.Group>
85
85
 
86
86
  <slot {ref} />
87
- </Three>
87
+ </T>
88
88
  {/if}
89
89
  ```
90
90
 
@@ -161,7 +161,7 @@ Command: npx gltfjsx@0.0.1 ./stacy.glb -t
161
161
  <script lang="ts">
162
162
  import type * as THREE from 'three'
163
163
  import { Group } from 'three'
164
- import { T, Three, type Props, type Events, type Slots } from '@threlte/core'
164
+ import { T, type Props, type Events, type Slots } from '@threlte/core'
165
165
  import { useGltf, useGltfAnimations } from '@threlte/extras'
166
166
 
167
167
  type $$Props = Props<THREE.Group>
@@ -179,15 +179,15 @@ Command: npx gltfjsx@0.0.1 ./stacy.glb -t
179
179
  materials: {}
180
180
  }
181
181
 
182
- const { gltf } = useGltf<GLTFResult>('/stacy.glb')
182
+ const gltf = useGltf<GLTFResult>('/stacy.glb')
183
183
  export const { actions, mixer } = useGltfAnimations<ActionName>(gltf, ref)
184
184
  </script>
185
185
 
186
186
  {#if $gltf}
187
- <Three type={ref} {...$$restProps}>
187
+ <T is={ref} {...$$restProps}>
188
188
  <T.Group name="Scene">
189
189
  <T.Group name="Stacy" rotation={[Math.PI / 2, 0, 0]} scale={0.01}>
190
- <Three type={$gltf.nodes.mixamorigHips} />
190
+ <T is={$gltf.nodes.mixamorigHips} />
191
191
  <T.SkinnedMesh
192
192
  name="stacy"
193
193
  geometry={$gltf.nodes.stacy.geometry}
@@ -200,7 +200,7 @@ Command: npx gltfjsx@0.0.1 ./stacy.glb -t
200
200
  </T.Group>
201
201
 
202
202
  <slot {ref} />
203
- </Three>
203
+ </T>
204
204
  {/if}
205
205
  ```
206
206
 
@@ -209,7 +209,7 @@ Command: npx gltfjsx@0.0.1 ./stacy.glb -t
209
209
  If your GLTF contains animations it will add [@threlte/extras's `useGltfAnimations`](https://threlte.xyz/extras/use-gltf-animations) hook, which extracts all clips and prepares them as actions:
210
210
 
211
211
  ```svelte
212
- const { gltf } = useGltf('/stacy.glb')
212
+ const gltf = useGltf('/stacy.glb')
213
213
  export const { actions, mixer } = useGltfAnimations(gltf, ref)
214
214
  ```
215
215
 
@@ -374,7 +374,7 @@ function parse(fileName, gltf, options = {}) {
374
374
 
375
375
  // Bail out on lights and bones
376
376
  if (type === 'bone') {
377
- return `<Three type={$gltf.${node}} />\n`
377
+ return `<T is={$gltf.${node}} />\n`
378
378
  }
379
379
 
380
380
  // Collect children
@@ -482,7 +482,7 @@ ${parseExtras(gltf.parser.json.asset && gltf.parser.json.asset.extras)}-->
482
482
 
483
483
  ${options.types ? `\nimport type * as THREE from 'three'` : ''}
484
484
  import { Group } from 'three'
485
- import { ${['T', 'Three', options.types ? 'type Props, type Events, type Slots' : ''].join(
485
+ import { ${['T', options.types ? 'type Props, type Events, type Slots' : ''].join(
486
486
  ', '
487
487
  )} } from '@threlte/core'
488
488
  import { ${['useGltf', hasAnimations ? 'useGltfAnimations' : ''].join(
@@ -497,7 +497,7 @@ ${parseExtras(gltf.parser.json.asset && gltf.parser.json.asset.extras)}-->
497
497
 
498
498
  ${options.types ? printThrelteTypes(objects, animations) : ''}
499
499
 
500
- const { gltf } = useGltf${options.types ? '<GLTFResult>' : ''}('${url}'${
500
+ const gltf = useGltf${options.types ? '<GLTFResult>' : ''}('${url}'${
501
501
  useGltfOptions ? `, ${JSON.stringify(useGltfOptions)}` : ''
502
502
  })
503
503
  ${
@@ -511,13 +511,13 @@ ${parseExtras(gltf.parser.json.asset && gltf.parser.json.asset.extras)}-->
511
511
  </script>
512
512
 
513
513
  {#if $gltf}
514
- <Three type={ref} {...$$restProps}>
514
+ <T is={ref} {...$$restProps}>
515
515
  ${scene}
516
516
 
517
517
  <slot {ref} />
518
- </Three>
519
- {/if}
520
- `
518
+ </T>
519
+ {/if}
520
+ `
521
521
  }
522
522
 
523
523
  export default parse