Skip to content

Commit 28a503a

Browse files
committed
[ts][pixi] Fixed regression on rendering setup pose before update state (removed internal Ticker). Closes #2539.
1 parent ccac475 commit 28a503a

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

spine-ts/spine-pixi/src/Spine.ts

+5-9
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,7 @@ export class Spine extends Container {
123123
}
124124
/** When `true`, the Spine AnimationState and the Skeleton will be automatically updated using the {@link Ticker.shared} instance. */
125125
public set autoUpdate (value: boolean) {
126-
if (value) {
127-
Ticker.shared.add(this.internalUpdate, this);
128-
this.autoUpdateWarned = false;
129-
} else {
130-
Ticker.shared.remove(this.internalUpdate, this);
131-
}
126+
if (value) this.autoUpdateWarned = false;
132127
this._autoUpdate = value;
133128
}
134129

@@ -171,14 +166,14 @@ export class Spine extends Container {
171166

172167
/** If {@link Spine.autoUpdate} is `false`, this method allows to update the AnimationState and the Skeleton with the given delta. */
173168
public update (deltaSeconds: number): void {
174-
if (this.autoUpdate && !this.autoUpdateWarned) {
169+
if (this._autoUpdate && !this.autoUpdateWarned) {
175170
console.warn("You are calling update on a Spine instance that has autoUpdate set to true. This is probably not what you want.");
176171
this.autoUpdateWarned = true;
177172
}
178-
this.internalUpdate(0, deltaSeconds);
173+
this.internalUpdate(deltaSeconds);
179174
}
180175

181-
protected internalUpdate (_deltaFrame: number, deltaSeconds?: number): void {
176+
protected internalUpdate (deltaSeconds?: number): void {
182177
// Because reasons, pixi uses deltaFrames at 60fps. We ignore the default deltaFrames and use the deltaSeconds from pixi ticker.
183178
const delta = deltaSeconds ?? Ticker.shared.deltaMS / 1000;
184179
this.state.update(delta);
@@ -191,6 +186,7 @@ export class Spine extends Container {
191186

192187
/** Render the meshes based on the current skeleton state, render debug information, then call {@link Container.updateTransform}. */
193188
public override updateTransform (): void {
189+
if (this._autoUpdate) this.internalUpdate();
194190
this.renderMeshes();
195191
this.sortChildren();
196192
this.debug?.renderDebug(this);

0 commit comments

Comments
 (0)