[ts][pixi-v8] Removed useless warning about update invocation with autoUpdate.

This commit is contained in:
Davide Tantillo 2024-11-13 10:17:14 +01:00
parent fb3855ad65
commit 814f0ae8fd
2 changed files with 9 additions and 17 deletions

View File

@ -213,7 +213,6 @@ export class Spine extends ViewContainer {
this._debug = value; this._debug = value;
} }
private autoUpdateWarned = false;
private _autoUpdate = true; private _autoUpdate = true;
public get autoUpdate (): boolean { public get autoUpdate (): boolean {
@ -223,9 +222,7 @@ export class Spine extends ViewContainer {
public set autoUpdate (value: boolean) { public set autoUpdate (value: boolean) {
if (value) { if (value) {
Ticker.shared.add(this.internalUpdate, this); Ticker.shared.add(this.internalUpdate, this);
this.autoUpdateWarned = false; } else {
}
else {
Ticker.shared.remove(this.internalUpdate, this); Ticker.shared.remove(this.internalUpdate, this);
} }
@ -262,11 +259,6 @@ export class Spine extends ViewContainer {
/** If {@link Spine.autoUpdate} is `false`, this method allows to update the AnimationState and the Skeleton with the given delta. */ /** If {@link Spine.autoUpdate} is `false`, this method allows to update the AnimationState and the Skeleton with the given delta. */
public update (dt: number): void { public update (dt: number): void {
if (this.autoUpdate && !this.autoUpdateWarned) {
console.warn('You are calling update on a Spine instance that has autoUpdate set to true. This is probably not what you want.');
this.autoUpdateWarned = true;
}
this.internalUpdate(0, dt); this.internalUpdate(0, dt);
} }

View File

@ -40,7 +40,7 @@ import { BatchableSpineSlot } from './BatchableSpineSlot';
import { Spine } from './Spine'; import { Spine } from './Spine';
import { MeshAttachment, RegionAttachment } from '@esotericsoftware/spine-core'; import { MeshAttachment, RegionAttachment } from '@esotericsoftware/spine-core';
const spineBlendModeMap : Record<number, BLEND_MODES> = { const spineBlendModeMap: Record<number, BLEND_MODES> = {
0: 'normal', 0: 'normal',
1: 'add', 1: 'add',
2: 'multiply', 2: 'multiply',
@ -183,15 +183,15 @@ export class SpinePipe implements RenderPipe<Spine> {
this.renderer = null as any; this.renderer = null as any;
} }
private _getSpineData(spine: Spine): GpuSpineDataElement { private _getSpineData (spine: Spine): GpuSpineDataElement {
return this.gpuSpineData[spine.uid] || this._initMeshData(spine); return this.gpuSpineData[spine.uid] || this._initMeshData(spine);
} }
private _initMeshData(spine: Spine): GpuSpineDataElement { private _initMeshData (spine: Spine): GpuSpineDataElement {
this.gpuSpineData[spine.uid] = { slotBatches: { } }; this.gpuSpineData[spine.uid] = { slotBatches: {} };
spine.on('destroyed', this._destroyRenderableBound); spine.on('destroyed', this._destroyRenderableBound);
return this.gpuSpineData[spine.uid]; return this.gpuSpineData[spine.uid];
} }
} }
extensions.add(SpinePipe); extensions.add(SpinePipe);