diff --git a/spine-ts/spine-core/src/AnimationState.ts b/spine-ts/spine-core/src/AnimationState.ts index b19eea2f1..b689ef698 100644 --- a/spine-ts/spine-core/src/AnimationState.ts +++ b/spine-ts/spine-core/src/AnimationState.ts @@ -1139,9 +1139,9 @@ export class EventQueue { this.drainDisabled = true; const listeners = this.animState.listeners; - const objects = this.objects; - for (let i = 0; i < objects.length; i += 2) { + for (let i = 0; i < this.objects.length; i += 2) { + const objects = this.objects; const type = objects[i] as EventType; const entry = objects[i + 1] as TrackEntry; switch (type) { diff --git a/spine-ts/spine-core/src/SkeletonData.ts b/spine-ts/spine-core/src/SkeletonData.ts index 0b2b2c0f6..0aff922f0 100644 --- a/spine-ts/spine-core/src/SkeletonData.ts +++ b/spine-ts/spine-core/src/SkeletonData.ts @@ -32,6 +32,7 @@ import type { BoneData } from "./BoneData.js"; import type { ConstraintData } from "./ConstraintData.js"; import type { EventData } from "./EventData.js"; import type { Skin } from "./Skin.js"; +import { SliderData } from "./SliderData.js"; import type { SlotData } from "./SlotData.js"; /** Stores the setup pose and all of the stateless data for a skeleton. @@ -143,6 +144,19 @@ export class SkeletonData { return null; } + /** Collects animations used by {@link SliderData slider constraints}. + *
+ * Slider animations are designed to be applied by slider constraints rather than on their own. Applications that have a user + * choose an animation may want to exclude them. */ + findSliderAnimations (animations: Animation[]): Animation[] { + const constraints = this.constraints; + for (let i = 0, n = this.constraints.length; i < n; i++) { + const data = constraints[i]; + if (data instanceof SliderData && data.animation != null) animations.push(data.animation); + } + return animations; + } + /** Finds an animation by comparing each animation's name. It is more efficient to cache the results of this method than to * call it multiple times. * @returns May be null. */