Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 16492ac

Browse files
ChauChau
Chau
authored and
Chau
committed
fix(plugin/gltf): use new symbols for gltf generator
1 parent bc76455 commit 16492ac

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

libs/plugin/src/generators/gltf/files/__fileName__.ts__tmpl__

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@ import type * as THREE from 'three';
99
import { Group<%= threeImports %> } from 'three';
1010
import { extend, type NgtThreeElements, NgtObjectEvents<% if (args) { %>, NgtArgs<% } %> } from 'angular-three';
1111
import { Component, ChangeDetectionStrategy, CUSTOM_ELEMENTS_SCHEMA, input, viewChild, ElementRef, inject, effect<% if (animations.length) { %>, model<% } %> } from '@angular/core';
12-
import { injectGLTF } from 'angular-three-soba/loaders';
12+
import { gltfResource } from 'angular-three-soba/loaders';
1313
import type { GLTF } from 'three-stdlib';<% if (animations.length) { %>
14-
import { injectAnimations, type NgtsAnimationClips, type NgtsAnimationApi } from 'angular-three-soba/misc';<% } %><% if (perspective) { %>
14+
import { animations, type NgtsAnimationClips, type NgtsAnimationApi } from 'angular-three-soba/misc';<% } %><% if (perspective) { %>
1515
import { NgtsPerspectiveCamera } from 'angular-three-soba/cameras';<% } %><% if (orthographic) { %>
1616
import { NgtsOrthographicCamera } from 'angular-three-soba/cameras';<% } %>
1717
<% if (useImportAttribute) { %>
1818
// @ts-expect-error - import .glb/.gltf file
1919
import <%= gltfName %> from '<%= gltfPath %>' with { loader: 'file' };
2020
<% } %>
2121
<% if (preload) { %>
22-
injectGLTF.preload(() => <% if (useImportAttribute) { %><%= gltfName %><% } else { %>'<%= gltfPath %>'<% } %>);
22+
gltfResource.preload(<% if (useImportAttribute) { %><%= gltfName %><% } else { %>'<%= gltfPath %>'<% } %>);
2323
<% } %>
2424
<% if (animations.length) { %>
2525
type ActionName = <% animations.map(clip => "\""+ clip.name + "\"").join(" | ") %>;
@@ -40,7 +40,7 @@ export type <%= gltfResultTypeName %> = GLTF & {
4040
@Component({
4141
selector: '<%= selector %>',
4242
template: `
43-
@if (gltf(); as gltf) {
43+
@if (gltf.value(); as gltf) {
4444
@let nodes = gltf.nodes;
4545
@let materials = gltf.materials;
4646

@@ -69,16 +69,16 @@ export class <%= className %> {
6969

7070
modelRef = viewChild<ElementRef<Group>>('model');
7171

72-
protected gltf = injectGLTF<<%= gltfResultTypeName %>>(() => <% if (useImportAttribute) { %> <%= gltfName %> <% } else { %> '<%= url %>' <% } %><% if (gltfOptions) { %>, <%= gltfOptions %><% } %>);
72+
protected gltf = gltfResource<<%= gltfResultTypeName %>>(() => <% if (useImportAttribute) { %> <%= gltfName %> <% } else { %> '<%= url %>' <% } %><% if (gltfOptions) { %>, <%= gltfOptions %><% } %>);
7373

7474
constructor() {
7575
extend({ Group<%= threeImports %> });
7676

7777
<% if (animations.length) { %>
78-
const animations = injectAnimations(this.gltf, this.modelRef);
78+
const _animations = animations(this.gltf, this.modelRef);
7979
effect(() => {
80-
if (!animations.isReady) return;
81-
this.animations.set(animations);
80+
if (!_animations.isReady) return;
81+
this.animations.set(_animations);
8282
});
8383
<% } %>
8484

0 commit comments

Comments
 (0)