diff --git a/generate-bindings.sh b/generate-bindings.sh index d61ed7cbd..4bfe04f66 100755 --- a/generate-bindings.sh +++ b/generate-bindings.sh @@ -6,6 +6,7 @@ # Get the directory containing this script SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +rm -rf "$SCRIPT_DIR/spine-c/codegen/spine-cpp-types.json" rm -rf "$SCRIPT_DIR/spine-c/codegen/node_modules" rm -rf "$SCRIPT_DIR/spine-flutter/codegen/node_modules" rm -rf "$SCRIPT_DIR/spine-ios/codegen/node_modules" diff --git a/spine-c/codegen/src/type-extractor.ts b/spine-c/codegen/src/type-extractor.ts index 2bc46f919..7b50556f4 100644 --- a/spine-c/codegen/src/type-extractor.ts +++ b/spine-c/codegen/src/type-extractor.ts @@ -122,12 +122,26 @@ function extractTextFromParagraph(paragraphNode: any): string { for (const inner of paragraphNode.inner || []) { if (inner.kind === 'TextComment' && inner.text) { - texts.push(inner.text.trim()); + // Clean up any stray comment markers that might have been included + let text = inner.text.trim(); + // Remove trailing */ if present + text = text.replace(/\*\/\s*$/, '').trim(); + // Remove leading /* if present + text = text.replace(/^\/\*\s*/, '').trim(); + if (text) { + texts.push(text); + } } else if (inner.kind === 'InlineCommandComment' && inner.inner) { // Handle inline commands like \c (code) or \b (bold) for (const textNode of inner.inner) { if (textNode.kind === 'TextComment' && textNode.text) { - texts.push(textNode.text.trim()); + let text = textNode.text.trim(); + // Clean up comment markers here too + text = text.replace(/\*\/\s*$/, '').trim(); + text = text.replace(/^\/\*\s*/, '').trim(); + if (text) { + texts.push(text); + } } } } diff --git a/spine-c/src/generated/animation_state.h b/spine-c/src/generated/animation_state.h index 8cca66a69..53fe63296 100644 --- a/spine-c/src/generated/animation_state.h +++ b/spine-c/src/generated/animation_state.h @@ -112,10 +112,10 @@ SPINE_C_API spine_track_entry spine_animation_state_set_empty_animation(spine_an * TrackEntry::getMixDuration(). If the track has no entries, it is equivalent * to calling setEmptyAnimation(int, float). * - * See setEmptyAnimation(int, float) and Empty animations in the Spine Runtimes + * See setEmptyAnimation(int, float) and Empty animations in the Spine Runtimes * Guide. * - * @param delay If > 0, sets TrackEntry::getDelay(). If < = 0, the delay set is the duration of the previous track entry minus any mix duration plus the specified delay (ie the mix ends at ( delay = 0) or before ( delay < 0) the previous track entry duration). If the previous entry is looping, its next loop completion is used instead of its duration. + * @param delay If > 0, sets TrackEntry::getDelay(). If < = 0, the delay set is the duration of the previous track entry minus any mix duration plus the specified delay (ie the mix ends at ( delay = 0) or before ( delay < 0) the previous track entry duration). If the previous entry is looping, its next loop completion is used instead of its duration. * * @return A track entry to allow further customization of animation playback. References to the track entry must not be kept after the AnimationStateListener::dispose(TrackEntry) event occurs. */ diff --git a/spine-c/src/generated/track_entry.h b/spine-c/src/generated/track_entry.h index a3d82f86e..38e6804f3 100644 --- a/spine-c/src/generated/track_entry.h +++ b/spine-c/src/generated/track_entry.h @@ -175,8 +175,9 @@ SPINE_C_API void spine_track_entry_set_mix_attachment_threshold(spine_track_entr /** * When getAlpha() is greater than alphaAttachmentThreshold, attachment * timelines are applied. Defaults to 0, so attachment timelines are always - * applied. */ -* / SPINE_C_API float spine_track_entry_get_alpha_attachment_threshold(spine_track_entry self); + * applied. + */ +SPINE_C_API float spine_track_entry_get_alpha_attachment_threshold(spine_track_entry self); SPINE_C_API void spine_track_entry_set_alpha_attachment_threshold(spine_track_entry self, float inValue); /** * When the mix percentage (mix time / mix duration) is less than the draw order diff --git a/spine-flutter/codegen/src/dart-writer.ts b/spine-flutter/codegen/src/dart-writer.ts index 9ed06a9fa..6aa482bd8 100644 --- a/spine-flutter/codegen/src/dart-writer.ts +++ b/spine-flutter/codegen/src/dart-writer.ts @@ -2,6 +2,7 @@ import * as fs from 'node:fs'; import * as path from 'node:path'; import { fileURLToPath } from 'node:url'; import type { CClassOrStruct, CEnum, CMethod, CParameter } from '../../../spine-c/codegen/src/c-types.js'; +import type { DocumentationComment } from '../../../spine-c/codegen/src/types.js'; import { toSnakeCase } from '../../../spine-c/codegen/src/types.js'; const __dirname = path.dirname(fileURLToPath(import.meta.url)); @@ -38,6 +39,7 @@ interface DartClass { members: DartMember[]; // All class members hasRtti: boolean; // Whether this class needs RTTI switching needsPackageFfi: boolean; // Whether to import package:ffi + documentation?: DocumentationComment; // Class-level documentation from C++ source } interface DartMember { @@ -48,6 +50,7 @@ interface DartMember { isOverride: boolean; // Whether to add @override implementation: string; // The actual Dart code body cMethodName?: string; // Original C method name (for reference) + documentation?: DocumentationComment; // Documentation from C++ source } interface DartParameter { @@ -225,7 +228,8 @@ export class DartWriter { imports: this.collectImports(cType), members: this.processMembers(cType, classType), hasRtti: this.hasRttiMethod(cType), - needsPackageFfi: this.needsStringConversions(cType) + needsPackageFfi: this.needsStringConversions(cType), + documentation: cType.cppType?.documentation }; } @@ -348,7 +352,8 @@ export class DartWriter { parameters: [], isOverride: false, implementation, - cMethodName: destructor.name + cMethodName: destructor.name, + documentation: destructor.documentation }; } @@ -371,7 +376,8 @@ export class DartWriter { parameters: params, isOverride: false, implementation, - cMethodName: constr.name + cMethodName: constr.name, + documentation: constr.documentation }; } @@ -396,7 +402,8 @@ export class DartWriter { parameters: [], isOverride, implementation, - cMethodName: method.name + cMethodName: method.name, + documentation: method.documentation }; } @@ -434,7 +441,8 @@ export class DartWriter { parameters: [dartParam], isOverride, implementation, - cMethodName: method.name + cMethodName: method.name, + documentation: method.documentation }; } @@ -486,7 +494,8 @@ export class DartWriter { parameters: params, isOverride, implementation, - cMethodName: method.name + cMethodName: method.name, + documentation: method.documentation }; } @@ -550,8 +559,11 @@ export class DartWriter { declaration += ` implements ${implementsClasses.join(', ')}`; } + // Generate class documentation + const docComment = this.formatClassDocumentation(dartClass.documentation, dartClass.name); + return ` -/// ${dartClass.name} wrapper +${docComment} ${declaration} {`; } @@ -640,17 +652,18 @@ ${declaration} {`; // Member generation (from spec) private generateMember (member: DartMember): string { const override = member.isOverride ? '@override\n ' : ' '; + const docComment = this.formatDartDocumentation(member.documentation, member); switch (member.type) { case 'constructor': return this.generateConstructorMember(member); case 'getter': - return `${override}${member.dartReturnType} get ${member.name} { + return `${docComment}${override}${member.dartReturnType} get ${member.name} { ${member.implementation} }`; case 'setter': { const param = member.parameters[0]; - return `${override}set ${member.name}(${param.dartType} ${param.name}) { + return `${docComment}${override}set ${member.name}(${param.dartType} ${param.name}) { ${member.implementation} }`; } @@ -658,7 +671,7 @@ ${declaration} {`; case 'static_method': { const params = member.parameters.map(p => `${p.dartType} ${p.name}`).join(', '); const static_ = member.type === 'static_method' ? 'static ' : ''; - return `${override}${static_}${member.dartReturnType} ${member.name}(${params}) { + return `${docComment}${override}${static_}${member.dartReturnType} ${member.name}(${params}) { ${member.implementation} }`; } @@ -670,12 +683,151 @@ ${declaration} {`; private generateConstructorMember (member: DartMember): string { const params = member.parameters.map(p => `${p.dartType} ${p.name}`).join(', '); const factoryName = member.name === member.dartReturnType ? '' : `.${member.name}`; + const docComment = this.formatDartDocumentation(member.documentation, member); - return ` factory ${member.dartReturnType}${factoryName}(${params}) { + return `${docComment} factory ${member.dartReturnType}${factoryName}(${params}) { ${member.implementation} }`; } + private formatClassDocumentation(doc: DocumentationComment | undefined, className: string): string { + if (!doc) { + // Default documentation if none exists + return `/// ${className} wrapper`; + } + + const lines: string[] = []; + + // Add summary + if (doc.summary) { + this.wrapDocText(doc.summary, lines, '/// '); + } else { + // Fallback to default if no summary + lines.push(`/// ${className} wrapper`); + } + + // Add details if present + if (doc.details) { + lines.push('///'); + this.wrapDocText(doc.details, lines, '/// '); + } + + // Add deprecation notice + if (doc.deprecated) { + if (lines.length > 0) lines.push('///'); + lines.push(`/// @deprecated ${doc.deprecated}`); + } + + // Add since version + if (doc.since) { + if (lines.length > 0) lines.push('///'); + lines.push(`/// @since ${doc.since}`); + } + + // Add see also references + if (doc.see && doc.see.length > 0) { + if (lines.length > 0) lines.push('///'); + for (const ref of doc.see) { + lines.push(`/// See also: ${ref}`); + } + } + + if (lines.length > 0) { + return lines.join('\n'); + } + return `/// ${className} wrapper`; + } + + private formatDartDocumentation(doc: DocumentationComment | undefined, member: DartMember): string { + if (!doc) return ''; + + const lines: string[] = []; + + // Add summary + if (doc.summary) { + this.wrapDocText(doc.summary, lines, ' /// '); + } + + // Add details if present + if (doc.details) { + if (doc.summary) { + lines.push(' ///'); + } + this.wrapDocText(doc.details, lines, ' /// '); + } + + // Add parameter documentation (skip 'self' and 'value' for setters) + if (doc.params && Object.keys(doc.params).length > 0) { + const hasContent = doc.summary || doc.details; + if (hasContent) lines.push(' ///'); + + for (const [paramName, paramDesc] of Object.entries(doc.params)) { + // Skip 'self' parameter documentation as it's implicit + if (paramName === 'self' || paramName === 'this') continue; + // For setters, map the parameter documentation to 'value' + if (member.type === 'setter' && member.parameters[0]) { + lines.push(` /// [value] ${paramDesc}`); + } else { + // Check if this parameter exists in the member + const paramExists = member.parameters.some(p => p.name === paramName); + if (paramExists) { + lines.push(` /// [${paramName}] ${paramDesc}`); + } + } + } + } + + // Add return documentation (not for setters or constructors) + if (doc.returns && member.type !== 'setter' && member.type !== 'constructor') { + if (lines.length > 0) lines.push(' ///'); + lines.push(` /// Returns ${doc.returns}`); + } + + // Add deprecation notice + if (doc.deprecated) { + if (lines.length > 0) lines.push(' ///'); + lines.push(` /// @deprecated ${doc.deprecated}`); + } + + if (lines.length > 0) { + return lines.join('\n') + '\n'; + } + return ''; + } + + private wrapDocText(text: string, lines: string[], prefix: string): void { + const maxLineLength = 80; + const maxTextLength = maxLineLength - prefix.length; + + // Split text into paragraphs + const paragraphs = text.split('\n\n'); + + for (let i = 0; i < paragraphs.length; i++) { + if (i > 0) { + lines.push(prefix.trim()); + } + + const paragraph = paragraphs[i].replace(/\n/g, ' '); + const words = paragraph.split(' '); + let currentLine = ''; + + for (const word of words) { + if (currentLine.length === 0) { + currentLine = word; + } else if (currentLine.length + word.length + 1 <= maxTextLength) { + currentLine += ' ' + word; + } else { + lines.push(prefix + currentLine); + currentLine = word; + } + } + + if (currentLine.length > 0) { + lines.push(prefix + currentLine); + } + } + } + private generateEnumCode (dartEnum: DartEnum): string { const lines: string[] = []; diff --git a/spine-flutter/lib/assets/libspine_flutter.wasm b/spine-flutter/lib/assets/libspine_flutter.wasm index c6b8f9819..59e5c58e2 100755 Binary files a/spine-flutter/lib/assets/libspine_flutter.wasm and b/spine-flutter/lib/assets/libspine_flutter.wasm differ diff --git a/spine-flutter/lib/generated/animation.dart b/spine-flutter/lib/generated/animation.dart index c9195170a..83d7b8774 100644 --- a/spine-flutter/lib/generated/animation.dart +++ b/spine-flutter/lib/generated/animation.dart @@ -38,7 +38,7 @@ import 'mix_blend.dart'; import 'mix_direction.dart'; import 'skeleton.dart'; -/// Animation wrapper +/// Stores a list of timelines to animate a skeleton's pose over time. class Animation { final Pointer _ptr; @@ -57,6 +57,8 @@ class Animation { SpineBindings.bindings.spine_animation_dispose(_ptr); } + /// If the returned array or the timelines it contains are modified, + /// setTimelines() must be called. ArrayTimeline get timelines { final result = SpineBindings.bindings.spine_animation_get_timelines(_ptr); return ArrayTimeline.fromPointer(result); @@ -66,11 +68,16 @@ class Animation { SpineBindings.bindings.spine_animation_set_timelines(_ptr, value.nativePtr.cast()); } + /// Returns true if this animation contains a timeline with any of the + /// specified property IDs. bool hasTimeline(ArrayPropertyId ids) { final result = SpineBindings.bindings.spine_animation_has_timeline(_ptr, ids.nativePtr.cast()); return result; } + /// The duration of the animation in seconds, which is usually the highest + /// time of all frames in the timeline. The duration is used to know when it + /// has completed and when it should loop back to the start. double get duration { final result = SpineBindings.bindings.spine_animation_get_duration(_ptr); return result; @@ -80,22 +87,38 @@ class Animation { SpineBindings.bindings.spine_animation_set_duration(_ptr, value); } + /// Applies the animation's timelines to the specified skeleton. + /// + /// See Timeline::apply(). + /// + /// [skeleton] The skeleton the animation is being applied to. This provides access to the bones, slots, and other skeleton components the timelines may change. + /// [lastTime] The last time in seconds this animation was applied. Some timelines trigger only at specific times rather than every frame. Pass -1 the first time an animation is applied to ensure frame 0 is triggered. + /// [time] The time in seconds the skeleton is being posed for. Most timelines find the frame before and the frame after this time and interpolate between the frame values. If beyond the getDuration() and loop is true then the animation will repeat, else the last frame will be applied. + /// [loop] If true, the animation repeats after the getDuration(). + /// [events] If any events are fired, they are added to this list. Can be null to ignore fired events or if no timelines fire events. + /// [alpha] 0 applies the current or setup values (depending on blend). 1 applies the timeline values. Between 0 and 1 applies values between the current or setup values and the timeline values. By adjusting alpha over time, an animation can be mixed in or out. alpha can also be useful to apply animations on top of each other (layering). + /// [blend] Controls how mixing is applied when alpha < 1. + /// [direction] Indicates whether the timelines are mixing in or out. Used by timelines which perform instant transitions, such as DrawOrderTimeline or AttachmentTimeline. void apply(Skeleton skeleton, double lastTime, double time, bool loop, ArrayEvent? events, double alpha, MixBlend blend, MixDirection direction, bool appliedPose) { SpineBindings.bindings.spine_animation_apply(_ptr, skeleton.nativePtr.cast(), lastTime, time, loop, events?.nativePtr.cast() ?? Pointer.fromAddress(0), alpha, blend.value, direction.value, appliedPose); } + /// The animation's name, which is unique across all animations in the + /// skeleton. String get name { final result = SpineBindings.bindings.spine_animation_get_name(_ptr); return result.cast().toDartString(); } + /// The bone indices affected by this animation. ArrayInt get bones { final result = SpineBindings.bindings.spine_animation_get_bones(_ptr); return ArrayInt.fromPointer(result); } + /// [target] After the first and before the last entry. static int search(ArrayFloat values, double target) { final result = SpineBindings.bindings.spine_animation_search_1(values.nativePtr.cast(), target); return result; diff --git a/spine-flutter/lib/generated/animation_state.dart b/spine-flutter/lib/generated/animation_state.dart index f2034f3ce..37a516483 100644 --- a/spine-flutter/lib/generated/animation_state.dart +++ b/spine-flutter/lib/generated/animation_state.dart @@ -57,53 +57,118 @@ class AnimationState { SpineBindings.bindings.spine_animation_state_dispose(_ptr); } + /// Increments each track entry TrackEntry::getTrackTime(), setting queued + /// animations as current if needed. void update(double delta) { SpineBindings.bindings.spine_animation_state_update(_ptr, delta); } + /// Poses the skeleton using the track entry animations. The animation state + /// is not changed, so can be applied to multiple skeletons to pose them + /// identically. + /// + /// Returns True if any animations were applied. bool apply(Skeleton skeleton) { final result = SpineBindings.bindings.spine_animation_state_apply(_ptr, skeleton.nativePtr.cast()); return result; } + /// Removes all animations from all tracks, leaving skeletons in their current + /// pose. + /// + /// It may be desired to use AnimationState::setEmptyAnimations(float) to mix + /// the skeletons back to the setup pose, rather than leaving them in their + /// current pose. void clearTracks() { SpineBindings.bindings.spine_animation_state_clear_tracks(_ptr); } + /// Removes all animations from the track, leaving skeletons in their current + /// pose. + /// + /// It may be desired to use AnimationState::setEmptyAnimation(int, float) to + /// mix the skeletons back to the setup pose, rather than leaving them in + /// their current pose. void clearTrack(int trackIndex) { SpineBindings.bindings.spine_animation_state_clear_track(_ptr, trackIndex); } + /// Sets an empty animation for a track, discarding any queued animations, and + /// sets the track entry's TrackEntry::getMixDuration(). An empty animation + /// has no timelines and serves as a placeholder for mixing in or out. + /// + /// Mixing out is done by setting an empty animation with a mix duration using + /// either setEmptyAnimation(int, float), setEmptyAnimations(float), or + /// addEmptyAnimation(int, float, float). Mixing to an empty animation causes + /// the previous animation to be applied less and less over the mix duration. + /// Properties keyed in the previous animation transition to the value from + /// lower tracks or to the setup pose value if no lower tracks key the + /// property. A mix duration of 0 still mixes out over one frame. + /// + /// Mixing in is done by first setting an empty animation, then adding an + /// animation using addAnimation(int, Animation, bool, float) with the desired + /// delay (an empty animation has a duration of 0) and on the returned track + /// entry, set the TrackEntry::setMixDuration(float). Mixing from an empty + /// animation causes the new animation to be applied more and more over the + /// mix duration. Properties keyed in the new animation transition from the + /// value from lower tracks or from the setup pose value if no lower tracks + /// key the property to the value keyed in the new animation. + /// + /// See Empty animations in the Spine Runtimes Guide. TrackEntry setEmptyAnimation(int trackIndex, double mixDuration) { final result = SpineBindings.bindings.spine_animation_state_set_empty_animation(_ptr, trackIndex, mixDuration); return TrackEntry.fromPointer(result); } + /// Adds an empty animation to be played after the current or last queued + /// animation for a track, and sets the track entry's + /// TrackEntry::getMixDuration(). If the track has no entries, it is + /// equivalent to calling setEmptyAnimation(int, float). + /// + /// See setEmptyAnimation(int, float) and Empty animations in the Spine + /// Runtimes Guide. + /// + /// [delay] If > 0, sets TrackEntry::getDelay(). If < = 0, the delay set is the duration of the previous track entry minus any mix duration plus the specified delay (ie the mix ends at ( delay = 0) or before ( delay < 0) the previous track entry duration). If the previous entry is looping, its next loop completion is used instead of its duration. + /// + /// Returns A track entry to allow further customization of animation playback. References to the track entry must not be kept after the AnimationStateListener::dispose(TrackEntry) event occurs. TrackEntry addEmptyAnimation(int trackIndex, double mixDuration, double delay) { final result = SpineBindings.bindings.spine_animation_state_add_empty_animation(_ptr, trackIndex, mixDuration, delay); return TrackEntry.fromPointer(result); } + /// Sets an empty animation for every track, discarding any queued animations, + /// and mixes to it over the specified mix duration. + /// + /// See Empty animations in the Spine Runtimes Guide. set emptyAnimations(double value) { SpineBindings.bindings.spine_animation_state_set_empty_animations(_ptr, value); } + /// Returns The track entry for the animation currently playing on the track, or NULL if no animation is currently playing. TrackEntry? getCurrent(int trackIndex) { final result = SpineBindings.bindings.spine_animation_state_get_current(_ptr, trackIndex); return result.address == 0 ? null : TrackEntry.fromPointer(result); } + /// The AnimationStateData to look up mix durations. AnimationStateData get data { final result = SpineBindings.bindings.spine_animation_state_get_data(_ptr); return AnimationStateData.fromPointer(result); } + /// The list of tracks that have had animations, which may contain null + /// entries for tracks that currently have no animation. ArrayTrackEntry get tracks { final result = SpineBindings.bindings.spine_animation_state_get_tracks(_ptr); return ArrayTrackEntry.fromPointer(result); } + /// Multiplier for the delta time when the animation state is updated, causing + /// time for all animations and mixes to play slower or faster. Defaults to 1. + /// + /// See TrackEntry TrackEntry::getTimeScale() for affecting a single + /// animation. double get timeScale { final result = SpineBindings.bindings.spine_animation_state_get_time_scale(_ptr); return result; @@ -140,24 +205,45 @@ class AnimationState { return result; } + /// Sets an animation by name. + /// + /// See setAnimation(int, Animation, bool). TrackEntry setAnimation(int trackIndex, String animationName, bool loop) { final result = SpineBindings.bindings .spine_animation_state_set_animation_1(_ptr, trackIndex, animationName.toNativeUtf8().cast(), loop); return TrackEntry.fromPointer(result); } + /// Sets the current animation for a track, discarding any queued animations. + /// + /// If the formerly current track entry is for the same animation and was + /// never applied to a skeleton, it is replaced (not mixed from). + /// + /// [loop] If true, the animation will repeat. If false, it will not, instead its last frame is applied if played beyond its duration. In either case TrackEntry.TrackEnd determines when the track is cleared. + /// + /// Returns A track entry to allow further customization of animation playback. References to the track entry must not be kept after AnimationState.Dispose. TrackEntry setAnimation2(int trackIndex, Animation animation, bool loop) { final result = SpineBindings.bindings .spine_animation_state_set_animation_2(_ptr, trackIndex, animation.nativePtr.cast(), loop); return TrackEntry.fromPointer(result); } + /// Queues an animation by name. + /// + /// See addAnimation(int, Animation, bool, float). TrackEntry addAnimation(int trackIndex, String animationName, bool loop, double delay) { final result = SpineBindings.bindings.spine_animation_state_add_animation_1( _ptr, trackIndex, animationName.toNativeUtf8().cast(), loop, delay); return TrackEntry.fromPointer(result); } + /// Adds an animation to be played delay seconds after the current or last + /// queued animation for a track. If the track has no entries, this is + /// equivalent to calling setAnimation. + /// + /// [delay] Seconds to begin this animation after the start of the previous animation. May be < = 0 to use the animation duration of the previous track minus any mix duration plus the negative delay. + /// + /// Returns A track entry to allow further customization of animation playback. References to the track entry must not be kept after AnimationState.Dispose TrackEntry addAnimation2(int trackIndex, Animation animation, bool loop, double delay) { final result = SpineBindings.bindings .spine_animation_state_add_animation_2(_ptr, trackIndex, animation.nativePtr.cast(), loop, delay); diff --git a/spine-flutter/lib/generated/animation_state_data.dart b/spine-flutter/lib/generated/animation_state_data.dart index 576aabc4b..4e9d595cc 100644 --- a/spine-flutter/lib/generated/animation_state_data.dart +++ b/spine-flutter/lib/generated/animation_state_data.dart @@ -36,7 +36,8 @@ import '../spine_bindings.dart'; import 'animation.dart'; import 'skeleton_data.dart'; -/// AnimationStateData wrapper +/// Stores mix (crossfade) durations to be applied when AnimationState +/// animations are changed. class AnimationStateData { final Pointer _ptr; @@ -54,11 +55,14 @@ class AnimationStateData { SpineBindings.bindings.spine_animation_state_data_dispose(_ptr); } + /// The SkeletonData to look up animations when they are specified by name. SkeletonData get skeletonData { final result = SpineBindings.bindings.spine_animation_state_data_get_skeleton_data(_ptr); return SkeletonData.fromPointer(result); } + /// The mix duration to use when no mix duration has been specifically defined + /// between two animations. double get defaultMix { final result = SpineBindings.bindings.spine_animation_state_data_get_default_mix(_ptr); return result; @@ -68,21 +72,27 @@ class AnimationStateData { SpineBindings.bindings.spine_animation_state_data_set_default_mix(_ptr, value); } + /// The mix duration to use when changing from the specified animation to the + /// other, or the DefaultMix if no mix duration has been set. double getMix(Animation from, Animation to) { final result = SpineBindings.bindings.spine_animation_state_data_get_mix(_ptr, from.nativePtr.cast(), to.nativePtr.cast()); return result; } + /// Removes all mixes and sets the default mix to 0. void clear() { SpineBindings.bindings.spine_animation_state_data_clear(_ptr); } + /// Sets a mix duration by animation names. void setMix(String fromName, String toName, double duration) { SpineBindings.bindings.spine_animation_state_data_set_mix_1( _ptr, fromName.toNativeUtf8().cast(), toName.toNativeUtf8().cast(), duration); } + /// Sets a mix duration when changing from the specified animation to the + /// other. See TrackEntry.MixDuration. void setMix2(Animation from, Animation to, double duration) { SpineBindings.bindings .spine_animation_state_data_set_mix_2(_ptr, from.nativePtr.cast(), to.nativePtr.cast(), duration); diff --git a/spine-flutter/lib/generated/atlas.dart b/spine-flutter/lib/generated/atlas.dart index 1849f30ba..253e71ec8 100644 --- a/spine-flutter/lib/generated/atlas.dart +++ b/spine-flutter/lib/generated/atlas.dart @@ -53,6 +53,11 @@ class Atlas { SpineBindings.bindings.spine_atlas_flip_v(_ptr); } + /// Returns the first region found with the specified name. This method uses + /// String comparison to find the region, so the result should be cached + /// rather than calling this method multiple times. + /// + /// Returns The region, or nullptr. AtlasRegion? findRegion(String name) { final result = SpineBindings.bindings.spine_atlas_find_region(_ptr, name.toNativeUtf8().cast()); return result.address == 0 ? null : AtlasRegion.fromPointer(result); diff --git a/spine-flutter/lib/generated/atlas_attachment_loader.dart b/spine-flutter/lib/generated/atlas_attachment_loader.dart index eda15ec98..ac54af989 100644 --- a/spine-flutter/lib/generated/atlas_attachment_loader.dart +++ b/spine-flutter/lib/generated/atlas_attachment_loader.dart @@ -45,7 +45,12 @@ import 'region_attachment.dart'; import 'sequence.dart'; import 'skin.dart'; -/// AtlasAttachmentLoader wrapper +/// An AttachmentLoader that configures attachments using texture regions from +/// an Atlas. +/// +/// See +/// https://esotericsoftware.com/spine-loading-skeleton-data#JSON-and-binary-data +/// Loading skeleton data in the Spine Runtimes Guide. class AtlasAttachmentLoader implements AttachmentLoader { final Pointer _ptr; diff --git a/spine-flutter/lib/generated/attachment_timeline.dart b/spine-flutter/lib/generated/attachment_timeline.dart index 2c0ebf5ab..195519b61 100644 --- a/spine-flutter/lib/generated/attachment_timeline.dart +++ b/spine-flutter/lib/generated/attachment_timeline.dart @@ -56,6 +56,10 @@ class AttachmentTimeline extends Timeline implements SlotTimeline { SpineBindings.bindings.spine_attachment_timeline_dispose(_ptr); } + /// Sets the time and attachment name for the specified frame. + /// + /// [frame] Between 0 and frameCount, inclusive. + /// [time] The frame time in seconds. void setFrame(int frame, double time, String attachmentName) { SpineBindings.bindings .spine_attachment_timeline_set_frame(_ptr, frame, time, attachmentName.toNativeUtf8().cast()); diff --git a/spine-flutter/lib/generated/bone.dart b/spine-flutter/lib/generated/bone.dart index aa4996ff0..bea1dfc6b 100644 --- a/spine-flutter/lib/generated/bone.dart +++ b/spine-flutter/lib/generated/bone.dart @@ -43,7 +43,13 @@ import 'posed_active.dart'; import 'skeleton.dart'; import 'update.dart'; -/// Bone wrapper +/// The current pose for a bone, before constraints are applied. +/// +/// A bone has a local transform which is used to compute its world transform. A +/// bone also has an applied transform, which is a local transform that can be +/// applied to compute the world transform. The local transform and applied +/// transform may differ if a constraint or application code modifies the world +/// transform after it was computed from the local transform. class Bone extends PosedActive implements Posed, Update { final Pointer _ptr; @@ -53,12 +59,14 @@ class Bone extends PosedActive implements Posed, Update { @override Pointer get nativePtr => _ptr; + /// [parent] May be NULL. factory Bone(BoneData data, Bone? parent) { final ptr = SpineBindings.bindings .spine_bone_create(data.nativePtr.cast(), parent?.nativePtr.cast() ?? Pointer.fromAddress(0)); return Bone.fromPointer(ptr); } + /// Copy constructor. Does not copy the children bones. factory Bone.from(Bone bone, Bone? parent) { final ptr = SpineBindings.bindings .spine_bone_create2(bone.nativePtr.cast(), parent?.nativePtr.cast() ?? Pointer.fromAddress(0)); @@ -76,11 +84,13 @@ class Bone extends PosedActive implements Posed, Update { return Rtti.fromPointer(result); } + /// The parent bone, or null if this is the root bone. Bone? get parent { final result = SpineBindings.bindings.spine_bone_get_parent(_ptr); return result.address == 0 ? null : Bone.fromPointer(result); } + /// The immediate children of this bone. ArrayBone get children { final result = SpineBindings.bindings.spine_bone_get_children(_ptr); return ArrayBone.fromPointer(result); @@ -100,6 +110,7 @@ class Bone extends PosedActive implements Posed, Update { SpineBindings.bindings.spine_bone_update(_ptr, skeleton.nativePtr.cast(), physics.value); } + /// The constraint's setup pose data. BoneData get data { final result = SpineBindings.bindings.spine_bone_get_data(_ptr); return BoneData.fromPointer(result); diff --git a/spine-flutter/lib/generated/bone_data.dart b/spine-flutter/lib/generated/bone_data.dart index aa9f81305..ce355cb50 100644 --- a/spine-flutter/lib/generated/bone_data.dart +++ b/spine-flutter/lib/generated/bone_data.dart @@ -58,11 +58,13 @@ class BoneData extends PosedData { SpineBindings.bindings.spine_bone_data_dispose(_ptr); } + /// The index of the bone in Skeleton.Bones int get index { final result = SpineBindings.bindings.spine_bone_data_get_index(_ptr); return result; } + /// May be NULL. BoneData? get parent { final result = SpineBindings.bindings.spine_bone_data_get_parent(_ptr); return result.address == 0 ? null : BoneData.fromPointer(result); diff --git a/spine-flutter/lib/generated/bone_local.dart b/spine-flutter/lib/generated/bone_local.dart index b95b8d795..6027837af 100644 --- a/spine-flutter/lib/generated/bone_local.dart +++ b/spine-flutter/lib/generated/bone_local.dart @@ -34,7 +34,7 @@ import 'spine_dart_bindings_generated.dart'; import '../spine_bindings.dart'; import 'inherit.dart'; -/// BoneLocal wrapper +/// Stores a bone's local pose. class BoneLocal { final Pointer _ptr; @@ -56,6 +56,7 @@ class BoneLocal { SpineBindings.bindings.spine_bone_local_set(_ptr, pose.nativePtr.cast()); } + /// The local x translation. double get x { final result = SpineBindings.bindings.spine_bone_local_get_x(_ptr); return result; @@ -65,6 +66,7 @@ class BoneLocal { SpineBindings.bindings.spine_bone_local_set_x(_ptr, value); } + /// The local y translation. double get y { final result = SpineBindings.bindings.spine_bone_local_get_y(_ptr); return result; @@ -78,6 +80,7 @@ class BoneLocal { SpineBindings.bindings.spine_bone_local_set_position(_ptr, x, y); } + /// The local rotation in degrees, counter clockwise. double get rotation { final result = SpineBindings.bindings.spine_bone_local_get_rotation(_ptr); return result; @@ -87,6 +90,7 @@ class BoneLocal { SpineBindings.bindings.spine_bone_local_set_rotation(_ptr, value); } + /// The local scaleX. double get scaleX { final result = SpineBindings.bindings.spine_bone_local_get_scale_x(_ptr); return result; @@ -96,6 +100,7 @@ class BoneLocal { SpineBindings.bindings.spine_bone_local_set_scale_x(_ptr, value); } + /// The local scaleY. double get scaleY { final result = SpineBindings.bindings.spine_bone_local_get_scale_y(_ptr); return result; @@ -105,6 +110,7 @@ class BoneLocal { SpineBindings.bindings.spine_bone_local_set_scale_y(_ptr, value); } + /// The local shearX. double get shearX { final result = SpineBindings.bindings.spine_bone_local_get_shear_x(_ptr); return result; @@ -114,6 +120,7 @@ class BoneLocal { SpineBindings.bindings.spine_bone_local_set_shear_x(_ptr, value); } + /// The local shearY. double get shearY { final result = SpineBindings.bindings.spine_bone_local_get_shear_y(_ptr); return result; @@ -123,6 +130,7 @@ class BoneLocal { SpineBindings.bindings.spine_bone_local_set_shear_y(_ptr, value); } + /// Determines how parent world transforms affect this bone. Inherit get inherit { final result = SpineBindings.bindings.spine_bone_local_get_inherit(_ptr); return Inherit.fromValue(result); diff --git a/spine-flutter/lib/generated/bone_pose.dart b/spine-flutter/lib/generated/bone_pose.dart index 7a2c6934f..174430fbe 100644 --- a/spine-flutter/lib/generated/bone_pose.dart +++ b/spine-flutter/lib/generated/bone_pose.dart @@ -38,7 +38,8 @@ import 'physics.dart'; import 'skeleton.dart'; import 'update.dart'; -/// BonePose wrapper +/// The applied pose for a bone. This is the Bone pose with constraints applied +/// and the world transform computed by Skeleton::updateWorldTransform(Physics). class BonePose extends BoneLocal implements Update { final Pointer _ptr; @@ -64,19 +65,38 @@ class BonePose extends BoneLocal implements Update { return Rtti.fromPointer(result); } + /// Called by Skeleton::updateCache() to compute the world transform, if + /// needed. @override void update(Skeleton skeleton, Physics physics) { SpineBindings.bindings.spine_bone_pose_update(_ptr, skeleton.nativePtr.cast(), physics.value); } + /// Computes the world transform using the parent bone's applied pose and this + /// pose. Child bones are not updated. + /// + /// See World transforms in the Spine Runtimes Guide. void updateWorldTransform(Skeleton skeleton) { SpineBindings.bindings.spine_bone_pose_update_world_transform(_ptr, skeleton.nativePtr.cast()); } + /// Computes the local transform values from the world transform. + /// + /// If the world transform is modified (by a constraint, rotateWorld(), etc) + /// then this method should be called so the local transform matches the world + /// transform. The local transform may be needed by other code (eg to apply + /// another constraint). + /// + /// Some information is ambiguous in the world transform, such as -1,-1 scale + /// versus 180 rotation. The local transform after calling this method is + /// equivalent to the local transform used to compute the world transform, but + /// may not be identical. void updateLocalTransform(Skeleton skeleton) { SpineBindings.bindings.spine_bone_pose_update_local_transform(_ptr, skeleton.nativePtr.cast()); } + /// If the world transform has been modified and the local transform no longer + /// matches, updateLocalTransform() is called. void validateLocalTransform(Skeleton skeleton) { SpineBindings.bindings.spine_bone_pose_validate_local_transform(_ptr, skeleton.nativePtr.cast()); } @@ -93,6 +113,8 @@ class BonePose extends BoneLocal implements Update { SpineBindings.bindings.spine_bone_pose_reset_world(_ptr, update); } + /// Part of the world transform matrix for the X axis. If changed, + /// updateLocalTransform() should be called. double get a { final result = SpineBindings.bindings.spine_bone_pose_get_a(_ptr); return result; @@ -102,6 +124,8 @@ class BonePose extends BoneLocal implements Update { SpineBindings.bindings.spine_bone_pose_set_a(_ptr, value); } + /// Part of the world transform matrix for the Y axis. If changed, + /// updateLocalTransform() should be called. double get b { final result = SpineBindings.bindings.spine_bone_pose_get_b(_ptr); return result; @@ -111,6 +135,8 @@ class BonePose extends BoneLocal implements Update { SpineBindings.bindings.spine_bone_pose_set_b(_ptr, value); } + /// Part of the world transform matrix for the X axis. If changed, + /// updateLocalTransform() should be called. double get c { final result = SpineBindings.bindings.spine_bone_pose_get_c(_ptr); return result; @@ -120,6 +146,8 @@ class BonePose extends BoneLocal implements Update { SpineBindings.bindings.spine_bone_pose_set_c(_ptr, value); } + /// Part of the world transform matrix for the Y axis. If changed, + /// updateLocalTransform() should be called. double get d { final result = SpineBindings.bindings.spine_bone_pose_get_d(_ptr); return result; @@ -129,6 +157,7 @@ class BonePose extends BoneLocal implements Update { SpineBindings.bindings.spine_bone_pose_set_d(_ptr, value); } + /// The world X position. If changed, updateLocalTransform() should be called. double get worldX { final result = SpineBindings.bindings.spine_bone_pose_get_world_x(_ptr); return result; @@ -138,6 +167,7 @@ class BonePose extends BoneLocal implements Update { SpineBindings.bindings.spine_bone_pose_set_world_x(_ptr, value); } + /// The world Y position. If changed, updateLocalTransform() should be called. double get worldY { final result = SpineBindings.bindings.spine_bone_pose_get_world_y(_ptr); return result; @@ -147,36 +177,48 @@ class BonePose extends BoneLocal implements Update { SpineBindings.bindings.spine_bone_pose_set_world_y(_ptr, value); } + /// The world rotation for the X axis, calculated using a and c. double get worldRotationX { final result = SpineBindings.bindings.spine_bone_pose_get_world_rotation_x(_ptr); return result; } + /// The world rotation for the Y axis, calculated using b and d. double get worldRotationY { final result = SpineBindings.bindings.spine_bone_pose_get_world_rotation_y(_ptr); return result; } + /// The magnitude (always positive) of the world scale X, calculated using a + /// and c. double get worldScaleX { final result = SpineBindings.bindings.spine_bone_pose_get_world_scale_x(_ptr); return result; } + /// The magnitude (always positive) of the world scale Y, calculated using b + /// and d. double get worldScaleY { final result = SpineBindings.bindings.spine_bone_pose_get_world_scale_y(_ptr); return result; } + /// Transforms a world rotation to a local rotation. double worldToLocalRotation(double worldRotation) { final result = SpineBindings.bindings.spine_bone_pose_world_to_local_rotation(_ptr, worldRotation); return result; } + /// Transforms a local rotation to a world rotation. double localToWorldRotation(double localRotation) { final result = SpineBindings.bindings.spine_bone_pose_local_to_world_rotation(_ptr, localRotation); return result; } + /// Rotates the world transform the specified amount. + /// + /// After changes are made to the world transform, updateLocalTransform() + /// should be called on this bone and any child bones, recursively. void rotateWorld(double degrees) { SpineBindings.bindings.spine_bone_pose_rotate_world(_ptr, degrees); } diff --git a/spine-flutter/lib/generated/bone_timeline.dart b/spine-flutter/lib/generated/bone_timeline.dart index df5b1810a..3b32a7666 100644 --- a/spine-flutter/lib/generated/bone_timeline.dart +++ b/spine-flutter/lib/generated/bone_timeline.dart @@ -33,7 +33,7 @@ import 'package:universal_ffi/ffi.dart'; import '../spine_bindings.dart'; import 'rtti.dart'; -/// BoneTimeline wrapper +/// An interface for timelines which change the property of a bone. abstract class BoneTimeline { Pointer get nativePtr; Rtti get rtti; diff --git a/spine-flutter/lib/generated/bone_timeline1.dart b/spine-flutter/lib/generated/bone_timeline1.dart index 3a3dc8dd8..dc008c3ee 100644 --- a/spine-flutter/lib/generated/bone_timeline1.dart +++ b/spine-flutter/lib/generated/bone_timeline1.dart @@ -35,7 +35,7 @@ import '../spine_bindings.dart'; import 'bone_timeline.dart'; import 'curve_timeline1.dart'; -/// BoneTimeline1 wrapper +/// Base class for timelines that animate a single bone property. abstract class BoneTimeline1 extends CurveTimeline1 implements BoneTimeline { final Pointer _ptr; diff --git a/spine-flutter/lib/generated/bone_timeline2.dart b/spine-flutter/lib/generated/bone_timeline2.dart index fbaea1066..230815ac9 100644 --- a/spine-flutter/lib/generated/bone_timeline2.dart +++ b/spine-flutter/lib/generated/bone_timeline2.dart @@ -35,7 +35,7 @@ import '../spine_bindings.dart'; import 'bone_timeline.dart'; import 'curve_timeline.dart'; -/// BoneTimeline2 wrapper +/// Base class for timelines that animate two bone properties. abstract class BoneTimeline2 extends CurveTimeline implements BoneTimeline { final Pointer _ptr; diff --git a/spine-flutter/lib/generated/bounding_box_attachment.dart b/spine-flutter/lib/generated/bounding_box_attachment.dart index 7bb92bb9d..da22b5f96 100644 --- a/spine-flutter/lib/generated/bounding_box_attachment.dart +++ b/spine-flutter/lib/generated/bounding_box_attachment.dart @@ -36,7 +36,7 @@ import '../spine_bindings.dart'; import 'color.dart'; import 'vertex_attachment.dart'; -/// BoundingBoxAttachment wrapper +/// Attachment that has a polygon for bounds checking. class BoundingBoxAttachment extends VertexAttachment { final Pointer _ptr; diff --git a/spine-flutter/lib/generated/color.dart b/spine-flutter/lib/generated/color.dart index 1e7f9e21f..fde5c535e 100644 --- a/spine-flutter/lib/generated/color.dart +++ b/spine-flutter/lib/generated/color.dart @@ -67,10 +67,12 @@ class Color { return result; } + /// Convert packed RGBA8888 integer to Color void rgba8888ToColor(int value) { SpineBindings.bindings.spine_color_rgba8888_to_color(_ptr, value); } + /// Convert packed RGB888 integer to Color (no alpha) void rgb888ToColor(int value) { SpineBindings.bindings.spine_color_rgb888_to_color(_ptr, value); } diff --git a/spine-flutter/lib/generated/constraint_timeline.dart b/spine-flutter/lib/generated/constraint_timeline.dart index 29a3dcb0c..0bca819c6 100644 --- a/spine-flutter/lib/generated/constraint_timeline.dart +++ b/spine-flutter/lib/generated/constraint_timeline.dart @@ -33,7 +33,7 @@ import 'package:universal_ffi/ffi.dart'; import '../spine_bindings.dart'; import 'rtti.dart'; -/// ConstraintTimeline wrapper +/// An interface for timelines which change the property of a constraint. abstract class ConstraintTimeline { Pointer get nativePtr; Rtti get rtti; diff --git a/spine-flutter/lib/generated/constraint_timeline1.dart b/spine-flutter/lib/generated/constraint_timeline1.dart index 8ecf5d5ac..97ba1c609 100644 --- a/spine-flutter/lib/generated/constraint_timeline1.dart +++ b/spine-flutter/lib/generated/constraint_timeline1.dart @@ -35,7 +35,7 @@ import '../spine_bindings.dart'; import 'constraint_timeline.dart'; import 'curve_timeline1.dart'; -/// ConstraintTimeline1 wrapper +/// Base class for single-value constraint timelines. abstract class ConstraintTimeline1 extends CurveTimeline1 implements ConstraintTimeline { final Pointer _ptr; diff --git a/spine-flutter/lib/generated/curve_timeline.dart b/spine-flutter/lib/generated/curve_timeline.dart index a96300e23..e1e86874a 100644 --- a/spine-flutter/lib/generated/curve_timeline.dart +++ b/spine-flutter/lib/generated/curve_timeline.dart @@ -35,7 +35,7 @@ import '../spine_bindings.dart'; import 'arrays.dart'; import 'timeline.dart'; -/// CurveTimeline wrapper +/// Base class for frames that use an interpolation bezier curve. abstract class CurveTimeline extends Timeline { final Pointer _ptr; diff --git a/spine-flutter/lib/generated/curve_timeline1.dart b/spine-flutter/lib/generated/curve_timeline1.dart index f2339acf2..dc1df46c4 100644 --- a/spine-flutter/lib/generated/curve_timeline1.dart +++ b/spine-flutter/lib/generated/curve_timeline1.dart @@ -36,7 +36,7 @@ import 'curve_timeline.dart'; import 'mix_blend.dart'; import 'mix_direction.dart'; -/// CurveTimeline1 wrapper +/// The base class for a CurveTimeline that sets one property. abstract class CurveTimeline1 extends CurveTimeline { final Pointer _ptr; @@ -47,10 +47,15 @@ abstract class CurveTimeline1 extends CurveTimeline { @override Pointer get nativePtr => _ptr; + /// Sets the time and value for the specified frame. + /// + /// [frame] Between 0 and frameCount, inclusive. + /// [time] The frame time in seconds. void setFrame(int frame, double time, double value) { SpineBindings.bindings.spine_curve_timeline1_set_frame(_ptr, frame, time, value); } + /// Returns the interpolated value for the specified time. double getCurveValue(double time) { final result = SpineBindings.bindings.spine_curve_timeline1_get_curve_value(_ptr, time); return result; diff --git a/spine-flutter/lib/generated/deform_timeline.dart b/spine-flutter/lib/generated/deform_timeline.dart index 953f9922d..6ea66e49e 100644 --- a/spine-flutter/lib/generated/deform_timeline.dart +++ b/spine-flutter/lib/generated/deform_timeline.dart @@ -41,7 +41,7 @@ import 'path_attachment.dart'; import 'slot_curve_timeline.dart'; import 'vertex_attachment.dart'; -/// DeformTimeline wrapper +/// Changes a slot's SlotPose::getDeform() to deform a VertexAttachment. class DeformTimeline extends SlotCurveTimeline { final Pointer _ptr; @@ -62,10 +62,12 @@ class DeformTimeline extends SlotCurveTimeline { SpineBindings.bindings.spine_deform_timeline_dispose(_ptr); } + /// Sets the time and vertices for the specified frame. void setFrame(int frameIndex, double time, ArrayFloat vertices) { SpineBindings.bindings.spine_deform_timeline_set_frame(_ptr, frameIndex, time, vertices.nativePtr.cast()); } + /// The attachment that will be deformed. VertexAttachment get attachment { final result = SpineBindings.bindings.spine_deform_timeline_get_attachment(_ptr); final rtti = SpineBindings.bindings.spine_vertex_attachment_get_rtti(result); diff --git a/spine-flutter/lib/generated/draw_order_timeline.dart b/spine-flutter/lib/generated/draw_order_timeline.dart index 419118010..e6c1fc014 100644 --- a/spine-flutter/lib/generated/draw_order_timeline.dart +++ b/spine-flutter/lib/generated/draw_order_timeline.dart @@ -35,7 +35,7 @@ import '../spine_bindings.dart'; import 'arrays.dart'; import 'timeline.dart'; -/// DrawOrderTimeline wrapper +/// Changes a skeleton's Skeleton::getDrawOrder(). class DrawOrderTimeline extends Timeline { final Pointer _ptr; @@ -55,6 +55,11 @@ class DrawOrderTimeline extends Timeline { SpineBindings.bindings.spine_draw_order_timeline_dispose(_ptr); } + /// Sets the time and draw order for the specified frame. + /// + /// [frame] Between 0 and frameCount, inclusive. + /// [time] The frame time in seconds. + /// [drawOrder] For each slot in Skeleton::slots, the index of the slot in the new draw order. May be null to use setup pose draw order. void setFrame(int frame, double time, ArrayInt? drawOrder) { SpineBindings.bindings .spine_draw_order_timeline_set_frame(_ptr, frame, time, drawOrder?.nativePtr.cast() ?? Pointer.fromAddress(0)); diff --git a/spine-flutter/lib/generated/event.dart b/spine-flutter/lib/generated/event.dart index e8d8bf215..b9c0e0946 100644 --- a/spine-flutter/lib/generated/event.dart +++ b/spine-flutter/lib/generated/event.dart @@ -35,7 +35,11 @@ import 'spine_dart_bindings_generated.dart'; import '../spine_bindings.dart'; import 'event_data.dart'; -/// Event wrapper +/// Stores the current pose values for an Event. +/// +/// See Timeline::apply(), AnimationStateListener::event(), and +/// +/// See also: https://esotericsoftware.com/spine-events Events in the Spine User Guide. class Event { final Pointer _ptr; @@ -53,11 +57,13 @@ class Event { SpineBindings.bindings.spine_event_dispose(_ptr); } + /// The event's setup pose data. EventData get data { final result = SpineBindings.bindings.spine_event_get_data(_ptr); return EventData.fromPointer(result); } + /// The animation time this event was keyed. double get time { final result = SpineBindings.bindings.spine_event_get_time(_ptr); return result; diff --git a/spine-flutter/lib/generated/event_data.dart b/spine-flutter/lib/generated/event_data.dart index cfd7dc744..f26dff7e0 100644 --- a/spine-flutter/lib/generated/event_data.dart +++ b/spine-flutter/lib/generated/event_data.dart @@ -34,7 +34,7 @@ import 'package:universal_ffi/ffi_utils.dart'; import 'spine_dart_bindings_generated.dart'; import '../spine_bindings.dart'; -/// EventData wrapper +/// Stores the setup pose values for an Event. class EventData { final Pointer _ptr; @@ -52,6 +52,7 @@ class EventData { SpineBindings.bindings.spine_event_data_dispose(_ptr); } + /// The name of the event, which is unique within the skeleton. String get name { final result = SpineBindings.bindings.spine_event_data_get_name(_ptr); return result.cast().toDartString(); diff --git a/spine-flutter/lib/generated/event_timeline.dart b/spine-flutter/lib/generated/event_timeline.dart index 851407bda..4321cdaa8 100644 --- a/spine-flutter/lib/generated/event_timeline.dart +++ b/spine-flutter/lib/generated/event_timeline.dart @@ -36,7 +36,7 @@ import 'arrays.dart'; import 'event.dart'; import 'timeline.dart'; -/// EventTimeline wrapper +/// Fires an Event when specific animation times are reached. class EventTimeline extends Timeline { final Pointer _ptr; @@ -56,11 +56,15 @@ class EventTimeline extends Timeline { SpineBindings.bindings.spine_event_timeline_dispose(_ptr); } + /// The event for each frame. ArrayEvent get events { final result = SpineBindings.bindings.spine_event_timeline_get_events(_ptr); return ArrayEvent.fromPointer(result); } + /// Sets the time and event for the specified frame. + /// + /// [frame] Between 0 and frameCount, inclusive. void setFrame(int frame, Event event) { SpineBindings.bindings.spine_event_timeline_set_frame(_ptr, frame, event.nativePtr.cast()); } diff --git a/spine-flutter/lib/generated/from_property.dart b/spine-flutter/lib/generated/from_property.dart index c56ebbd91..3d1c1df9c 100644 --- a/spine-flutter/lib/generated/from_property.dart +++ b/spine-flutter/lib/generated/from_property.dart @@ -35,7 +35,7 @@ import '../spine_bindings.dart'; import 'rtti.dart'; import 'arrays.dart'; -/// FromProperty wrapper +/// Source property for a TransformConstraint. abstract class FromProperty { final Pointer _ptr; diff --git a/spine-flutter/lib/generated/ik_constraint.dart b/spine-flutter/lib/generated/ik_constraint.dart index 3840932bb..385cc2847 100644 --- a/spine-flutter/lib/generated/ik_constraint.dart +++ b/spine-flutter/lib/generated/ik_constraint.dart @@ -79,12 +79,19 @@ class IkConstraint extends IkConstraintBase { SpineBindings.bindings.spine_ik_constraint_set_target(_ptr, value.nativePtr.cast()); } + /// Adjusts the bone rotation so the tip is as close to the target position as + /// possible. The target is specified in the world coordinate system. static void apply(Skeleton skeleton, BonePose bone, double targetX, double targetY, bool compress, bool stretch, bool uniform, double mix) { SpineBindings.bindings.spine_ik_constraint_apply_1( skeleton.nativePtr.cast(), bone.nativePtr.cast(), targetX, targetY, compress, stretch, uniform, mix); } + /// Adjusts the parent and child bone rotations so the tip of the child is as + /// close to the target position as possible. The target is specified in the + /// world coordinate system. + /// + /// [child] A direct descendant of the parent bone. static void apply2(Skeleton skeleton, BonePose parent, BonePose child, double targetX, double targetY, int bendDirection, bool stretch, bool uniform, double softness, double mix) { SpineBindings.bindings.spine_ik_constraint_apply_2(skeleton.nativePtr.cast(), parent.nativePtr.cast(), diff --git a/spine-flutter/lib/generated/ik_constraint_base.dart b/spine-flutter/lib/generated/ik_constraint_base.dart index 505b41562..e59a93074 100644 --- a/spine-flutter/lib/generated/ik_constraint_base.dart +++ b/spine-flutter/lib/generated/ik_constraint_base.dart @@ -41,7 +41,7 @@ import 'posed.dart'; import 'posed_active.dart'; import 'skeleton.dart'; -/// IkConstraintBase wrapper +/// Non-exported base class that inherits from the template abstract class IkConstraintBase extends PosedActive implements Posed, Constraint { final Pointer _ptr; @@ -101,6 +101,7 @@ abstract class IkConstraintBase extends PosedActive implements Posed, Constraint return result; } + /// Inherited from Update @override void update(Skeleton skeleton, Physics physics) { SpineBindings.bindings.spine_ik_constraint_base_update(_ptr, skeleton.nativePtr.cast(), physics.value); diff --git a/spine-flutter/lib/generated/ik_constraint_data.dart b/spine-flutter/lib/generated/ik_constraint_data.dart index 7872ef682..7f820f31c 100644 --- a/spine-flutter/lib/generated/ik_constraint_data.dart +++ b/spine-flutter/lib/generated/ik_constraint_data.dart @@ -100,11 +100,13 @@ class IkConstraintData extends PosedData implements ConstraintData { } } + /// The bones that are constrained by this IK Constraint. ArrayBoneData get bones { final result = SpineBindings.bindings.spine_ik_constraint_data_get_bones(_ptr); return ArrayBoneData.fromPointer(result); } + /// The bone that is the IK target. BoneData get target { final result = SpineBindings.bindings.spine_ik_constraint_data_get_target(_ptr); return BoneData.fromPointer(result); @@ -114,6 +116,8 @@ class IkConstraintData extends PosedData implements ConstraintData { SpineBindings.bindings.spine_ik_constraint_data_set_target(_ptr, value.nativePtr.cast()); } + /// When true and IkConstraintPose compress or stretch is used, the bone is + /// scaled on both the X and Y axes. bool get uniform { final result = SpineBindings.bindings.spine_ik_constraint_data_get_uniform(_ptr); return result; diff --git a/spine-flutter/lib/generated/ik_constraint_pose.dart b/spine-flutter/lib/generated/ik_constraint_pose.dart index 444a8ecfc..16c1b9f40 100644 --- a/spine-flutter/lib/generated/ik_constraint_pose.dart +++ b/spine-flutter/lib/generated/ik_constraint_pose.dart @@ -33,7 +33,7 @@ import 'package:universal_ffi/ffi.dart'; import 'spine_dart_bindings_generated.dart'; import '../spine_bindings.dart'; -/// IkConstraintPose wrapper +/// Stores the current pose for an IK constraint. class IkConstraintPose { final Pointer _ptr; @@ -55,6 +55,11 @@ class IkConstraintPose { SpineBindings.bindings.spine_ik_constraint_pose_set(_ptr, pose.nativePtr.cast()); } + /// A percentage (0-1) that controls the mix between the constrained and + /// unconstrained rotation. + /// + /// For two bone IK: if the parent bone has local nonuniform scale, the child + /// bone's local Y translation is set to 0. double get mix { final result = SpineBindings.bindings.spine_ik_constraint_pose_get_mix(_ptr); return result; @@ -64,6 +69,9 @@ class IkConstraintPose { SpineBindings.bindings.spine_ik_constraint_pose_set_mix(_ptr, value); } + /// For two bone IK, the target bone's distance from the maximum reach of the + /// bones where rotation begins to slow. The bones will not straighten + /// completely until the target is this far out of range. double get softness { final result = SpineBindings.bindings.spine_ik_constraint_pose_get_softness(_ptr); return result; @@ -73,6 +81,8 @@ class IkConstraintPose { SpineBindings.bindings.spine_ik_constraint_pose_set_softness(_ptr, value); } + /// For two bone IK, controls the bend direction of the IK bones, either 1 or + /// -1. int get bendDirection { final result = SpineBindings.bindings.spine_ik_constraint_pose_get_bend_direction(_ptr); return result; @@ -82,6 +92,8 @@ class IkConstraintPose { SpineBindings.bindings.spine_ik_constraint_pose_set_bend_direction(_ptr, value); } + /// For one bone IK, when true and the target is too close, the bone is scaled + /// to reach it. bool get compress { final result = SpineBindings.bindings.spine_ik_constraint_pose_get_compress(_ptr); return result; @@ -91,6 +103,12 @@ class IkConstraintPose { SpineBindings.bindings.spine_ik_constraint_pose_set_compress(_ptr, value); } + /// When true and the target is out of range, the parent bone is scaled to + /// reach it. + /// + /// For two bone IK: 1) the child bone's local Y translation is set to 0, 2) + /// stretch is not applied if getSoftness() is > 0, and 3) if the parent bone + /// has local nonuniform scale, stretch is not applied. bool get stretch { final result = SpineBindings.bindings.spine_ik_constraint_pose_get_stretch(_ptr); return result; diff --git a/spine-flutter/lib/generated/ik_constraint_timeline.dart b/spine-flutter/lib/generated/ik_constraint_timeline.dart index 698413fad..687f0022c 100644 --- a/spine-flutter/lib/generated/ik_constraint_timeline.dart +++ b/spine-flutter/lib/generated/ik_constraint_timeline.dart @@ -35,7 +35,9 @@ import '../spine_bindings.dart'; import 'constraint_timeline.dart'; import 'curve_timeline.dart'; -/// IkConstraintTimeline wrapper +/// Changes an IK constraint's IkConstraintPose::getMix(), +/// IkConstraintPose::getSoftness(), IkConstraintPose::getBendDirection(), +/// IkConstraintPose::getStretch(), and IkConstraintPose::getCompress(). class IkConstraintTimeline extends CurveTimeline implements ConstraintTimeline { final Pointer _ptr; @@ -55,6 +57,12 @@ class IkConstraintTimeline extends CurveTimeline implements ConstraintTimeline { SpineBindings.bindings.spine_ik_constraint_timeline_dispose(_ptr); } + /// Sets the time, mix, softness, bend direction, compress, and stretch for + /// the specified frame. + /// + /// [frame] Between 0 and frameCount, inclusive. + /// [time] The frame time in seconds. + /// [bendDirection] 1 or -1. void setFrame(int frame, double time, double mix, double softness, int bendDirection, bool compress, bool stretch) { SpineBindings.bindings .spine_ik_constraint_timeline_set_frame(_ptr, frame, time, mix, softness, bendDirection, compress, stretch); diff --git a/spine-flutter/lib/generated/inherit_timeline.dart b/spine-flutter/lib/generated/inherit_timeline.dart index 46f1b8696..f9b71e52e 100644 --- a/spine-flutter/lib/generated/inherit_timeline.dart +++ b/spine-flutter/lib/generated/inherit_timeline.dart @@ -36,7 +36,7 @@ import 'bone_timeline.dart'; import 'inherit.dart'; import 'timeline.dart'; -/// InheritTimeline wrapper +/// Changes a bone's BoneLocal::getInherit(). class InheritTimeline extends Timeline implements BoneTimeline { final Pointer _ptr; @@ -56,6 +56,10 @@ class InheritTimeline extends Timeline implements BoneTimeline { SpineBindings.bindings.spine_inherit_timeline_dispose(_ptr); } + /// Sets the inherit transform mode for the specified frame. + /// + /// [frame] Between 0 and frameCount, inclusive. + /// [time] The frame time in seconds. void setFrame(int frame, double time, Inherit inherit) { SpineBindings.bindings.spine_inherit_timeline_set_frame(_ptr, frame, time, inherit.value); } diff --git a/spine-flutter/lib/generated/mesh_attachment.dart b/spine-flutter/lib/generated/mesh_attachment.dart index afdf9bcf0..0fa4b1ce7 100644 --- a/spine-flutter/lib/generated/mesh_attachment.dart +++ b/spine-flutter/lib/generated/mesh_attachment.dart @@ -39,7 +39,7 @@ import 'sequence.dart'; import 'texture_region.dart'; import 'vertex_attachment.dart'; -/// MeshAttachment wrapper +/// Attachment that displays a texture region using a mesh. class MeshAttachment extends VertexAttachment { final Pointer _ptr; @@ -81,6 +81,8 @@ class MeshAttachment extends VertexAttachment { SpineBindings.bindings.spine_mesh_attachment_set_region_u_vs(_ptr, value.nativePtr.cast()); } + /// The UV pair for each vertex, normalized within the entire texture. See + /// also MeshAttachment::updateRegion ArrayFloat get uVs { final result = SpineBindings.bindings.spine_mesh_attachment_get_u_vs(_ptr); return ArrayFloat.fromPointer(result); @@ -137,6 +139,7 @@ class MeshAttachment extends VertexAttachment { .spine_mesh_attachment_set_parent_mesh(_ptr, value?.nativePtr.cast() ?? Pointer.fromAddress(0)); } + /// Nonessential. ArrayUnsignedShort get edges { final result = SpineBindings.bindings.spine_mesh_attachment_get_edges(_ptr); return ArrayUnsignedShort.fromPointer(result); diff --git a/spine-flutter/lib/generated/path_attachment.dart b/spine-flutter/lib/generated/path_attachment.dart index cb7d77949..c2e6c5d61 100644 --- a/spine-flutter/lib/generated/path_attachment.dart +++ b/spine-flutter/lib/generated/path_attachment.dart @@ -57,6 +57,8 @@ class PathAttachment extends VertexAttachment { SpineBindings.bindings.spine_path_attachment_dispose(_ptr); } + /// The length in the setup pose from the start of the path to the end of each + /// curve. ArrayFloat get lengths { final result = SpineBindings.bindings.spine_path_attachment_get_lengths(_ptr); return ArrayFloat.fromPointer(result); diff --git a/spine-flutter/lib/generated/path_constraint.dart b/spine-flutter/lib/generated/path_constraint.dart index a89fbda2b..0a0af9cd6 100644 --- a/spine-flutter/lib/generated/path_constraint.dart +++ b/spine-flutter/lib/generated/path_constraint.dart @@ -64,11 +64,13 @@ class PathConstraint extends PathConstraintBase { return PathConstraint.fromPointer(result); } + /// The bones that will be modified by this path constraint. ArrayBonePose get bones { final result = SpineBindings.bindings.spine_path_constraint_get_bones(_ptr); return ArrayBonePose.fromPointer(result); } + /// The slot whose path attachment will be used to constrained the bones. Slot get slot { final result = SpineBindings.bindings.spine_path_constraint_get_slot(_ptr); return Slot.fromPointer(result); diff --git a/spine-flutter/lib/generated/path_constraint_base.dart b/spine-flutter/lib/generated/path_constraint_base.dart index c4e5ce8c3..bd48ab79b 100644 --- a/spine-flutter/lib/generated/path_constraint_base.dart +++ b/spine-flutter/lib/generated/path_constraint_base.dart @@ -41,7 +41,13 @@ import 'posed.dart'; import 'posed_active.dart'; import 'skeleton.dart'; -/// PathConstraintBase wrapper +/// Stores the current pose for a path constraint. A path constraint adjusts the +/// rotation, translation, and scale of the constrained bones so they follow a +/// PathAttachment. +/// +/// See https://esotericsoftware.com/spine-path-constraints Path constraints in +/// the Spine User Guide. Non-exported base class that inherits from the +/// template abstract class PathConstraintBase extends PosedActive implements Posed, Constraint { final Pointer _ptr; @@ -101,6 +107,7 @@ abstract class PathConstraintBase extends PosedActive implements Posed, Constrai return result; } + /// Inherited from Update @override void update(Skeleton skeleton, Physics physics) { SpineBindings.bindings.spine_path_constraint_base_update(_ptr, skeleton.nativePtr.cast(), physics.value); diff --git a/spine-flutter/lib/generated/path_constraint_data.dart b/spine-flutter/lib/generated/path_constraint_data.dart index 41068abd2..08d05a28a 100644 --- a/spine-flutter/lib/generated/path_constraint_data.dart +++ b/spine-flutter/lib/generated/path_constraint_data.dart @@ -50,7 +50,10 @@ import 'slot_data.dart'; import 'spacing_mode.dart'; import 'transform_constraint.dart'; -/// PathConstraintData wrapper +/// Stores the setup pose for a PathConstraint. +/// +/// See https://esotericsoftware.com/spine-path-constraints Path constraints in +/// the Spine User Guide. class PathConstraintData extends PosedData implements ConstraintData { final Pointer _ptr; @@ -103,11 +106,13 @@ class PathConstraintData extends PosedData implements ConstraintData { } } + /// The bones that will be modified by this path constraint. ArrayBoneData get bones { final result = SpineBindings.bindings.spine_path_constraint_data_get_bones(_ptr); return ArrayBoneData.fromPointer(result); } + /// The slot whose path attachment will be used to constrained the bones. SlotData get slot { final result = SpineBindings.bindings.spine_path_constraint_data_get_slot(_ptr); return SlotData.fromPointer(result); @@ -117,6 +122,7 @@ class PathConstraintData extends PosedData implements ConstraintData { SpineBindings.bindings.spine_path_constraint_data_set_slot(_ptr, value.nativePtr.cast()); } + /// The mode for positioning the first bone on the path. PositionMode get positionMode { final result = SpineBindings.bindings.spine_path_constraint_data_get_position_mode(_ptr); return PositionMode.fromValue(result); @@ -126,6 +132,7 @@ class PathConstraintData extends PosedData implements ConstraintData { SpineBindings.bindings.spine_path_constraint_data_set_position_mode(_ptr, value.value); } + /// The mode for positioning the bones after the first bone on the path. SpacingMode get spacingMode { final result = SpineBindings.bindings.spine_path_constraint_data_get_spacing_mode(_ptr); return SpacingMode.fromValue(result); @@ -135,6 +142,7 @@ class PathConstraintData extends PosedData implements ConstraintData { SpineBindings.bindings.spine_path_constraint_data_set_spacing_mode(_ptr, value.value); } + /// The mode for adjusting the rotation of the bones. RotateMode get rotateMode { final result = SpineBindings.bindings.spine_path_constraint_data_get_rotate_mode(_ptr); return RotateMode.fromValue(result); @@ -144,6 +152,7 @@ class PathConstraintData extends PosedData implements ConstraintData { SpineBindings.bindings.spine_path_constraint_data_set_rotate_mode(_ptr, value.value); } + /// An offset added to the constrained bone rotation. double get offsetRotation { final result = SpineBindings.bindings.spine_path_constraint_data_get_offset_rotation(_ptr); return result; diff --git a/spine-flutter/lib/generated/path_constraint_mix_timeline.dart b/spine-flutter/lib/generated/path_constraint_mix_timeline.dart index 1527ca09b..c40dd6d0f 100644 --- a/spine-flutter/lib/generated/path_constraint_mix_timeline.dart +++ b/spine-flutter/lib/generated/path_constraint_mix_timeline.dart @@ -35,7 +35,8 @@ import '../spine_bindings.dart'; import 'constraint_timeline.dart'; import 'curve_timeline.dart'; -/// PathConstraintMixTimeline wrapper +/// Changes a path constraint's PathConstraintPose::getMixRotate(), +/// PathConstraintPose::getMixX(), and PathConstraintPose::getMixY(). class PathConstraintMixTimeline extends CurveTimeline implements ConstraintTimeline { final Pointer _ptr; @@ -56,6 +57,10 @@ class PathConstraintMixTimeline extends CurveTimeline implements ConstraintTimel SpineBindings.bindings.spine_path_constraint_mix_timeline_dispose(_ptr); } + /// Sets the time and color for the specified frame. + /// + /// [frame] Between 0 and frameCount, inclusive. + /// [time] The frame time in seconds. void setFrame(int frame, double time, double mixRotate, double mixX, double mixY) { SpineBindings.bindings.spine_path_constraint_mix_timeline_set_frame(_ptr, frame, time, mixRotate, mixX, mixY); } diff --git a/spine-flutter/lib/generated/path_constraint_pose.dart b/spine-flutter/lib/generated/path_constraint_pose.dart index 96e0794ae..71f9f7568 100644 --- a/spine-flutter/lib/generated/path_constraint_pose.dart +++ b/spine-flutter/lib/generated/path_constraint_pose.dart @@ -33,7 +33,7 @@ import 'package:universal_ffi/ffi.dart'; import 'spine_dart_bindings_generated.dart'; import '../spine_bindings.dart'; -/// PathConstraintPose wrapper +/// Stores a pose for a path constraint. class PathConstraintPose { final Pointer _ptr; @@ -55,6 +55,7 @@ class PathConstraintPose { SpineBindings.bindings.spine_path_constraint_pose_set(_ptr, pose.nativePtr.cast()); } + /// The position along the path. double get position { final result = SpineBindings.bindings.spine_path_constraint_pose_get_position(_ptr); return result; @@ -64,6 +65,7 @@ class PathConstraintPose { SpineBindings.bindings.spine_path_constraint_pose_set_position(_ptr, value); } + /// The spacing between bones. double get spacing { final result = SpineBindings.bindings.spine_path_constraint_pose_get_spacing(_ptr); return result; @@ -73,6 +75,8 @@ class PathConstraintPose { SpineBindings.bindings.spine_path_constraint_pose_set_spacing(_ptr, value); } + /// A percentage (0-1) that controls the mix between the constrained and + /// unconstrained rotation. double get mixRotate { final result = SpineBindings.bindings.spine_path_constraint_pose_get_mix_rotate(_ptr); return result; @@ -82,6 +86,8 @@ class PathConstraintPose { SpineBindings.bindings.spine_path_constraint_pose_set_mix_rotate(_ptr, value); } + /// A percentage (0-1) that controls the mix between the constrained and + /// unconstrained translation X. double get mixX { final result = SpineBindings.bindings.spine_path_constraint_pose_get_mix_x(_ptr); return result; @@ -91,6 +97,8 @@ class PathConstraintPose { SpineBindings.bindings.spine_path_constraint_pose_set_mix_x(_ptr, value); } + /// A percentage (0-1) that controls the mix between the constrained and + /// unconstrained translation Y. double get mixY { final result = SpineBindings.bindings.spine_path_constraint_pose_get_mix_y(_ptr); return result; diff --git a/spine-flutter/lib/generated/path_constraint_position_timeline.dart b/spine-flutter/lib/generated/path_constraint_position_timeline.dart index be5c8dc1d..0e9255fc3 100644 --- a/spine-flutter/lib/generated/path_constraint_position_timeline.dart +++ b/spine-flutter/lib/generated/path_constraint_position_timeline.dart @@ -34,7 +34,7 @@ import 'spine_dart_bindings_generated.dart'; import '../spine_bindings.dart'; import 'constraint_timeline1.dart'; -/// PathConstraintPositionTimeline wrapper +/// Changes a path constraint's PathConstraintPose::getPosition(). class PathConstraintPositionTimeline extends ConstraintTimeline1 { final Pointer _ptr; diff --git a/spine-flutter/lib/generated/path_constraint_spacing_timeline.dart b/spine-flutter/lib/generated/path_constraint_spacing_timeline.dart index 1dce7941c..5901063d9 100644 --- a/spine-flutter/lib/generated/path_constraint_spacing_timeline.dart +++ b/spine-flutter/lib/generated/path_constraint_spacing_timeline.dart @@ -34,7 +34,7 @@ import 'spine_dart_bindings_generated.dart'; import '../spine_bindings.dart'; import 'constraint_timeline1.dart'; -/// PathConstraintSpacingTimeline wrapper +/// Changes a path constraint's PathConstraintPose::getSpacing(). class PathConstraintSpacingTimeline extends ConstraintTimeline1 { final Pointer _ptr; diff --git a/spine-flutter/lib/generated/physics_constraint.dart b/spine-flutter/lib/generated/physics_constraint.dart index bc6821a11..b260afb6e 100644 --- a/spine-flutter/lib/generated/physics_constraint.dart +++ b/spine-flutter/lib/generated/physics_constraint.dart @@ -68,14 +68,19 @@ class PhysicsConstraint extends PhysicsConstraintBase { SpineBindings.bindings.spine_physics_constraint_reset(_ptr, skeleton.nativePtr.cast()); } + /// Translates the physics constraint so next update() forces are applied as + /// if the bone moved an additional amount in world space. void translate(double x, double y) { SpineBindings.bindings.spine_physics_constraint_translate(_ptr, x, y); } + /// Rotates the physics constraint so next update() forces are applied as if + /// the bone rotated around the specified point in world space. void rotate(double x, double y, double degrees) { SpineBindings.bindings.spine_physics_constraint_rotate(_ptr, x, y, degrees); } + /// The bone constrained by this physics constraint. BonePose get bone { final result = SpineBindings.bindings.spine_physics_constraint_get_bone(_ptr); return BonePose.fromPointer(result); diff --git a/spine-flutter/lib/generated/physics_constraint_base.dart b/spine-flutter/lib/generated/physics_constraint_base.dart index c0381e9ed..26613498b 100644 --- a/spine-flutter/lib/generated/physics_constraint_base.dart +++ b/spine-flutter/lib/generated/physics_constraint_base.dart @@ -41,7 +41,12 @@ import 'posed.dart'; import 'posed_active.dart'; import 'skeleton.dart'; -/// PhysicsConstraintBase wrapper +/// Stores the current pose for a physics constraint. A physics constraint +/// applies physics to bones. +/// +/// See https://esotericsoftware.com/spine-physics-constraints Physics +/// constraints in the Spine User Guide. Non-exported base class that inherits +/// from the template abstract class PhysicsConstraintBase extends PosedActive implements Posed, Constraint { final Pointer _ptr; @@ -101,6 +106,7 @@ abstract class PhysicsConstraintBase extends PosedActive implements Posed, Const return result; } + /// Inherited from Update @override void update(Skeleton skeleton, Physics physics) { SpineBindings.bindings.spine_physics_constraint_base_update(_ptr, skeleton.nativePtr.cast(), physics.value); diff --git a/spine-flutter/lib/generated/physics_constraint_damping_timeline.dart b/spine-flutter/lib/generated/physics_constraint_damping_timeline.dart index 99e4803a6..2a21f628e 100644 --- a/spine-flutter/lib/generated/physics_constraint_damping_timeline.dart +++ b/spine-flutter/lib/generated/physics_constraint_damping_timeline.dart @@ -34,7 +34,7 @@ import 'spine_dart_bindings_generated.dart'; import '../spine_bindings.dart'; import 'physics_constraint_timeline.dart'; -/// PhysicsConstraintDampingTimeline wrapper +/// Changes a physics constraint's PhysicsConstraintPose::getDamping(). class PhysicsConstraintDampingTimeline extends PhysicsConstraintTimeline { final Pointer _ptr; diff --git a/spine-flutter/lib/generated/physics_constraint_data.dart b/spine-flutter/lib/generated/physics_constraint_data.dart index 0050d2b6b..4e71cf615 100644 --- a/spine-flutter/lib/generated/physics_constraint_data.dart +++ b/spine-flutter/lib/generated/physics_constraint_data.dart @@ -46,7 +46,10 @@ import 'skeleton.dart'; import 'slider.dart'; import 'transform_constraint.dart'; -/// PhysicsConstraintData wrapper +/// Stores the setup pose for a PhysicsConstraint. +/// +/// See https://esotericsoftware.com/spine-physics-constraints Physics +/// constraints in the Spine User Guide. class PhysicsConstraintData extends PosedData implements ConstraintData { final Pointer _ptr; @@ -99,6 +102,7 @@ class PhysicsConstraintData extends PosedData implements ConstraintData { } } + /// The bone constrained by this physics constraint. BoneData get bone { final result = SpineBindings.bindings.spine_physics_constraint_data_get_bone(_ptr); return BoneData.fromPointer(result); diff --git a/spine-flutter/lib/generated/physics_constraint_gravity_timeline.dart b/spine-flutter/lib/generated/physics_constraint_gravity_timeline.dart index 353bb25c2..e4117dd21 100644 --- a/spine-flutter/lib/generated/physics_constraint_gravity_timeline.dart +++ b/spine-flutter/lib/generated/physics_constraint_gravity_timeline.dart @@ -34,7 +34,7 @@ import 'spine_dart_bindings_generated.dart'; import '../spine_bindings.dart'; import 'physics_constraint_timeline.dart'; -/// PhysicsConstraintGravityTimeline wrapper +/// Changes a physics constraint's PhysicsConstraintPose::getGravity(). class PhysicsConstraintGravityTimeline extends PhysicsConstraintTimeline { final Pointer _ptr; diff --git a/spine-flutter/lib/generated/physics_constraint_inertia_timeline.dart b/spine-flutter/lib/generated/physics_constraint_inertia_timeline.dart index 97413aa0a..82ecb02da 100644 --- a/spine-flutter/lib/generated/physics_constraint_inertia_timeline.dart +++ b/spine-flutter/lib/generated/physics_constraint_inertia_timeline.dart @@ -34,7 +34,7 @@ import 'spine_dart_bindings_generated.dart'; import '../spine_bindings.dart'; import 'physics_constraint_timeline.dart'; -/// PhysicsConstraintInertiaTimeline wrapper +/// Changes a physics constraint's PhysicsConstraintPose::getInertia(). class PhysicsConstraintInertiaTimeline extends PhysicsConstraintTimeline { final Pointer _ptr; diff --git a/spine-flutter/lib/generated/physics_constraint_mass_timeline.dart b/spine-flutter/lib/generated/physics_constraint_mass_timeline.dart index fc18af301..68c60bb22 100644 --- a/spine-flutter/lib/generated/physics_constraint_mass_timeline.dart +++ b/spine-flutter/lib/generated/physics_constraint_mass_timeline.dart @@ -34,7 +34,8 @@ import 'spine_dart_bindings_generated.dart'; import '../spine_bindings.dart'; import 'physics_constraint_timeline.dart'; -/// PhysicsConstraintMassTimeline wrapper +/// Changes a physics constraint's PhysicsConstraintPose::getMassInverse(). The +/// timeline values are not inverted. class PhysicsConstraintMassTimeline extends PhysicsConstraintTimeline { final Pointer _ptr; diff --git a/spine-flutter/lib/generated/physics_constraint_mix_timeline.dart b/spine-flutter/lib/generated/physics_constraint_mix_timeline.dart index bf1c9a3f1..ba7add06e 100644 --- a/spine-flutter/lib/generated/physics_constraint_mix_timeline.dart +++ b/spine-flutter/lib/generated/physics_constraint_mix_timeline.dart @@ -34,7 +34,7 @@ import 'spine_dart_bindings_generated.dart'; import '../spine_bindings.dart'; import 'physics_constraint_timeline.dart'; -/// PhysicsConstraintMixTimeline wrapper +/// Changes a physics constraint's PhysicsConstraintPose::getMix(). class PhysicsConstraintMixTimeline extends PhysicsConstraintTimeline { final Pointer _ptr; diff --git a/spine-flutter/lib/generated/physics_constraint_pose.dart b/spine-flutter/lib/generated/physics_constraint_pose.dart index dad361b9e..2cd6d99f6 100644 --- a/spine-flutter/lib/generated/physics_constraint_pose.dart +++ b/spine-flutter/lib/generated/physics_constraint_pose.dart @@ -33,7 +33,7 @@ import 'package:universal_ffi/ffi.dart'; import 'spine_dart_bindings_generated.dart'; import '../spine_bindings.dart'; -/// PhysicsConstraintPose wrapper +/// Stores a pose for a physics constraint. class PhysicsConstraintPose { final Pointer _ptr; @@ -109,6 +109,8 @@ class PhysicsConstraintPose { SpineBindings.bindings.spine_physics_constraint_pose_set_gravity(_ptr, value); } + /// A percentage (0-1) that controls the mix between the constrained and + /// unconstrained poses. double get mix { final result = SpineBindings.bindings.spine_physics_constraint_pose_get_mix(_ptr); return result; diff --git a/spine-flutter/lib/generated/physics_constraint_reset_timeline.dart b/spine-flutter/lib/generated/physics_constraint_reset_timeline.dart index 3edb81ab6..d3d19616f 100644 --- a/spine-flutter/lib/generated/physics_constraint_reset_timeline.dart +++ b/spine-flutter/lib/generated/physics_constraint_reset_timeline.dart @@ -35,7 +35,7 @@ import '../spine_bindings.dart'; import 'constraint_timeline.dart'; import 'timeline.dart'; -/// PhysicsConstraintResetTimeline wrapper +/// Resets a physics constraint when specific animation times are reached. class PhysicsConstraintResetTimeline extends Timeline implements ConstraintTimeline { final Pointer _ptr; @@ -46,6 +46,7 @@ class PhysicsConstraintResetTimeline extends Timeline implements ConstraintTimel @override Pointer get nativePtr => _ptr; + /// [constraintIndex] -1 for all physics constraints in the skeleton. factory PhysicsConstraintResetTimeline(int frameCount, int constraintIndex) { final ptr = SpineBindings.bindings.spine_physics_constraint_reset_timeline_create(frameCount, constraintIndex); return PhysicsConstraintResetTimeline.fromPointer(ptr); @@ -66,6 +67,7 @@ class PhysicsConstraintResetTimeline extends Timeline implements ConstraintTimel SpineBindings.bindings.spine_physics_constraint_reset_timeline_set_constraint_index(_ptr, value); } + /// Sets the time for the specified frame. void setFrame(int frame, double time) { SpineBindings.bindings.spine_physics_constraint_reset_timeline_set_frame(_ptr, frame, time); } diff --git a/spine-flutter/lib/generated/physics_constraint_strength_timeline.dart b/spine-flutter/lib/generated/physics_constraint_strength_timeline.dart index 769cc3205..14a77cda1 100644 --- a/spine-flutter/lib/generated/physics_constraint_strength_timeline.dart +++ b/spine-flutter/lib/generated/physics_constraint_strength_timeline.dart @@ -34,7 +34,7 @@ import 'spine_dart_bindings_generated.dart'; import '../spine_bindings.dart'; import 'physics_constraint_timeline.dart'; -/// PhysicsConstraintStrengthTimeline wrapper +/// Changes a physics constraint's PhysicsConstraintPose::getStrength(). class PhysicsConstraintStrengthTimeline extends PhysicsConstraintTimeline { final Pointer _ptr; diff --git a/spine-flutter/lib/generated/physics_constraint_timeline.dart b/spine-flutter/lib/generated/physics_constraint_timeline.dart index b9bbe86ea..2e2b36907 100644 --- a/spine-flutter/lib/generated/physics_constraint_timeline.dart +++ b/spine-flutter/lib/generated/physics_constraint_timeline.dart @@ -35,7 +35,7 @@ import '../spine_bindings.dart'; import 'constraint_timeline.dart'; import 'curve_timeline1.dart'; -/// PhysicsConstraintTimeline wrapper +/// The base class for most PhysicsConstraint timelines. abstract class PhysicsConstraintTimeline extends CurveTimeline1 implements ConstraintTimeline { final Pointer _ptr; diff --git a/spine-flutter/lib/generated/physics_constraint_wind_timeline.dart b/spine-flutter/lib/generated/physics_constraint_wind_timeline.dart index c20ad83b4..9096c81aa 100644 --- a/spine-flutter/lib/generated/physics_constraint_wind_timeline.dart +++ b/spine-flutter/lib/generated/physics_constraint_wind_timeline.dart @@ -34,7 +34,7 @@ import 'spine_dart_bindings_generated.dart'; import '../spine_bindings.dart'; import 'physics_constraint_timeline.dart'; -/// PhysicsConstraintWindTimeline wrapper +/// Changes a physics constraint's PhysicsConstraintPose::getWind(). class PhysicsConstraintWindTimeline extends PhysicsConstraintTimeline { final Pointer _ptr; diff --git a/spine-flutter/lib/generated/point_attachment.dart b/spine-flutter/lib/generated/point_attachment.dart index d02e9c97d..6b67667d8 100644 --- a/spine-flutter/lib/generated/point_attachment.dart +++ b/spine-flutter/lib/generated/point_attachment.dart @@ -37,7 +37,13 @@ import 'attachment.dart'; import 'bone_pose.dart'; import 'color.dart'; -/// PointAttachment wrapper +/// An attachment which is a single point and a rotation. This can be used to +/// spawn projectiles, particles, etc. A bone can be used in similar ways, but a +/// PointAttachment is slightly less expensive to compute and can be hidden, +/// shown, and placed in a skin. +/// +/// See https://esotericsoftware.com/spine-points for Point Attachments in the +/// Spine User Guide. class PointAttachment extends Attachment { final Pointer _ptr; diff --git a/spine-flutter/lib/generated/posed_active.dart b/spine-flutter/lib/generated/posed_active.dart index 06cb3db6a..36e11d795 100644 --- a/spine-flutter/lib/generated/posed_active.dart +++ b/spine-flutter/lib/generated/posed_active.dart @@ -33,7 +33,7 @@ import 'package:universal_ffi/ffi.dart'; import 'spine_dart_bindings_generated.dart'; import '../spine_bindings.dart'; -/// PosedActive wrapper +/// Simple mixin class that adds active state tracking class PosedActive { final Pointer _ptr; diff --git a/spine-flutter/lib/generated/posed_data.dart b/spine-flutter/lib/generated/posed_data.dart index 8a58ad7ef..37480dbd2 100644 --- a/spine-flutter/lib/generated/posed_data.dart +++ b/spine-flutter/lib/generated/posed_data.dart @@ -52,11 +52,17 @@ class PosedData { SpineBindings.bindings.spine_posed_data_dispose(_ptr); } + /// The constraint's name, which is unique across all constraints in the + /// skeleton of the same type. String get name { final result = SpineBindings.bindings.spine_posed_data_get_name(_ptr); return result.cast().toDartString(); } + /// When true, Skeleton::updateWorldTransform(Physics) only updates this + /// constraint if the Skeleton::getSkin() contains this constraint. + /// + /// See Skin::getConstraints(). bool get skinRequired { final result = SpineBindings.bindings.spine_posed_data_get_skin_required(_ptr); return result; diff --git a/spine-flutter/lib/generated/region_attachment.dart b/spine-flutter/lib/generated/region_attachment.dart index 4ec621736..bdca7b5c7 100644 --- a/spine-flutter/lib/generated/region_attachment.dart +++ b/spine-flutter/lib/generated/region_attachment.dart @@ -40,7 +40,7 @@ import 'sequence.dart'; import 'slot.dart'; import 'texture_region.dart'; -/// RegionAttachment wrapper +/// Attachment that displays a texture region. class RegionAttachment extends Attachment { final Pointer _ptr; diff --git a/spine-flutter/lib/generated/rgb2_timeline.dart b/spine-flutter/lib/generated/rgb2_timeline.dart index 279682eac..d3d370ce9 100644 --- a/spine-flutter/lib/generated/rgb2_timeline.dart +++ b/spine-flutter/lib/generated/rgb2_timeline.dart @@ -34,7 +34,8 @@ import 'spine_dart_bindings_generated.dart'; import '../spine_bindings.dart'; import 'slot_curve_timeline.dart'; -/// Rgb2Timeline wrapper +/// Changes the RGB for a slot's SlotPose::getColor() and +/// SlotPose::getDarkColor() for two color tinting. class Rgb2Timeline extends SlotCurveTimeline { final Pointer _ptr; @@ -54,6 +55,10 @@ class Rgb2Timeline extends SlotCurveTimeline { SpineBindings.bindings.spine_rgb2_timeline_dispose(_ptr); } + /// Sets the time, light color, and dark color for the specified frame. + /// + /// [frame] Between 0 and frameCount, inclusive. + /// [time] The frame time in seconds. void setFrame(int frame, double time, double r, double g, double b, double r2, double g2, double b2) { SpineBindings.bindings.spine_rgb2_timeline_set_frame(_ptr, frame, time, r, g, b, r2, g2, b2); } diff --git a/spine-flutter/lib/generated/rgb_timeline.dart b/spine-flutter/lib/generated/rgb_timeline.dart index 876f7c0f9..fd673a07f 100644 --- a/spine-flutter/lib/generated/rgb_timeline.dart +++ b/spine-flutter/lib/generated/rgb_timeline.dart @@ -34,7 +34,7 @@ import 'spine_dart_bindings_generated.dart'; import '../spine_bindings.dart'; import 'slot_curve_timeline.dart'; -/// RgbTimeline wrapper +/// Changes the RGB for a slot's SlotPose::getColor(). class RgbTimeline extends SlotCurveTimeline { final Pointer _ptr; @@ -54,6 +54,10 @@ class RgbTimeline extends SlotCurveTimeline { SpineBindings.bindings.spine_rgb_timeline_dispose(_ptr); } + /// Sets the time and color for the specified frame. + /// + /// [frame] Between 0 and frameCount, inclusive. + /// [time] The frame time in seconds. void setFrame(int frame, double time, double r, double g, double b) { SpineBindings.bindings.spine_rgb_timeline_set_frame(_ptr, frame, time, r, g, b); } diff --git a/spine-flutter/lib/generated/rgba2_timeline.dart b/spine-flutter/lib/generated/rgba2_timeline.dart index 2af6e2e73..b792637af 100644 --- a/spine-flutter/lib/generated/rgba2_timeline.dart +++ b/spine-flutter/lib/generated/rgba2_timeline.dart @@ -34,7 +34,8 @@ import 'spine_dart_bindings_generated.dart'; import '../spine_bindings.dart'; import 'slot_curve_timeline.dart'; -/// Rgba2Timeline wrapper +/// Changes a slot's SlotPose::getColor() and SlotPose::getDarkColor() for two +/// color tinting. class Rgba2Timeline extends SlotCurveTimeline { final Pointer _ptr; @@ -54,6 +55,10 @@ class Rgba2Timeline extends SlotCurveTimeline { SpineBindings.bindings.spine_rgba2_timeline_dispose(_ptr); } + /// Sets the time, light color, and dark color for the specified frame. + /// + /// [frame] Between 0 and frameCount, inclusive. + /// [time] The frame time in seconds. void setFrame(int frame, double time, double r, double g, double b, double a, double r2, double g2, double b2) { SpineBindings.bindings.spine_rgba2_timeline_set_frame(_ptr, frame, time, r, g, b, a, r2, g2, b2); } diff --git a/spine-flutter/lib/generated/rgba_timeline.dart b/spine-flutter/lib/generated/rgba_timeline.dart index c2838b2b6..71cabe58a 100644 --- a/spine-flutter/lib/generated/rgba_timeline.dart +++ b/spine-flutter/lib/generated/rgba_timeline.dart @@ -34,7 +34,7 @@ import 'spine_dart_bindings_generated.dart'; import '../spine_bindings.dart'; import 'slot_curve_timeline.dart'; -/// RgbaTimeline wrapper +/// Changes a slot's SlotPose::getColor(). class RgbaTimeline extends SlotCurveTimeline { final Pointer _ptr; @@ -54,6 +54,10 @@ class RgbaTimeline extends SlotCurveTimeline { SpineBindings.bindings.spine_rgba_timeline_dispose(_ptr); } + /// Sets the time and color for the specified frame. + /// + /// [frame] Between 0 and frameCount, inclusive. + /// [time] The frame time in seconds. void setFrame(int frame, double time, double r, double g, double b, double a) { SpineBindings.bindings.spine_rgba_timeline_set_frame(_ptr, frame, time, r, g, b, a); } diff --git a/spine-flutter/lib/generated/rotate_timeline.dart b/spine-flutter/lib/generated/rotate_timeline.dart index ae8d9d36b..a3d8fc6e6 100644 --- a/spine-flutter/lib/generated/rotate_timeline.dart +++ b/spine-flutter/lib/generated/rotate_timeline.dart @@ -34,7 +34,7 @@ import 'spine_dart_bindings_generated.dart'; import '../spine_bindings.dart'; import 'bone_timeline1.dart'; -/// RotateTimeline wrapper +/// Changes a bone's local rotation. class RotateTimeline extends BoneTimeline1 { final Pointer _ptr; diff --git a/spine-flutter/lib/generated/scale_timeline.dart b/spine-flutter/lib/generated/scale_timeline.dart index bb75b709f..d1eaeefb5 100644 --- a/spine-flutter/lib/generated/scale_timeline.dart +++ b/spine-flutter/lib/generated/scale_timeline.dart @@ -34,7 +34,7 @@ import 'spine_dart_bindings_generated.dart'; import '../spine_bindings.dart'; import 'bone_timeline2.dart'; -/// ScaleTimeline wrapper +/// Changes a bone's local BoneLocal::getScaleX() and BoneLocal::getScaleY(). class ScaleTimeline extends BoneTimeline2 { final Pointer _ptr; diff --git a/spine-flutter/lib/generated/scale_x_timeline.dart b/spine-flutter/lib/generated/scale_x_timeline.dart index e01868b80..4ce556320 100644 --- a/spine-flutter/lib/generated/scale_x_timeline.dart +++ b/spine-flutter/lib/generated/scale_x_timeline.dart @@ -34,7 +34,7 @@ import 'spine_dart_bindings_generated.dart'; import '../spine_bindings.dart'; import 'bone_timeline1.dart'; -/// ScaleXTimeline wrapper +/// Changes a bone's local BoneLocal::getScaleX(). class ScaleXTimeline extends BoneTimeline1 { final Pointer _ptr; diff --git a/spine-flutter/lib/generated/scale_y_timeline.dart b/spine-flutter/lib/generated/scale_y_timeline.dart index 4c9fdc516..5551380af 100644 --- a/spine-flutter/lib/generated/scale_y_timeline.dart +++ b/spine-flutter/lib/generated/scale_y_timeline.dart @@ -34,7 +34,7 @@ import 'spine_dart_bindings_generated.dart'; import '../spine_bindings.dart'; import 'bone_timeline1.dart'; -/// ScaleYTimeline wrapper +/// Changes a bone's local BoneLocal::getScaleY(). class ScaleYTimeline extends BoneTimeline1 { final Pointer _ptr; diff --git a/spine-flutter/lib/generated/sequence.dart b/spine-flutter/lib/generated/sequence.dart index 987f3fad2..b6ef03e2b 100644 --- a/spine-flutter/lib/generated/sequence.dart +++ b/spine-flutter/lib/generated/sequence.dart @@ -70,6 +70,7 @@ class Sequence { return result.cast().toDartString(); } + /// Returns a unique ID for this attachment. int get id { final result = SpineBindings.bindings.spine_sequence_get_id(_ptr); return result; @@ -97,6 +98,7 @@ class Sequence { SpineBindings.bindings.spine_sequence_set_digits(_ptr, value); } + /// The index of the region to show for the setup pose. int get setupIndex { final result = SpineBindings.bindings.spine_sequence_get_setup_index(_ptr); return result; diff --git a/spine-flutter/lib/generated/sequence_timeline.dart b/spine-flutter/lib/generated/sequence_timeline.dart index 5cf928c8c..cddc0d0f7 100644 --- a/spine-flutter/lib/generated/sequence_timeline.dart +++ b/spine-flutter/lib/generated/sequence_timeline.dart @@ -44,7 +44,7 @@ import 'sequence_mode.dart'; import 'slot_timeline.dart'; import 'timeline.dart'; -/// SequenceTimeline wrapper +/// Changes a slot's SlotPose::getSequenceIndex() for an attachment's Sequence. class SequenceTimeline extends Timeline implements SlotTimeline { final Pointer _ptr; @@ -65,6 +65,10 @@ class SequenceTimeline extends Timeline implements SlotTimeline { SpineBindings.bindings.spine_sequence_timeline_dispose(_ptr); } + /// Sets the time, mode, index, and frame time for the specified frame. + /// + /// [frame] Between 0 and frameCount, inclusive. + /// [delay] Seconds between frames. void setFrame(int frame, double time, SequenceMode mode, int index, double delay) { SpineBindings.bindings.spine_sequence_timeline_set_frame(_ptr, frame, time, mode.value, index, delay); } diff --git a/spine-flutter/lib/generated/shear_timeline.dart b/spine-flutter/lib/generated/shear_timeline.dart index 911eb4133..6f0754322 100644 --- a/spine-flutter/lib/generated/shear_timeline.dart +++ b/spine-flutter/lib/generated/shear_timeline.dart @@ -34,7 +34,7 @@ import 'spine_dart_bindings_generated.dart'; import '../spine_bindings.dart'; import 'bone_timeline2.dart'; -/// ShearTimeline wrapper +/// Changes a bone's local BoneLocal::getShearX() and BoneLocal::getShearY(). class ShearTimeline extends BoneTimeline2 { final Pointer _ptr; diff --git a/spine-flutter/lib/generated/shear_x_timeline.dart b/spine-flutter/lib/generated/shear_x_timeline.dart index d8c1fc4d0..c7e3edbcb 100644 --- a/spine-flutter/lib/generated/shear_x_timeline.dart +++ b/spine-flutter/lib/generated/shear_x_timeline.dart @@ -34,7 +34,7 @@ import 'spine_dart_bindings_generated.dart'; import '../spine_bindings.dart'; import 'bone_timeline1.dart'; -/// ShearXTimeline wrapper +/// Changes a bone's local BoneLocal::getShearX(). class ShearXTimeline extends BoneTimeline1 { final Pointer _ptr; diff --git a/spine-flutter/lib/generated/shear_y_timeline.dart b/spine-flutter/lib/generated/shear_y_timeline.dart index b18b3dcdf..891905545 100644 --- a/spine-flutter/lib/generated/shear_y_timeline.dart +++ b/spine-flutter/lib/generated/shear_y_timeline.dart @@ -34,7 +34,7 @@ import 'spine_dart_bindings_generated.dart'; import '../spine_bindings.dart'; import 'bone_timeline1.dart'; -/// ShearYTimeline wrapper +/// Changes a bone's local BoneLocal::getShearY(). class ShearYTimeline extends BoneTimeline1 { final Pointer _ptr; diff --git a/spine-flutter/lib/generated/skeleton.dart b/spine-flutter/lib/generated/skeleton.dart index 6ebe4b7b2..655cee28d 100644 --- a/spine-flutter/lib/generated/skeleton.dart +++ b/spine-flutter/lib/generated/skeleton.dart @@ -67,6 +67,8 @@ class Skeleton { SpineBindings.bindings.spine_skeleton_dispose(_ptr); } + /// Caches information about bones and constraints. Must be called if bones, + /// constraints or weighted path attachments are added or removed. void updateCache() { SpineBindings.bindings.spine_skeleton_update_cache(_ptr); } @@ -87,14 +89,21 @@ class Skeleton { SpineBindings.bindings.spine_skeleton_sort_reset(bones.nativePtr.cast()); } + /// Updates the world transform for each bone and applies all constraints. + /// + /// See [World + /// transforms](http://esotericsoftware.com/spine-runtime-skeletons#World-transforms) + /// in the Spine Runtimes Guide. void updateWorldTransform(Physics physics) { SpineBindings.bindings.spine_skeleton_update_world_transform(_ptr, physics.value); } + /// Sets the bones, constraints, and slots to their setup pose values. void setupPose() { SpineBindings.bindings.spine_skeleton_setup_pose(_ptr); } + /// Sets the bones and constraints to their setup pose values. void setupPoseBones() { SpineBindings.bindings.spine_skeleton_setup_pose_bones(_ptr); } @@ -123,6 +132,7 @@ class Skeleton { return result.address == 0 ? null : Bone.fromPointer(result); } + /// Returns May be NULL. Bone? findBone(String boneName) { final result = SpineBindings.bindings.spine_skeleton_find_bone(_ptr, boneName.toNativeUtf8().cast()); return result.address == 0 ? null : Bone.fromPointer(result); @@ -133,6 +143,7 @@ class Skeleton { return ArraySlot.fromPointer(result); } + /// Returns May be NULL. Slot? findSlot(String slotName) { final result = SpineBindings.bindings.spine_skeleton_find_slot(_ptr, slotName.toNativeUtf8().cast()); return result.address == 0 ? null : Slot.fromPointer(result); @@ -148,6 +159,7 @@ class Skeleton { return result.address == 0 ? null : Skin.fromPointer(result); } + /// [attachmentName] May be empty. void setAttachment(String slotName, String attachmentName) { SpineBindings.bindings.spine_skeleton_set_attachment( _ptr, slotName.toNativeUtf8().cast(), attachmentName.toNativeUtf8().cast()); @@ -248,10 +260,12 @@ class Skeleton { SpineBindings.bindings.spine_skeleton_set_gravity_y(_ptr, value); } + /// Rotates the physics constraint so next { void physicsTranslate(double x, double y) { SpineBindings.bindings.spine_skeleton_physics_translate(_ptr, x, y); } + /// Calls { void physicsRotate(double x, double y, double degrees) { SpineBindings.bindings.spine_skeleton_physics_rotate(_ptr, x, y, degrees); } @@ -269,14 +283,26 @@ class Skeleton { SpineBindings.bindings.spine_skeleton_update(_ptr, delta); } + /// Sets a skin by name (see setSkin). void setSkin(String skinName) { SpineBindings.bindings.spine_skeleton_set_skin_1(_ptr, skinName.toNativeUtf8().cast()); } + /// Attachments from the new skin are attached if the corresponding attachment + /// from the old skin was attached. If there was no old skin, each slot's + /// setup mode attachment is attached from the new skin. After changing the + /// skin, the visible attachments can be reset to those attached in the setup + /// pose by calling See Skeleton::setSlotsToSetupPose() Also, often + /// AnimationState::apply(Skeleton & ) is called before the next time the + /// skeleton is rendered to allow any attachment keys in the current + /// animation(s) to hide or show attachments from the new skin. + /// + /// [newSkin] May be NULL. void setSkin2(Skin? newSkin) { SpineBindings.bindings.spine_skeleton_set_skin_2(_ptr, newSkin?.nativePtr.cast() ?? Pointer.fromAddress(0)); } + /// Returns May be NULL. Attachment? getAttachment(String slotName, String attachmentName) { final result = SpineBindings.bindings.spine_skeleton_get_attachment_1( _ptr, slotName.toNativeUtf8().cast(), attachmentName.toNativeUtf8().cast()); @@ -307,6 +333,7 @@ class Skeleton { } } + /// Returns May be NULL. Attachment? getAttachment2(int slotIndex, String attachmentName) { final result = SpineBindings.bindings .spine_skeleton_get_attachment_2(_ptr, slotIndex, attachmentName.toNativeUtf8().cast()); diff --git a/spine-flutter/lib/generated/skeleton_bounds.dart b/spine-flutter/lib/generated/skeleton_bounds.dart index 5bc69672f..6fd1bb0b7 100644 --- a/spine-flutter/lib/generated/skeleton_bounds.dart +++ b/spine-flutter/lib/generated/skeleton_bounds.dart @@ -37,7 +37,9 @@ import 'bounding_box_attachment.dart'; import 'polygon.dart'; import 'skeleton.dart'; -/// SkeletonBounds wrapper +/// Collects each BoundingBoxAttachment that is visible and computes the world +/// vertices for its polygon. The polygon vertices are provided along with +/// convenience methods for doing hit detection. class SkeletonBounds { final Pointer _ptr; @@ -55,92 +57,123 @@ class SkeletonBounds { SpineBindings.bindings.spine_skeleton_bounds_dispose(_ptr); } + /// Clears any previous polygons, finds all visible bounding box attachments, + /// and computes the world vertices for each bounding box's polygon. + /// + /// [skeleton] The skeleton. + /// [updateAabb] If true, the axis aligned bounding box containing all the polygons is computed. If false, the SkeletonBounds AABB methods will always return true. void update(Skeleton skeleton, bool updateAabb) { SpineBindings.bindings.spine_skeleton_bounds_update(_ptr, skeleton.nativePtr.cast(), updateAabb); } + /// Returns true if the axis aligned bounding box contains the point. bool aabbContainsPoint(double x, double y) { final result = SpineBindings.bindings.spine_skeleton_bounds_aabb_contains_point(_ptr, x, y); return result; } + /// Returns true if the axis aligned bounding box intersects the line segment. bool aabbIntersectsSegment(double x1, double y1, double x2, double y2) { final result = SpineBindings.bindings.spine_skeleton_bounds_aabb_intersects_segment(_ptr, x1, y1, x2, y2); return result; } + /// Returns true if the axis aligned bounding box intersects the axis aligned + /// bounding box of the specified bounds. bool aabbIntersectsSkeleton(SkeletonBounds bounds) { final result = SpineBindings.bindings.spine_skeleton_bounds_aabb_intersects_skeleton(_ptr, bounds.nativePtr.cast()); return result; } + /// Returns the polygon for the given bounding box attachment or null if no + /// polygon can be found for the attachment. Requires a call to update() + /// first. Polygon? getPolygon(BoundingBoxAttachment? attachment) { final result = SpineBindings.bindings .spine_skeleton_bounds_get_polygon(_ptr, attachment?.nativePtr.cast() ?? Pointer.fromAddress(0)); return result.address == 0 ? null : Polygon.fromPointer(result); } + /// Returns the bounding box for the given polygon or null. Requires a call to + /// update() first. BoundingBoxAttachment? getBoundingBox(Polygon? polygon) { final result = SpineBindings.bindings .spine_skeleton_bounds_get_bounding_box(_ptr, polygon?.nativePtr.cast() ?? Pointer.fromAddress(0)); return result.address == 0 ? null : BoundingBoxAttachment.fromPointer(result); } + /// Returns all polygons or an empty array. Requires a call to update() first. ArrayPolygon get polygons { final result = SpineBindings.bindings.spine_skeleton_bounds_get_polygons(_ptr); return ArrayPolygon.fromPointer(result); } + /// Returns all bounding boxes. Requires a call to update() first. ArrayBoundingBoxAttachment get boundingBoxes { final result = SpineBindings.bindings.spine_skeleton_bounds_get_bounding_boxes(_ptr); return ArrayBoundingBoxAttachment.fromPointer(result); } + /// The left edge of the axis aligned bounding box. double get minX { final result = SpineBindings.bindings.spine_skeleton_bounds_get_min_x(_ptr); return result; } + /// The bottom edge of the axis aligned bounding box. double get minY { final result = SpineBindings.bindings.spine_skeleton_bounds_get_min_y(_ptr); return result; } + /// The right edge of the axis aligned bounding box. double get maxX { final result = SpineBindings.bindings.spine_skeleton_bounds_get_max_x(_ptr); return result; } + /// The top edge of the axis aligned bounding box. double get maxY { final result = SpineBindings.bindings.spine_skeleton_bounds_get_max_y(_ptr); return result; } + /// The width of the axis aligned bounding box. double get width { final result = SpineBindings.bindings.spine_skeleton_bounds_get_width(_ptr); return result; } + /// The height of the axis aligned bounding box. double get height { final result = SpineBindings.bindings.spine_skeleton_bounds_get_height(_ptr); return result; } + /// Returns true if the polygon contains the point. bool containsPoint(Polygon polygon, double x, double y) { final result = SpineBindings.bindings.spine_skeleton_bounds_contains_point_1(_ptr, polygon.nativePtr.cast(), x, y); return result; } + /// Returns the first bounding box attachment that contains the point, or + /// null. When doing many checks, it is usually more efficient to only call + /// this method if aabbContainsPoint(float, float) returns true. BoundingBoxAttachment? containsPoint2(double x, double y) { final result = SpineBindings.bindings.spine_skeleton_bounds_contains_point_2(_ptr, x, y); return result.address == 0 ? null : BoundingBoxAttachment.fromPointer(result); } + /// Returns the first bounding box attachment that contains any part of the + /// line segment, or null. When doing many checks, it is usually more + /// efficient to only call this method if aabbIntersectsSegment(float, float, + /// float, float) returns true. BoundingBoxAttachment? intersectsSegment(double x1, double y1, double x2, double y2) { final result = SpineBindings.bindings.spine_skeleton_bounds_intersects_segment_1(_ptr, x1, y1, x2, y2); return result.address == 0 ? null : BoundingBoxAttachment.fromPointer(result); } + /// Returns true if the polygon contains any part of the line segment. bool intersectsSegment2(Polygon polygon, double x1, double y1, double x2, double y2) { final result = SpineBindings.bindings .spine_skeleton_bounds_intersects_segment_2(_ptr, polygon.nativePtr.cast(), x1, y1, x2, y2); diff --git a/spine-flutter/lib/generated/skeleton_data.dart b/spine-flutter/lib/generated/skeleton_data.dart index d82386827..7ac047c33 100644 --- a/spine-flutter/lib/generated/skeleton_data.dart +++ b/spine-flutter/lib/generated/skeleton_data.dart @@ -40,7 +40,9 @@ import 'event_data.dart'; import 'skin.dart'; import 'slot_data.dart'; -/// SkeletonData wrapper +/// Stores the setup pose and all of the stateless data for a skeleton. +/// +/// See Data objects in the Spine Runtimes Guide. class SkeletonData { final Pointer _ptr; @@ -58,33 +60,43 @@ class SkeletonData { SpineBindings.bindings.spine_skeleton_data_dispose(_ptr); } + /// Finds a bone by comparing each bone's name. It is more efficient to cache + /// the results of this method than to call it multiple times. + /// + /// Returns May be NULL. BoneData? findBone(String boneName) { final result = SpineBindings.bindings.spine_skeleton_data_find_bone(_ptr, boneName.toNativeUtf8().cast()); return result.address == 0 ? null : BoneData.fromPointer(result); } + /// Returns May be NULL. SlotData? findSlot(String slotName) { final result = SpineBindings.bindings.spine_skeleton_data_find_slot(_ptr, slotName.toNativeUtf8().cast()); return result.address == 0 ? null : SlotData.fromPointer(result); } + /// Returns May be NULL. Skin? findSkin(String skinName) { final result = SpineBindings.bindings.spine_skeleton_data_find_skin(_ptr, skinName.toNativeUtf8().cast()); return result.address == 0 ? null : Skin.fromPointer(result); } + /// Returns May be NULL. EventData? findEvent(String eventDataName) { final result = SpineBindings.bindings.spine_skeleton_data_find_event(_ptr, eventDataName.toNativeUtf8().cast()); return result.address == 0 ? null : EventData.fromPointer(result); } + /// Returns May be NULL. Animation? findAnimation(String animationName) { final result = SpineBindings.bindings.spine_skeleton_data_find_animation(_ptr, animationName.toNativeUtf8().cast()); return result.address == 0 ? null : Animation.fromPointer(result); } + /// The skeleton's name, which by default is the name of the skeleton data + /// file when possible, or null when a name hasn't been set. String get name { final result = SpineBindings.bindings.spine_skeleton_data_get_name(_ptr); return result.cast().toDartString(); @@ -94,21 +106,29 @@ class SkeletonData { SpineBindings.bindings.spine_skeleton_data_set_name(_ptr, value.toNativeUtf8().cast()); } + /// The skeleton's bones, sorted parent first. The root bone is always the + /// first bone. ArrayBoneData get bones { final result = SpineBindings.bindings.spine_skeleton_data_get_bones(_ptr); return ArrayBoneData.fromPointer(result); } + /// The skeleton's slots in the setup pose draw order. ArraySlotData get slots { final result = SpineBindings.bindings.spine_skeleton_data_get_slots(_ptr); return ArraySlotData.fromPointer(result); } + /// All skins, including the default skin. ArraySkin get skins { final result = SpineBindings.bindings.spine_skeleton_data_get_skins(_ptr); return ArraySkin.fromPointer(result); } + /// The skeleton's default skin. By default this skin contains all attachments + /// that were not in a skin in Spine. + /// + /// Returns May be NULL. Skin? get defaultSkin { final result = SpineBindings.bindings.spine_skeleton_data_get_default_skin(_ptr); return result.address == 0 ? null : Skin.fromPointer(result); @@ -119,21 +139,26 @@ class SkeletonData { .spine_skeleton_data_set_default_skin(_ptr, value?.nativePtr.cast() ?? Pointer.fromAddress(0)); } + /// The skeleton's events. ArrayEventData get events { final result = SpineBindings.bindings.spine_skeleton_data_get_events(_ptr); return ArrayEventData.fromPointer(result); } + /// The skeleton's animations. ArrayAnimation get animations { final result = SpineBindings.bindings.spine_skeleton_data_get_animations(_ptr); return ArrayAnimation.fromPointer(result); } + /// The skeleton's constraints. ArrayConstraintData get constraints { final result = SpineBindings.bindings.spine_skeleton_data_get_constraints(_ptr); return ArrayConstraintData.fromPointer(result); } + /// The X coordinate of the skeleton's axis aligned bounding box in the setup + /// pose. double get x { final result = SpineBindings.bindings.spine_skeleton_data_get_x(_ptr); return result; @@ -143,6 +168,8 @@ class SkeletonData { SpineBindings.bindings.spine_skeleton_data_set_x(_ptr, value); } + /// The Y coordinate of the skeleton's axis aligned bounding box in the setup + /// pose. double get y { final result = SpineBindings.bindings.spine_skeleton_data_get_y(_ptr); return result; @@ -152,6 +179,7 @@ class SkeletonData { SpineBindings.bindings.spine_skeleton_data_set_y(_ptr, value); } + /// The width of the skeleton's axis aligned bounding box in the setup pose. double get width { final result = SpineBindings.bindings.spine_skeleton_data_get_width(_ptr); return result; @@ -161,6 +189,7 @@ class SkeletonData { SpineBindings.bindings.spine_skeleton_data_set_width(_ptr, value); } + /// The height of the skeleton's axis aligned bounding box in the setup pose. double get height { final result = SpineBindings.bindings.spine_skeleton_data_get_height(_ptr); return result; @@ -170,6 +199,9 @@ class SkeletonData { SpineBindings.bindings.spine_skeleton_data_set_height(_ptr, value); } + /// Baseline scale factor for applying physics and other effects based on + /// distance to non-scalable properties, such as angle or scale. Default is + /// 100. double get referenceScale { final result = SpineBindings.bindings.spine_skeleton_data_get_reference_scale(_ptr); return result; @@ -179,6 +211,7 @@ class SkeletonData { SpineBindings.bindings.spine_skeleton_data_set_reference_scale(_ptr, value); } + /// The Spine version used to export this data, or NULL. String get version { final result = SpineBindings.bindings.spine_skeleton_data_get_version(_ptr); return result.cast().toDartString(); @@ -188,6 +221,8 @@ class SkeletonData { SpineBindings.bindings.spine_skeleton_data_set_version(_ptr, value.toNativeUtf8().cast()); } + /// The skeleton data hash. This value will change if any of the skeleton data + /// has changed. String get hash { final result = SpineBindings.bindings.spine_skeleton_data_get_hash(_ptr); return result.cast().toDartString(); @@ -197,6 +232,8 @@ class SkeletonData { SpineBindings.bindings.spine_skeleton_data_set_hash(_ptr, value.toNativeUtf8().cast()); } + /// The path to the images directory as defined in Spine, or null if + /// nonessential data was not exported. String get imagesPath { final result = SpineBindings.bindings.spine_skeleton_data_get_images_path(_ptr); return result.cast().toDartString(); @@ -206,6 +243,8 @@ class SkeletonData { SpineBindings.bindings.spine_skeleton_data_set_images_path(_ptr, value.toNativeUtf8().cast()); } + /// The path to the audio directory as defined in Spine, or null if + /// nonessential data was not exported. String get audioPath { final result = SpineBindings.bindings.spine_skeleton_data_get_audio_path(_ptr); return result.cast().toDartString(); @@ -215,6 +254,8 @@ class SkeletonData { SpineBindings.bindings.spine_skeleton_data_set_audio_path(_ptr, value.toNativeUtf8().cast()); } + /// The dopesheet FPS in Spine. Available only when nonessential data was + /// exported. double get fps { final result = SpineBindings.bindings.spine_skeleton_data_get_fps(_ptr); return result; diff --git a/spine-flutter/lib/generated/skin.dart b/spine-flutter/lib/generated/skin.dart index f2ce87ccc..a28646d15 100644 --- a/spine-flutter/lib/generated/skin.dart +++ b/spine-flutter/lib/generated/skin.dart @@ -43,7 +43,9 @@ import 'path_attachment.dart'; import 'point_attachment.dart'; import 'region_attachment.dart'; -/// Skin wrapper +/// Stores attachments by slot index and attachment name. See +/// SkeletonData::getDefaultSkin, Skeleton::getSkin, and +/// http://esotericsoftware.com/spine-runtime-skins in the Spine Runtimes Guide. class Skin { final Pointer _ptr; @@ -61,11 +63,14 @@ class Skin { SpineBindings.bindings.spine_skin_dispose(_ptr); } + /// Adds an attachment to the skin for the specified slot index and name. If + /// the name already exists for the slot, the previous value is replaced. void setAttachment(int slotIndex, String name, Attachment attachment) { SpineBindings.bindings .spine_skin_set_attachment(_ptr, slotIndex, name.toNativeUtf8().cast(), attachment.nativePtr.cast()); } + /// Returns the attachment for the specified slot index and name, or NULL. Attachment? getAttachment(int slotIndex, String name) { final result = SpineBindings.bindings.spine_skin_get_attachment(_ptr, slotIndex, name.toNativeUtf8().cast()); if (result.address == 0) return null; @@ -95,10 +100,16 @@ class Skin { } } + /// Removes the attachment from the skin. void removeAttachment(int slotIndex, String name) { SpineBindings.bindings.spine_skin_remove_attachment(_ptr, slotIndex, name.toNativeUtf8().cast()); } + /// Finds the attachments for a given slot. The results are added to the + /// passed array of Attachments. + /// + /// [slotIndex] The target slotIndex. To find the slot index, use SkeletonData::findSlot and SlotData::getIndex. + /// [attachments] Found Attachments will be added to this array. void findAttachmentsForSlot(int slotIndex, ArrayAttachment attachments) { SpineBindings.bindings.spine_skin_find_attachments_for_slot(_ptr, slotIndex, attachments.nativePtr.cast()); } @@ -108,10 +119,14 @@ class Skin { return result.cast().toDartString(); } + /// Adds all attachments, bones, and constraints from the specified skin to + /// this skin. void addSkin(Skin other) { SpineBindings.bindings.spine_skin_add_skin(_ptr, other.nativePtr.cast()); } + /// Adds all attachments, bones, and constraints from the specified skin to + /// this skin. Attachments are deep copied. void copySkin(Skin other) { SpineBindings.bindings.spine_skin_copy_skin(_ptr, other.nativePtr.cast()); } diff --git a/spine-flutter/lib/generated/slider_base.dart b/spine-flutter/lib/generated/slider_base.dart index 82b0df4a6..0903c95f7 100644 --- a/spine-flutter/lib/generated/slider_base.dart +++ b/spine-flutter/lib/generated/slider_base.dart @@ -41,7 +41,11 @@ import 'skeleton.dart'; import 'slider_data.dart'; import 'slider_pose.dart'; -/// SliderBase wrapper +/// Stores the setup pose for a PhysicsConstraint. +/// +/// See https://esotericsoftware.com/spine-physics-constraints Physics +/// constraints in the Spine User Guide. Non-exported base class that inherits +/// from the template abstract class SliderBase extends PosedActive implements Posed, Constraint { final Pointer _ptr; @@ -101,6 +105,7 @@ abstract class SliderBase extends PosedActive implements Posed, Constraint { return result; } + /// Inherited from Update @override void update(Skeleton skeleton, Physics physics) { SpineBindings.bindings.spine_slider_base_update(_ptr, skeleton.nativePtr.cast(), physics.value); diff --git a/spine-flutter/lib/generated/slider_data.dart b/spine-flutter/lib/generated/slider_data.dart index 610664963..942d5f204 100644 --- a/spine-flutter/lib/generated/slider_data.dart +++ b/spine-flutter/lib/generated/slider_data.dart @@ -54,7 +54,7 @@ import 'slider.dart'; import 'slider_pose.dart'; import 'transform_constraint.dart'; -/// SliderData wrapper +/// Stores the setup pose for a Slider class SliderData extends PosedData implements ConstraintData { final Pointer _ptr; @@ -81,6 +81,7 @@ class SliderData extends PosedData implements ConstraintData { return Rtti.fromPointer(result); } + /// Creates a slider instance. @override Constraint createMethod(Skeleton skeleton) { final result = SpineBindings.bindings.spine_slider_data_create_method(_ptr, skeleton.nativePtr.cast()); diff --git a/spine-flutter/lib/generated/slider_mix_timeline.dart b/spine-flutter/lib/generated/slider_mix_timeline.dart index 91c703a8c..cc21776c9 100644 --- a/spine-flutter/lib/generated/slider_mix_timeline.dart +++ b/spine-flutter/lib/generated/slider_mix_timeline.dart @@ -34,7 +34,7 @@ import 'spine_dart_bindings_generated.dart'; import '../spine_bindings.dart'; import 'constraint_timeline1.dart'; -/// SliderMixTimeline wrapper +/// Changes a slider's SliderPose::getMix(). class SliderMixTimeline extends ConstraintTimeline1 { final Pointer _ptr; diff --git a/spine-flutter/lib/generated/slider_pose.dart b/spine-flutter/lib/generated/slider_pose.dart index 12f3ce875..b6ff0b023 100644 --- a/spine-flutter/lib/generated/slider_pose.dart +++ b/spine-flutter/lib/generated/slider_pose.dart @@ -33,7 +33,7 @@ import 'package:universal_ffi/ffi.dart'; import 'spine_dart_bindings_generated.dart'; import '../spine_bindings.dart'; -/// SliderPose wrapper +/// Stores a pose for a slider. class SliderPose { final Pointer _ptr; diff --git a/spine-flutter/lib/generated/slider_timeline.dart b/spine-flutter/lib/generated/slider_timeline.dart index fa00942ef..271fc57c2 100644 --- a/spine-flutter/lib/generated/slider_timeline.dart +++ b/spine-flutter/lib/generated/slider_timeline.dart @@ -34,7 +34,7 @@ import 'spine_dart_bindings_generated.dart'; import '../spine_bindings.dart'; import 'constraint_timeline1.dart'; -/// SliderTimeline wrapper +/// Changes a slider's SliderPose::getTime(). class SliderTimeline extends ConstraintTimeline1 { final Pointer _ptr; diff --git a/spine-flutter/lib/generated/slot.dart b/spine-flutter/lib/generated/slot.dart index 28e7850e1..34a5a43d7 100644 --- a/spine-flutter/lib/generated/slot.dart +++ b/spine-flutter/lib/generated/slot.dart @@ -38,7 +38,10 @@ import 'skeleton.dart'; import 'slot_data.dart'; import 'slot_pose.dart'; -/// Slot wrapper +/// Stores a slot's current pose. Slots organize attachments for Skeleton +/// drawOrder purposes and provide a place to store state for an attachment. +/// State cannot be stored in an attachment itself because attachments are +/// stateless and may be shared across multiple skeletons. class Slot implements Posed { final Pointer _ptr; @@ -57,6 +60,7 @@ class Slot implements Posed { SpineBindings.bindings.spine_slot_dispose(_ptr); } + /// The bone this slot belongs to. Bone get bone { final result = SpineBindings.bindings.spine_slot_get_bone(_ptr); return Bone.fromPointer(result); @@ -66,6 +70,7 @@ class Slot implements Posed { SpineBindings.bindings.spine_slot_setup_pose(_ptr); } + /// The constraint's setup pose data. SlotData get data { final result = SpineBindings.bindings.spine_slot_get_data(_ptr); return SlotData.fromPointer(result); diff --git a/spine-flutter/lib/generated/slot_curve_timeline.dart b/spine-flutter/lib/generated/slot_curve_timeline.dart index bf8a7eba8..69f8ec736 100644 --- a/spine-flutter/lib/generated/slot_curve_timeline.dart +++ b/spine-flutter/lib/generated/slot_curve_timeline.dart @@ -35,7 +35,7 @@ import '../spine_bindings.dart'; import 'curve_timeline.dart'; import 'slot_timeline.dart'; -/// SlotCurveTimeline wrapper +/// Base class for slot timelines that use curves. abstract class SlotCurveTimeline extends CurveTimeline implements SlotTimeline { final Pointer _ptr; diff --git a/spine-flutter/lib/generated/slot_data.dart b/spine-flutter/lib/generated/slot_data.dart index 6760ac77e..2f761a094 100644 --- a/spine-flutter/lib/generated/slot_data.dart +++ b/spine-flutter/lib/generated/slot_data.dart @@ -38,7 +38,7 @@ import 'bone_data.dart'; import 'posed_data.dart'; import 'slot_pose.dart'; -/// SlotData wrapper +/// Stores the setup pose for a Slot. class SlotData extends PosedData { final Pointer _ptr; @@ -59,11 +59,13 @@ class SlotData extends PosedData { SpineBindings.bindings.spine_slot_data_dispose(_ptr); } + /// The index of the slot in Skeleton::getSlots(). int get index { final result = SpineBindings.bindings.spine_slot_data_get_index(_ptr); return result; } + /// The bone this slot belongs to. BoneData get boneData { final result = SpineBindings.bindings.spine_slot_data_get_bone_data(_ptr); return BoneData.fromPointer(result); @@ -73,11 +75,14 @@ class SlotData extends PosedData { SpineBindings.bindings.spine_slot_data_set_attachment_name(_ptr, value.toNativeUtf8().cast()); } + /// The name of the attachment that is visible for this slot in the setup + /// pose, or empty if no attachment is visible. String get attachmentName { final result = SpineBindings.bindings.spine_slot_data_get_attachment_name(_ptr); return result.cast().toDartString(); } + /// The blend mode for drawing the slot's attachment. BlendMode get blendMode { final result = SpineBindings.bindings.spine_slot_data_get_blend_mode(_ptr); return BlendMode.fromValue(result); @@ -87,6 +92,8 @@ class SlotData extends PosedData { SpineBindings.bindings.spine_slot_data_set_blend_mode(_ptr, value.value); } + /// False if the slot was hidden in Spine and nonessential data was exported. + /// Does not affect runtime rendering. bool get visible { final result = SpineBindings.bindings.spine_slot_data_get_visible(_ptr); return result; diff --git a/spine-flutter/lib/generated/slot_pose.dart b/spine-flutter/lib/generated/slot_pose.dart index 95c16f2fd..ccbe9d111 100644 --- a/spine-flutter/lib/generated/slot_pose.dart +++ b/spine-flutter/lib/generated/slot_pose.dart @@ -65,16 +65,21 @@ class SlotPose { SpineBindings.bindings.spine_slot_pose_set(_ptr, pose.nativePtr.cast()); } + /// The color used to tint the slot's attachment. If getDarkColor() is set, + /// this is used as the light color for two color tinting. Color get color { final result = SpineBindings.bindings.spine_slot_pose_get_color(_ptr); return Color.fromPointer(result); } + /// The dark color used to tint the slot's attachment for two color tinting. + /// The dark color's alpha is not used. Color get darkColor { final result = SpineBindings.bindings.spine_slot_pose_get_dark_color(_ptr); return Color.fromPointer(result); } + /// Returns true if this slot has a dark color. bool get hasDarkColor { final result = SpineBindings.bindings.spine_slot_pose_has_dark_color(_ptr); return result; @@ -84,6 +89,8 @@ class SlotPose { SpineBindings.bindings.spine_slot_pose_set_has_dark_color(_ptr, value); } + /// The current attachment for the slot, or null if the slot has no + /// attachment. Attachment? get attachment { final result = SpineBindings.bindings.spine_slot_pose_get_attachment(_ptr); if (result.address == 0) return null; @@ -113,10 +120,16 @@ class SlotPose { } } + /// Sets the slot's attachment and, if the attachment changed, resets + /// sequenceIndex and clears the deform. The deform is not cleared if the old + /// attachment has the same VertexAttachment::getTimelineAttachment() as the + /// specified attachment. set attachment(Attachment? value) { SpineBindings.bindings.spine_slot_pose_set_attachment(_ptr, value?.nativePtr.cast() ?? Pointer.fromAddress(0)); } + /// The index of the texture region to display when the slot's attachment has + /// a Sequence. -1 represents the Sequence::getSetupIndex(). int get sequenceIndex { final result = SpineBindings.bindings.spine_slot_pose_get_sequence_index(_ptr); return result; @@ -126,6 +139,12 @@ class SlotPose { SpineBindings.bindings.spine_slot_pose_set_sequence_index(_ptr, value); } + /// Values to deform the slot's attachment. For an unweighted mesh, the + /// entries are local positions for each vertex. For a weighted mesh, the + /// entries are an offset for each vertex which will be added to the mesh's + /// local vertex positions. + /// + /// See VertexAttachment::computeWorldVertices() and DeformTimeline. ArrayFloat get deform { final result = SpineBindings.bindings.spine_slot_pose_get_deform(_ptr); return ArrayFloat.fromPointer(result); diff --git a/spine-flutter/lib/generated/slot_timeline.dart b/spine-flutter/lib/generated/slot_timeline.dart index 407abd3f7..da70a8265 100644 --- a/spine-flutter/lib/generated/slot_timeline.dart +++ b/spine-flutter/lib/generated/slot_timeline.dart @@ -33,7 +33,7 @@ import 'package:universal_ffi/ffi.dart'; import '../spine_bindings.dart'; import 'rtti.dart'; -/// SlotTimeline wrapper +/// An interface for timelines which change the property of a slot. abstract class SlotTimeline { Pointer get nativePtr; Rtti get rtti; diff --git a/spine-flutter/lib/generated/spine_dart_bindings_generated.dart b/spine-flutter/lib/generated/spine_dart_bindings_generated.dart index 9ccdb381b..6adc27be5 100644 --- a/spine-flutter/lib/generated/spine_dart_bindings_generated.dart +++ b/spine-flutter/lib/generated/spine_dart_bindings_generated.dart @@ -5900,6 +5900,7 @@ class SpineDartBindings { late final _spine_bone_pose_get_rtti = _spine_bone_pose_get_rttiPtr.asFunction(); + /// Called by Skeleton::updateCache() to compute the world transform, if needed. void spine_bone_pose_update( spine_bone_pose self, spine_skeleton skeleton, @@ -5918,6 +5919,10 @@ class SpineDartBindings { late final _spine_bone_pose_update = _spine_bone_pose_updatePtr.asFunction(); + /// Computes the world transform using the parent bone's applied pose and this + /// pose. Child bones are not updated. + /// + /// See World transforms in the Spine Runtimes Guide. void spine_bone_pose_update_world_transform( spine_bone_pose self, spine_skeleton skeleton, @@ -5934,6 +5939,17 @@ class SpineDartBindings { late final _spine_bone_pose_update_world_transform = _spine_bone_pose_update_world_transformPtr.asFunction(); + /// Computes the local transform values from the world transform. + /// + /// If the world transform is modified (by a constraint, rotateWorld(), etc) then + /// this method should be called so the local transform matches the world + /// transform. The local transform may be needed by other code (eg to apply + /// another constraint). + /// + /// Some information is ambiguous in the world transform, such as -1,-1 scale + /// versus 180 rotation. The local transform after calling this method is + /// equivalent to the local transform used to compute the world transform, but + /// may not be identical. void spine_bone_pose_update_local_transform( spine_bone_pose self, spine_skeleton skeleton, @@ -5950,6 +5966,8 @@ class SpineDartBindings { late final _spine_bone_pose_update_local_transform = _spine_bone_pose_update_local_transformPtr.asFunction(); + /// If the world transform has been modified and the local transform no longer + /// matches, updateLocalTransform() is called. void spine_bone_pose_validate_local_transform( spine_bone_pose self, spine_skeleton skeleton, @@ -6011,6 +6029,8 @@ class SpineDartBindings { late final _spine_bone_pose_reset_world = _spine_bone_pose_reset_worldPtr.asFunction(); + /// Part of the world transform matrix for the X axis. If changed, + /// updateLocalTransform() should be called. double spine_bone_pose_get_a( spine_bone_pose self, ) { @@ -6037,6 +6057,8 @@ class SpineDartBindings { _lookup>('spine_bone_pose_set_a'); late final _spine_bone_pose_set_a = _spine_bone_pose_set_aPtr.asFunction(); + /// Part of the world transform matrix for the Y axis. If changed, + /// updateLocalTransform() should be called. double spine_bone_pose_get_b( spine_bone_pose self, ) { @@ -6063,6 +6085,8 @@ class SpineDartBindings { _lookup>('spine_bone_pose_set_b'); late final _spine_bone_pose_set_b = _spine_bone_pose_set_bPtr.asFunction(); + /// Part of the world transform matrix for the X axis. If changed, + /// updateLocalTransform() should be called. double spine_bone_pose_get_c( spine_bone_pose self, ) { @@ -6089,6 +6113,8 @@ class SpineDartBindings { _lookup>('spine_bone_pose_set_c'); late final _spine_bone_pose_set_c = _spine_bone_pose_set_cPtr.asFunction(); + /// Part of the world transform matrix for the Y axis. If changed, + /// updateLocalTransform() should be called. double spine_bone_pose_get_d( spine_bone_pose self, ) { @@ -6115,6 +6141,7 @@ class SpineDartBindings { _lookup>('spine_bone_pose_set_d'); late final _spine_bone_pose_set_d = _spine_bone_pose_set_dPtr.asFunction(); + /// The world X position. If changed, updateLocalTransform() should be called. double spine_bone_pose_get_world_x( spine_bone_pose self, ) { @@ -6143,6 +6170,7 @@ class SpineDartBindings { late final _spine_bone_pose_set_world_x = _spine_bone_pose_set_world_xPtr.asFunction(); + /// The world Y position. If changed, updateLocalTransform() should be called. double spine_bone_pose_get_world_y( spine_bone_pose self, ) { @@ -6171,6 +6199,7 @@ class SpineDartBindings { late final _spine_bone_pose_set_world_y = _spine_bone_pose_set_world_yPtr.asFunction(); + /// The world rotation for the X axis, calculated using a and c. double spine_bone_pose_get_world_rotation_x( spine_bone_pose self, ) { @@ -6184,6 +6213,7 @@ class SpineDartBindings { late final _spine_bone_pose_get_world_rotation_x = _spine_bone_pose_get_world_rotation_xPtr.asFunction(); + /// The world rotation for the Y axis, calculated using b and d. double spine_bone_pose_get_world_rotation_y( spine_bone_pose self, ) { @@ -6197,6 +6227,8 @@ class SpineDartBindings { late final _spine_bone_pose_get_world_rotation_y = _spine_bone_pose_get_world_rotation_yPtr.asFunction(); + /// The magnitude (always positive) of the world scale X, calculated using a and + /// c. double spine_bone_pose_get_world_scale_x( spine_bone_pose self, ) { @@ -6210,6 +6242,8 @@ class SpineDartBindings { late final _spine_bone_pose_get_world_scale_x = _spine_bone_pose_get_world_scale_xPtr.asFunction(); + /// The magnitude (always positive) of the world scale Y, calculated using b and + /// d. double spine_bone_pose_get_world_scale_y( spine_bone_pose self, ) { @@ -6223,6 +6257,7 @@ class SpineDartBindings { late final _spine_bone_pose_get_world_scale_y = _spine_bone_pose_get_world_scale_yPtr.asFunction(); + /// Transforms a point from world coordinates to the bone's local coordinates. void spine_bone_pose_world_to_local( spine_bone_pose self, double worldX, @@ -6246,6 +6281,7 @@ class SpineDartBindings { late final _spine_bone_pose_world_to_local = _spine_bone_pose_world_to_localPtr .asFunction, ffi.Pointer)>(); + /// Transforms a point from the bone's local coordinates to world coordinates. void spine_bone_pose_local_to_world( spine_bone_pose self, double localX, @@ -6269,6 +6305,8 @@ class SpineDartBindings { late final _spine_bone_pose_local_to_world = _spine_bone_pose_local_to_worldPtr .asFunction, ffi.Pointer)>(); + /// Transforms a point from world coordinates to the parent bone's local + /// coordinates. void spine_bone_pose_world_to_parent( spine_bone_pose self, double worldX, @@ -6292,6 +6330,7 @@ class SpineDartBindings { late final _spine_bone_pose_world_to_parent = _spine_bone_pose_world_to_parentPtr .asFunction, ffi.Pointer)>(); + /// Transforms a point from the parent bone's coordinates to world coordinates. void spine_bone_pose_parent_to_world( spine_bone_pose self, double parentX, @@ -6315,6 +6354,7 @@ class SpineDartBindings { late final _spine_bone_pose_parent_to_world = _spine_bone_pose_parent_to_worldPtr .asFunction, ffi.Pointer)>(); + /// Transforms a world rotation to a local rotation. double spine_bone_pose_world_to_local_rotation( spine_bone_pose self, double worldRotation, @@ -6331,6 +6371,7 @@ class SpineDartBindings { late final _spine_bone_pose_world_to_local_rotation = _spine_bone_pose_world_to_local_rotationPtr.asFunction(); + /// Transforms a local rotation to a world rotation. double spine_bone_pose_local_to_world_rotation( spine_bone_pose self, double localRotation, @@ -6347,6 +6388,10 @@ class SpineDartBindings { late final _spine_bone_pose_local_to_world_rotation = _spine_bone_pose_local_to_world_rotationPtr.asFunction(); + /// Rotates the world transform the specified amount. + /// + /// After changes are made to the world transform, updateLocalTransform() should + /// be called on this bone and any child bones, recursively. void spine_bone_pose_rotate_world( spine_bone_pose self, double degrees, @@ -6377,6 +6422,7 @@ class SpineDartBindings { late final _spine_bone_pose_set = _spine_bone_pose_setPtr.asFunction(); + /// The local x translation. double spine_bone_pose_get_x( spine_bone_pose self, ) { @@ -6403,6 +6449,7 @@ class SpineDartBindings { _lookup>('spine_bone_pose_set_x'); late final _spine_bone_pose_set_x = _spine_bone_pose_set_xPtr.asFunction(); + /// The local y translation. double spine_bone_pose_get_y( spine_bone_pose self, ) { @@ -6447,6 +6494,7 @@ class SpineDartBindings { late final _spine_bone_pose_set_position = _spine_bone_pose_set_positionPtr.asFunction(); + /// The local rotation in degrees, counter clockwise. double spine_bone_pose_get_rotation( spine_bone_pose self, ) { @@ -6475,6 +6523,7 @@ class SpineDartBindings { late final _spine_bone_pose_set_rotation = _spine_bone_pose_set_rotationPtr.asFunction(); + /// The local scaleX. double spine_bone_pose_get_scale_x( spine_bone_pose self, ) { @@ -6503,6 +6552,7 @@ class SpineDartBindings { late final _spine_bone_pose_set_scale_x = _spine_bone_pose_set_scale_xPtr.asFunction(); + /// The local scaleY. double spine_bone_pose_get_scale_y( spine_bone_pose self, ) { @@ -6564,6 +6614,7 @@ class SpineDartBindings { late final _spine_bone_pose_set_scale_2 = _spine_bone_pose_set_scale_2Ptr.asFunction(); + /// The local shearX. double spine_bone_pose_get_shear_x( spine_bone_pose self, ) { @@ -6592,6 +6643,7 @@ class SpineDartBindings { late final _spine_bone_pose_set_shear_x = _spine_bone_pose_set_shear_xPtr.asFunction(); + /// The local shearY. double spine_bone_pose_get_shear_y( spine_bone_pose self, ) { @@ -6620,6 +6672,7 @@ class SpineDartBindings { late final _spine_bone_pose_set_shear_y = _spine_bone_pose_set_shear_yPtr.asFunction(); + /// Determines how parent world transforms affect this bone. int spine_bone_pose_get_inherit( spine_bone_pose self, ) { @@ -6820,6 +6873,8 @@ class SpineDartBindings { late final _spine_skeleton_data_find_animation = _spine_skeleton_data_find_animationPtr .asFunction)>(); + /// The skeleton's name, which by default is the name of the skeleton data file + /// when possible, or null when a name hasn't been set. ffi.Pointer spine_skeleton_data_get_name( spine_skeleton_data self, ) { @@ -6849,6 +6904,8 @@ class SpineDartBindings { late final _spine_skeleton_data_set_name = _spine_skeleton_data_set_namePtr.asFunction)>(); + /// The skeleton's bones, sorted parent first. The root bone is always the first + /// bone. spine_array_bone_data spine_skeleton_data_get_bones( spine_skeleton_data self, ) { @@ -6862,6 +6919,7 @@ class SpineDartBindings { late final _spine_skeleton_data_get_bones = _spine_skeleton_data_get_bonesPtr.asFunction(); + /// The skeleton's slots in the setup pose draw order. spine_array_slot_data spine_skeleton_data_get_slots( spine_skeleton_data self, ) { @@ -6875,6 +6933,7 @@ class SpineDartBindings { late final _spine_skeleton_data_get_slots = _spine_skeleton_data_get_slotsPtr.asFunction(); + /// All skins, including the default skin. spine_array_skin spine_skeleton_data_get_skins( spine_skeleton_data self, ) { @@ -6917,6 +6976,7 @@ class SpineDartBindings { late final _spine_skeleton_data_set_default_skin = _spine_skeleton_data_set_default_skinPtr.asFunction(); + /// The skeleton's events. spine_array_event_data spine_skeleton_data_get_events( spine_skeleton_data self, ) { @@ -6931,6 +6991,7 @@ class SpineDartBindings { late final _spine_skeleton_data_get_events = _spine_skeleton_data_get_eventsPtr.asFunction(); + /// The skeleton's animations. spine_array_animation spine_skeleton_data_get_animations( spine_skeleton_data self, ) { @@ -6945,6 +7006,7 @@ class SpineDartBindings { late final _spine_skeleton_data_get_animations = _spine_skeleton_data_get_animationsPtr.asFunction(); + /// The skeleton's constraints. spine_array_constraint_data spine_skeleton_data_get_constraints( spine_skeleton_data self, ) { @@ -6959,6 +7021,8 @@ class SpineDartBindings { late final _spine_skeleton_data_get_constraints = _spine_skeleton_data_get_constraintsPtr.asFunction(); + /// The X coordinate of the skeleton's axis aligned bounding box in the setup + /// pose. double spine_skeleton_data_get_x( spine_skeleton_data self, ) { @@ -6987,6 +7051,8 @@ class SpineDartBindings { late final _spine_skeleton_data_set_x = _spine_skeleton_data_set_xPtr.asFunction(); + /// The Y coordinate of the skeleton's axis aligned bounding box in the setup + /// pose. double spine_skeleton_data_get_y( spine_skeleton_data self, ) { @@ -7015,6 +7081,7 @@ class SpineDartBindings { late final _spine_skeleton_data_set_y = _spine_skeleton_data_set_yPtr.asFunction(); + /// The width of the skeleton's axis aligned bounding box in the setup pose. double spine_skeleton_data_get_width( spine_skeleton_data self, ) { @@ -7043,6 +7110,7 @@ class SpineDartBindings { late final _spine_skeleton_data_set_width = _spine_skeleton_data_set_widthPtr.asFunction(); + /// The height of the skeleton's axis aligned bounding box in the setup pose. double spine_skeleton_data_get_height( spine_skeleton_data self, ) { @@ -7071,6 +7139,8 @@ class SpineDartBindings { late final _spine_skeleton_data_set_height = _spine_skeleton_data_set_heightPtr.asFunction(); + /// Baseline scale factor for applying physics and other effects based on + /// distance to non-scalable properties, such as angle or scale. Default is 100. double spine_skeleton_data_get_reference_scale( spine_skeleton_data self, ) { @@ -7100,6 +7170,7 @@ class SpineDartBindings { late final _spine_skeleton_data_set_reference_scale = _spine_skeleton_data_set_reference_scalePtr.asFunction(); + /// The Spine version used to export this data, or NULL. ffi.Pointer spine_skeleton_data_get_version( spine_skeleton_data self, ) { @@ -7130,6 +7201,8 @@ class SpineDartBindings { late final _spine_skeleton_data_set_version = _spine_skeleton_data_set_versionPtr.asFunction)>(); + /// The skeleton data hash. This value will change if any of the skeleton data + /// has changed. ffi.Pointer spine_skeleton_data_get_hash( spine_skeleton_data self, ) { @@ -7159,6 +7232,8 @@ class SpineDartBindings { late final _spine_skeleton_data_set_hash = _spine_skeleton_data_set_hashPtr.asFunction)>(); + /// The path to the images directory as defined in Spine, or null if nonessential + /// data was not exported. ffi.Pointer spine_skeleton_data_get_images_path( spine_skeleton_data self, ) { @@ -7189,6 +7264,8 @@ class SpineDartBindings { late final _spine_skeleton_data_set_images_path = _spine_skeleton_data_set_images_pathPtr.asFunction)>(); + /// The path to the audio directory as defined in Spine, or null if nonessential + /// data was not exported. ffi.Pointer spine_skeleton_data_get_audio_path( spine_skeleton_data self, ) { @@ -7219,6 +7296,8 @@ class SpineDartBindings { late final _spine_skeleton_data_set_audio_path = _spine_skeleton_data_set_audio_pathPtr.asFunction)>(); + /// The dopesheet FPS in Spine. Available only when nonessential data was + /// exported. double spine_skeleton_data_get_fps( spine_skeleton_data self, ) { @@ -15212,6 +15291,10 @@ class SpineDartBindings { late final _spine_alpha_timeline_set_slot_index = _spine_alpha_timeline_set_slot_indexPtr.asFunction(); + /// Sets the time and value for the specified frame. + /// + /// @param frame Between 0 and frameCount, inclusive. + /// @param time The frame time in seconds. void spine_alpha_timeline_set_frame( spine_alpha_timeline self, int frame, @@ -15232,6 +15315,7 @@ class SpineDartBindings { late final _spine_alpha_timeline_set_frame = _spine_alpha_timeline_set_framePtr.asFunction(); + /// Returns the interpolated value for the specified time. double spine_alpha_timeline_get_curve_value( spine_alpha_timeline self, double time, @@ -15560,6 +15644,8 @@ class SpineDartBindings { _lookup>('spine_animation_dispose'); late final _spine_animation_dispose = _spine_animation_disposePtr.asFunction(); + /// If the returned array or the timelines it contains are modified, + /// setTimelines() must be called. spine_array_timeline spine_animation_get_timelines( spine_animation self, ) { @@ -15589,6 +15675,8 @@ class SpineDartBindings { late final _spine_animation_set_timelines = _spine_animation_set_timelinesPtr.asFunction(); + /// Returns true if this animation contains a timeline with any of the specified + /// property IDs. bool spine_animation_has_timeline( spine_animation self, spine_array_property_id ids, @@ -15605,6 +15693,9 @@ class SpineDartBindings { late final _spine_animation_has_timeline = _spine_animation_has_timelinePtr.asFunction(); + /// The duration of the animation in seconds, which is usually the highest time + /// of all frames in the timeline. The duration is used to know when it has + /// completed and when it should loop back to the start. double spine_animation_get_duration( spine_animation self, ) { @@ -15633,6 +15724,18 @@ class SpineDartBindings { late final _spine_animation_set_duration = _spine_animation_set_durationPtr.asFunction(); + /// Applies the animation's timelines to the specified skeleton. + /// + /// See Timeline::apply(). + /// + /// @param skeleton The skeleton the animation is being applied to. This provides access to the bones, slots, and other skeleton components the timelines may change. + /// @param lastTime The last time in seconds this animation was applied. Some timelines trigger only at specific times rather than every frame. Pass -1 the first time an animation is applied to ensure frame 0 is triggered. + /// @param time The time in seconds the skeleton is being posed for. Most timelines find the frame before and the frame after this time and interpolate between the frame values. If beyond the getDuration() and loop is true then the animation will repeat, else the last frame will be applied. + /// @param loop If true, the animation repeats after the getDuration(). + /// @param events If any events are fired, they are added to this list. Can be null to ignore fired events or if no timelines fire events. + /// @param alpha 0 applies the current or setup values (depending on blend). 1 applies the timeline values. Between 0 and 1 applies values between the current or setup values and the timeline values. By adjusting alpha over time, an animation can be mixed in or out. alpha can also be useful to apply animations on top of each other (layering). + /// @param blend Controls how mixing is applied when alpha < 1. + /// @param direction Indicates whether the timelines are mixing in or out. Used by timelines which perform instant transitions, such as DrawOrderTimeline or AttachmentTimeline. void spine_animation_apply( spine_animation self, spine_skeleton skeleton, @@ -15667,6 +15770,7 @@ class SpineDartBindings { void Function( spine_animation, spine_skeleton, double, double, bool, spine_array_event, double, int, int, bool)>(); + /// The animation's name, which is unique across all animations in the skeleton. ffi.Pointer spine_animation_get_name( spine_animation self, ) { @@ -15680,6 +15784,7 @@ class SpineDartBindings { late final _spine_animation_get_name = _spine_animation_get_namePtr.asFunction Function(spine_animation)>(); + /// The bone indices affected by this animation. spine_array_int spine_animation_get_bones( spine_animation self, ) { @@ -15693,6 +15798,7 @@ class SpineDartBindings { late final _spine_animation_get_bones = _spine_animation_get_bonesPtr.asFunction(); + /// @param target After the first and before the last entry. int spine_animation_search_1( spine_array_float values, double target, @@ -15752,6 +15858,8 @@ class SpineDartBindings { late final _spine_animation_state_dispose = _spine_animation_state_disposePtr.asFunction(); + /// Increments each track entry TrackEntry::getTrackTime(), setting queued + /// animations as current if needed. void spine_animation_state_update( spine_animation_state self, double delta, @@ -15767,6 +15875,11 @@ class SpineDartBindings { late final _spine_animation_state_update = _spine_animation_state_updatePtr.asFunction(); + /// Poses the skeleton using the track entry animations. The animation state is + /// not changed, so can be applied to multiple skeletons to pose them + /// identically. + /// + /// @return True if any animations were applied. bool spine_animation_state_apply( spine_animation_state self, spine_skeleton skeleton, @@ -15783,6 +15896,12 @@ class SpineDartBindings { late final _spine_animation_state_apply = _spine_animation_state_applyPtr.asFunction(); + /// Removes all animations from all tracks, leaving skeletons in their current + /// pose. + /// + /// It may be desired to use AnimationState::setEmptyAnimations(float) to mix the + /// skeletons back to the setup pose, rather than leaving them in their current + /// pose. void spine_animation_state_clear_tracks( spine_animation_state self, ) { @@ -15796,6 +15915,12 @@ class SpineDartBindings { late final _spine_animation_state_clear_tracks = _spine_animation_state_clear_tracksPtr.asFunction(); + /// Removes all animations from the track, leaving skeletons in their current + /// pose. + /// + /// It may be desired to use AnimationState::setEmptyAnimation(int, float) to mix + /// the skeletons back to the setup pose, rather than leaving them in their + /// current pose. void spine_animation_state_clear_track( spine_animation_state self, int trackIndex, @@ -15812,6 +15937,9 @@ class SpineDartBindings { late final _spine_animation_state_clear_track = _spine_animation_state_clear_trackPtr.asFunction(); + /// Sets an animation by name. + /// + /// See setAnimation(int, Animation, bool). spine_track_entry spine_animation_state_set_animation_1( spine_animation_state self, int trackIndex, @@ -15833,6 +15961,14 @@ class SpineDartBindings { late final _spine_animation_state_set_animation_1 = _spine_animation_state_set_animation_1Ptr .asFunction, bool)>(); + /// Sets the current animation for a track, discarding any queued animations. + /// + /// If the formerly current track entry is for the same animation and was never + /// applied to a skeleton, it is replaced (not mixed from). + /// + /// @param loop If true, the animation will repeat. If false, it will not, instead its last frame is applied if played beyond its duration. In either case TrackEntry.TrackEnd determines when the track is cleared. + /// + /// @return A track entry to allow further customization of animation playback. References to the track entry must not be kept after AnimationState.Dispose. spine_track_entry spine_animation_state_set_animation_2( spine_animation_state self, int trackIndex, @@ -15853,6 +15989,9 @@ class SpineDartBindings { late final _spine_animation_state_set_animation_2 = _spine_animation_state_set_animation_2Ptr .asFunction(); + /// Queues an animation by name. + /// + /// See addAnimation(int, Animation, bool, float). spine_track_entry spine_animation_state_add_animation_1( spine_animation_state self, int trackIndex, @@ -15876,6 +16015,13 @@ class SpineDartBindings { late final _spine_animation_state_add_animation_1 = _spine_animation_state_add_animation_1Ptr .asFunction, bool, double)>(); + /// Adds an animation to be played delay seconds after the current or last queued + /// animation for a track. If the track has no entries, this is equivalent to + /// calling setAnimation. + /// + /// @param delay Seconds to begin this animation after the start of the previous animation. May be < = 0 to use the animation duration of the previous track minus any mix duration plus the negative delay. + /// + /// @return A track entry to allow further customization of animation playback. References to the track entry must not be kept after AnimationState.Dispose spine_track_entry spine_animation_state_add_animation_2( spine_animation_state self, int trackIndex, @@ -15899,6 +16045,28 @@ class SpineDartBindings { late final _spine_animation_state_add_animation_2 = _spine_animation_state_add_animation_2Ptr .asFunction(); + /// Sets an empty animation for a track, discarding any queued animations, and + /// sets the track entry's TrackEntry::getMixDuration(). An empty animation has + /// no timelines and serves as a placeholder for mixing in or out. + /// + /// Mixing out is done by setting an empty animation with a mix duration using + /// either setEmptyAnimation(int, float), setEmptyAnimations(float), or + /// addEmptyAnimation(int, float, float). Mixing to an empty animation causes the + /// previous animation to be applied less and less over the mix duration. + /// Properties keyed in the previous animation transition to the value from lower + /// tracks or to the setup pose value if no lower tracks key the property. A mix + /// duration of 0 still mixes out over one frame. + /// + /// Mixing in is done by first setting an empty animation, then adding an + /// animation using addAnimation(int, Animation, bool, float) with the desired + /// delay (an empty animation has a duration of 0) and on the returned track + /// entry, set the TrackEntry::setMixDuration(float). Mixing from an empty + /// animation causes the new animation to be applied more and more over the mix + /// duration. Properties keyed in the new animation transition from the value + /// from lower tracks or from the setup pose value if no lower tracks key the + /// property to the value keyed in the new animation. + /// + /// See Empty animations in the Spine Runtimes Guide. spine_track_entry spine_animation_state_set_empty_animation( spine_animation_state self, int trackIndex, @@ -15917,6 +16085,17 @@ class SpineDartBindings { late final _spine_animation_state_set_empty_animation = _spine_animation_state_set_empty_animationPtr .asFunction(); + /// Adds an empty animation to be played after the current or last queued + /// animation for a track, and sets the track entry's + /// TrackEntry::getMixDuration(). If the track has no entries, it is equivalent + /// to calling setEmptyAnimation(int, float). + /// + /// See setEmptyAnimation(int, float) and Empty animations in the Spine Runtimes + /// Guide. + /// + /// @param delay If > 0, sets TrackEntry::getDelay(). If < = 0, the delay set is the duration of the previous track entry minus any mix duration plus the specified delay (ie the mix ends at ( delay = 0) or before ( delay < 0) the previous track entry duration). If the previous entry is looping, its next loop completion is used instead of its duration. + /// + /// @return A track entry to allow further customization of animation playback. References to the track entry must not be kept after the AnimationStateListener::dispose(TrackEntry) event occurs. spine_track_entry spine_animation_state_add_empty_animation( spine_animation_state self, int trackIndex, @@ -15937,6 +16116,10 @@ class SpineDartBindings { late final _spine_animation_state_add_empty_animation = _spine_animation_state_add_empty_animationPtr .asFunction(); + /// Sets an empty animation for every track, discarding any queued animations, + /// and mixes to it over the specified mix duration. + /// + /// See Empty animations in the Spine Runtimes Guide. void spine_animation_state_set_empty_animations( spine_animation_state self, double mixDuration, @@ -15969,6 +16152,7 @@ class SpineDartBindings { late final _spine_animation_state_get_current = _spine_animation_state_get_currentPtr.asFunction(); + /// The AnimationStateData to look up mix durations. spine_animation_state_data spine_animation_state_get_data( spine_animation_state self, ) { @@ -15983,6 +16167,8 @@ class SpineDartBindings { late final _spine_animation_state_get_data = _spine_animation_state_get_dataPtr.asFunction(); + /// The list of tracks that have had animations, which may contain null entries + /// for tracks that currently have no animation. spine_array_track_entry spine_animation_state_get_tracks( spine_animation_state self, ) { @@ -15997,6 +16183,10 @@ class SpineDartBindings { late final _spine_animation_state_get_tracks = _spine_animation_state_get_tracksPtr.asFunction(); + /// Multiplier for the delta time when the animation state is updated, causing + /// time for all animations and mixes to play slower or faster. Defaults to 1. + /// + /// See TrackEntry TrackEntry::getTimeScale() for affecting a single animation. double spine_animation_state_get_time_scale( spine_animation_state self, ) { @@ -16140,6 +16330,7 @@ class SpineDartBindings { late final _spine_animation_state_data_dispose = _spine_animation_state_data_disposePtr.asFunction(); + /// The SkeletonData to look up animations when they are specified by name. spine_skeleton_data spine_animation_state_data_get_skeleton_data( spine_animation_state_data self, ) { @@ -16154,6 +16345,8 @@ class SpineDartBindings { late final _spine_animation_state_data_get_skeleton_data = _spine_animation_state_data_get_skeleton_dataPtr .asFunction(); + /// The mix duration to use when no mix duration has been specifically defined + /// between two animations. double spine_animation_state_data_get_default_mix( spine_animation_state_data self, ) { @@ -16184,6 +16377,7 @@ class SpineDartBindings { late final _spine_animation_state_data_set_default_mix = _spine_animation_state_data_set_default_mixPtr.asFunction(); + /// Sets a mix duration by animation names. void spine_animation_state_data_set_mix_1( spine_animation_state_data self, ffi.Pointer fromName, @@ -16205,6 +16399,8 @@ class SpineDartBindings { late final _spine_animation_state_data_set_mix_1 = _spine_animation_state_data_set_mix_1Ptr .asFunction, ffi.Pointer, double)>(); + /// Sets a mix duration when changing from the specified animation to the other. + /// See TrackEntry.MixDuration. void spine_animation_state_data_set_mix_2( spine_animation_state_data self, spine_animation from, @@ -16226,6 +16422,8 @@ class SpineDartBindings { late final _spine_animation_state_data_set_mix_2 = _spine_animation_state_data_set_mix_2Ptr .asFunction(); + /// The mix duration to use when changing from the specified animation to the + /// other, or the DefaultMix if no mix duration has been set. double spine_animation_state_data_get_mix( spine_animation_state_data self, spine_animation from, @@ -16244,6 +16442,7 @@ class SpineDartBindings { late final _spine_animation_state_data_get_mix = _spine_animation_state_data_get_mixPtr .asFunction(); + /// Removes all mixes and sets the default mix to 0. void spine_animation_state_data_clear( spine_animation_state_data self, ) { @@ -17796,6 +17995,10 @@ class SpineDartBindings { void Function( spine_attachment_timeline, spine_skeleton, double, double, spine_array_event, double, int, int, bool)>(); + /// Sets the time and attachment name for the specified frame. + /// + /// @param frame Between 0 and frameCount, inclusive. + /// @param time The frame time in seconds. void spine_attachment_timeline_set_frame( spine_attachment_timeline self, int frame, @@ -17924,6 +18127,7 @@ class SpineDartBindings { _lookup>('spine_attachment_timeline_rtti'); late final _spine_attachment_timeline_rtti = _spine_attachment_timeline_rttiPtr.asFunction(); + /// @param parent May be NULL. spine_bone spine_bone_create( spine_bone_data data, spine_bone parent, @@ -17938,6 +18142,7 @@ class SpineDartBindings { _lookup>('spine_bone_create'); late final _spine_bone_create = _spine_bone_createPtr.asFunction(); + /// Copy constructor. Does not copy the children bones. spine_bone spine_bone_create2( spine_bone bone, spine_bone parent, @@ -17987,6 +18192,7 @@ class SpineDartBindings { _lookup>('spine_bone_get_parent'); late final _spine_bone_get_parent = _spine_bone_get_parentPtr.asFunction(); + /// The immediate children of this bone. spine_array_bone spine_bone_get_children( spine_bone self, ) { @@ -18034,6 +18240,7 @@ class SpineDartBindings { _lookup>('spine_bone_update'); late final _spine_bone_update = _spine_bone_updatePtr.asFunction(); + /// The constraint's setup pose data. spine_bone_data spine_bone_get_data( spine_bone self, ) { @@ -18171,6 +18378,7 @@ class SpineDartBindings { _lookup>('spine_bone_data_dispose'); late final _spine_bone_data_dispose = _spine_bone_data_disposePtr.asFunction(); + /// The index of the bone in Skeleton.Bones int spine_bone_data_get_index( spine_bone_data self, ) { @@ -18307,6 +18515,8 @@ class SpineDartBindings { late final _spine_bone_data_get_setup_pose = _spine_bone_data_get_setup_posePtr.asFunction(); + /// The constraint's name, which is unique across all constraints in the skeleton + /// of the same type. ffi.Pointer spine_bone_data_get_name( spine_bone_data self, ) { @@ -18320,6 +18530,10 @@ class SpineDartBindings { late final _spine_bone_data_get_name = _spine_bone_data_get_namePtr.asFunction Function(spine_bone_data)>(); + /// When true, Skeleton::updateWorldTransform(Physics) only updates this + /// constraint if the Skeleton::getSkin() contains this constraint. + /// + /// See Skin::getConstraints(). bool spine_bone_data_get_skin_required( spine_bone_data self, ) { @@ -18383,6 +18597,7 @@ class SpineDartBindings { late final _spine_bone_local_set = _spine_bone_local_setPtr.asFunction(); + /// The local x translation. double spine_bone_local_get_x( spine_bone_local self, ) { @@ -18409,6 +18624,7 @@ class SpineDartBindings { _lookup>('spine_bone_local_set_x'); late final _spine_bone_local_set_x = _spine_bone_local_set_xPtr.asFunction(); + /// The local y translation. double spine_bone_local_get_y( spine_bone_local self, ) { @@ -18453,6 +18669,7 @@ class SpineDartBindings { late final _spine_bone_local_set_position = _spine_bone_local_set_positionPtr.asFunction(); + /// The local rotation in degrees, counter clockwise. double spine_bone_local_get_rotation( spine_bone_local self, ) { @@ -18481,6 +18698,7 @@ class SpineDartBindings { late final _spine_bone_local_set_rotation = _spine_bone_local_set_rotationPtr.asFunction(); + /// The local scaleX. double spine_bone_local_get_scale_x( spine_bone_local self, ) { @@ -18509,6 +18727,7 @@ class SpineDartBindings { late final _spine_bone_local_set_scale_x = _spine_bone_local_set_scale_xPtr.asFunction(); + /// The local scaleY. double spine_bone_local_get_scale_y( spine_bone_local self, ) { @@ -18570,6 +18789,7 @@ class SpineDartBindings { late final _spine_bone_local_set_scale_2 = _spine_bone_local_set_scale_2Ptr.asFunction(); + /// The local shearX. double spine_bone_local_get_shear_x( spine_bone_local self, ) { @@ -18598,6 +18818,7 @@ class SpineDartBindings { late final _spine_bone_local_set_shear_x = _spine_bone_local_set_shear_xPtr.asFunction(); + /// The local shearY. double spine_bone_local_get_shear_y( spine_bone_local self, ) { @@ -18626,6 +18847,7 @@ class SpineDartBindings { late final _spine_bone_local_set_shear_y = _spine_bone_local_set_shear_yPtr.asFunction(); + /// Determines how parent world transforms affect this bone. int spine_bone_local_get_inherit( spine_bone_local self, ) { @@ -18680,6 +18902,8 @@ class SpineDartBindings { late final _spine_bone_timeline_get_rtti = _spine_bone_timeline_get_rttiPtr.asFunction(); + /// The index of the bone in Skeleton::getBones() that will be changed when this + /// timeline is applied. int spine_bone_timeline_get_bone_index( spine_bone_timeline self, ) { @@ -18803,6 +19027,10 @@ class SpineDartBindings { late final _spine_bone_timeline1_set_bone_index = _spine_bone_timeline1_set_bone_indexPtr.asFunction(); + /// Sets the time and value for the specified frame. + /// + /// @param frame Between 0 and frameCount, inclusive. + /// @param time The frame time in seconds. void spine_bone_timeline1_set_frame( spine_bone_timeline1 self, int frame, @@ -18823,6 +19051,7 @@ class SpineDartBindings { late final _spine_bone_timeline1_set_frame = _spine_bone_timeline1_set_framePtr.asFunction(); + /// Returns the interpolated value for the specified time. double spine_bone_timeline1_get_curve_value( spine_bone_timeline1 self, double time, @@ -19477,6 +19706,17 @@ class SpineDartBindings { late final _spine_bounding_box_attachment_copy = _spine_bounding_box_attachment_copyPtr.asFunction(); + /// Transforms the attachment's local vertices to world coordinates. If the + /// slot's SlotPose::getDeform() is not empty, it is used to deform the vertices. + /// + /// See https://esotericsoftware.com/spine-runtime-skeletons#World-transforms + /// World transforms in the Spine Runtimes Guide. + /// + /// @param start The index of the first vertices value to transform. Each vertex has 2 values, x and y. + /// @param count The number of world vertex values to output. Must be < = WorldVerticesLength - start. + /// @param worldVertices The output world vertices. Must have a length >= offset + count * stride / 2. + /// @param offset The worldVertices index to begin writing values. + /// @param stride The number of worldVertices entries between the value pairs written. void spine_bounding_box_attachment_compute_world_vertices_1( spine_bounding_box_attachment self, spine_skeleton skeleton, @@ -19539,6 +19779,7 @@ class SpineDartBindings { void Function( spine_bounding_box_attachment, spine_skeleton, spine_slot, int, int, spine_array_float, int, int)>(); + /// Gets a unique ID for this attachment. int spine_bounding_box_attachment_get_id( spine_bounding_box_attachment self, ) { @@ -19856,6 +20097,17 @@ class SpineDartBindings { late final _spine_clipping_attachment_copy = _spine_clipping_attachment_copyPtr.asFunction(); + /// Transforms the attachment's local vertices to world coordinates. If the + /// slot's SlotPose::getDeform() is not empty, it is used to deform the vertices. + /// + /// See https://esotericsoftware.com/spine-runtime-skeletons#World-transforms + /// World transforms in the Spine Runtimes Guide. + /// + /// @param start The index of the first vertices value to transform. Each vertex has 2 values, x and y. + /// @param count The number of world vertex values to output. Must be < = WorldVerticesLength - start. + /// @param worldVertices The output world vertices. Must have a length >= offset + count * stride / 2. + /// @param offset The worldVertices index to begin writing values. + /// @param stride The number of worldVertices entries between the value pairs written. void spine_clipping_attachment_compute_world_vertices_1( spine_clipping_attachment self, spine_skeleton skeleton, @@ -19918,6 +20170,7 @@ class SpineDartBindings { void Function( spine_clipping_attachment, spine_skeleton, spine_slot, int, int, spine_array_float, int, int)>(); + /// Gets a unique ID for this attachment. int spine_clipping_attachment_get_id( spine_clipping_attachment self, ) { @@ -20309,6 +20562,7 @@ class SpineDartBindings { late final _spine_color_parse_hex = _spine_color_parse_hexPtr.asFunction, int)>(); + /// Convert packed RGBA8888 integer to Color void spine_color_rgba8888_to_color( spine_color color, int value, @@ -20324,6 +20578,7 @@ class SpineDartBindings { late final _spine_color_rgba8888_to_color = _spine_color_rgba8888_to_colorPtr.asFunction(); + /// Convert packed RGB888 integer to Color (no alpha) void spine_color_rgb888_to_color( spine_color color, int value, @@ -20505,6 +20760,7 @@ class SpineDartBindings { late final _spine_constraint_is_source_active = _spine_constraint_is_source_activePtr.asFunction(); + /// Inherited from Update void spine_constraint_update( spine_constraint self, spine_skeleton skeleton, @@ -20633,6 +20889,8 @@ class SpineDartBindings { late final _spine_constraint_timeline_get_rtti = _spine_constraint_timeline_get_rttiPtr.asFunction(); + /// The index of the constraint in Skeleton::getConstraints() that will be + /// changed when this timeline is applied. int spine_constraint_timeline_get_constraint_index( spine_constraint_timeline self, ) { @@ -20728,6 +20986,10 @@ class SpineDartBindings { late final _spine_constraint_timeline1_set_constraint_index = _spine_constraint_timeline1_set_constraint_indexPtr.asFunction(); + /// Sets the time and value for the specified frame. + /// + /// @param frame Between 0 and frameCount, inclusive. + /// @param time The frame time in seconds. void spine_constraint_timeline1_set_frame( spine_constraint_timeline1 self, int frame, @@ -20748,6 +21010,7 @@ class SpineDartBindings { late final _spine_constraint_timeline1_set_frame = _spine_constraint_timeline1_set_framePtr .asFunction(); + /// Returns the interpolated value for the specified time. double spine_constraint_timeline1_get_curve_value( spine_constraint_timeline1 self, double time, @@ -20974,6 +21237,16 @@ class SpineDartBindings { late final _spine_constraint_timeline1_get_curves = _spine_constraint_timeline1_get_curvesPtr.asFunction(); + /// Sets the value(s) for the specified time. + /// + /// @param skeleton The skeleton the timeline is being applied to. This provides access to the bones, slots, and other skeleton components the timeline may change. + /// @param lastTime lastTime The time this timeline was last applied. Timelines such as EventTimeline trigger only at specific times rather than every frame. In that case, the timeline triggers everything between lastTime (exclusive) and time (inclusive). + /// @param time The time within the animation. Most timelines find the key before and the key after this time so they can interpolate between the keys. + /// @param events If any events are fired, they are added to this array. Can be NULL to ignore firing events or if the timeline does not fire events. May be NULL. + /// @param alpha alpha 0 applies the current or setup pose value (depending on pose parameter). 1 applies the timeline value. Between 0 and 1 applies a value between the current or setup pose and the timeline value. By adjusting alpha over time, an animation can be mixed in or out. alpha can also be useful to apply animations on top of each other (layered). + /// @param blend Controls how mixing is applied when alpha is than 1. + /// @param direction Indicates whether the timeline is mixing in or out. Used by timelines which perform instant transitions such as DrawOrderTimeline and AttachmentTimeline. + /// @param appliedPose True to modify the applied pose. void spine_constraint_timeline1_apply( spine_constraint_timeline1 self, spine_skeleton skeleton, @@ -21214,6 +21487,16 @@ class SpineDartBindings { late final _spine_curve_timeline_get_curves = _spine_curve_timeline_get_curvesPtr.asFunction(); + /// Sets the value(s) for the specified time. + /// + /// @param skeleton The skeleton the timeline is being applied to. This provides access to the bones, slots, and other skeleton components the timeline may change. + /// @param lastTime lastTime The time this timeline was last applied. Timelines such as EventTimeline trigger only at specific times rather than every frame. In that case, the timeline triggers everything between lastTime (exclusive) and time (inclusive). + /// @param time The time within the animation. Most timelines find the key before and the key after this time so they can interpolate between the keys. + /// @param events If any events are fired, they are added to this array. Can be NULL to ignore firing events or if the timeline does not fire events. May be NULL. + /// @param alpha alpha 0 applies the current or setup pose value (depending on pose parameter). 1 applies the timeline value. Between 0 and 1 applies a value between the current or setup pose and the timeline value. By adjusting alpha over time, an animation can be mixed in or out. alpha can also be useful to apply animations on top of each other (layered). + /// @param blend Controls how mixing is applied when alpha is than 1. + /// @param direction Indicates whether the timeline is mixing in or out. Used by timelines which perform instant transitions such as DrawOrderTimeline and AttachmentTimeline. + /// @param appliedPose True to modify the applied pose. void spine_curve_timeline_apply( spine_curve_timeline self, spine_skeleton skeleton, @@ -21345,6 +21628,10 @@ class SpineDartBindings { late final _spine_curve_timeline1_get_rtti = _spine_curve_timeline1_get_rttiPtr.asFunction(); + /// Sets the time and value for the specified frame. + /// + /// @param frame Between 0 and frameCount, inclusive. + /// @param time The frame time in seconds. void spine_curve_timeline1_set_frame( spine_curve_timeline1 self, int frame, @@ -21365,6 +21652,7 @@ class SpineDartBindings { late final _spine_curve_timeline1_set_frame = _spine_curve_timeline1_set_framePtr.asFunction(); + /// Returns the interpolated value for the specified time. double spine_curve_timeline1_get_curve_value( spine_curve_timeline1 self, double time, @@ -21591,6 +21879,16 @@ class SpineDartBindings { late final _spine_curve_timeline1_get_curves = _spine_curve_timeline1_get_curvesPtr.asFunction(); + /// Sets the value(s) for the specified time. + /// + /// @param skeleton The skeleton the timeline is being applied to. This provides access to the bones, slots, and other skeleton components the timeline may change. + /// @param lastTime lastTime The time this timeline was last applied. Timelines such as EventTimeline trigger only at specific times rather than every frame. In that case, the timeline triggers everything between lastTime (exclusive) and time (inclusive). + /// @param time The time within the animation. Most timelines find the key before and the key after this time so they can interpolate between the keys. + /// @param events If any events are fired, they are added to this array. Can be NULL to ignore firing events or if the timeline does not fire events. May be NULL. + /// @param alpha alpha 0 applies the current or setup pose value (depending on pose parameter). 1 applies the timeline value. Between 0 and 1 applies a value between the current or setup pose and the timeline value. By adjusting alpha over time, an animation can be mixed in or out. alpha can also be useful to apply animations on top of each other (layered). + /// @param blend Controls how mixing is applied when alpha is than 1. + /// @param direction Indicates whether the timeline is mixing in or out. Used by timelines which perform instant transitions such as DrawOrderTimeline and AttachmentTimeline. + /// @param appliedPose True to modify the applied pose. void spine_curve_timeline1_apply( spine_curve_timeline1 self, spine_skeleton skeleton, @@ -21744,6 +22042,7 @@ class SpineDartBindings { late final _spine_deform_timeline_get_rtti = _spine_deform_timeline_get_rttiPtr.asFunction(); + /// Sets the time and vertices for the specified frame. void spine_deform_timeline_set_frame( spine_deform_timeline self, int frameIndex, @@ -21764,6 +22063,7 @@ class SpineDartBindings { late final _spine_deform_timeline_set_frame = _spine_deform_timeline_set_framePtr .asFunction(); + /// The attachment that will be deformed. spine_vertex_attachment spine_deform_timeline_get_attachment( spine_deform_timeline self, ) { @@ -22139,6 +22439,11 @@ class SpineDartBindings { late final _spine_draw_order_timeline_get_frame_count = _spine_draw_order_timeline_get_frame_countPtr.asFunction(); + /// Sets the time and draw order for the specified frame. + /// + /// @param frame Between 0 and frameCount, inclusive. + /// @param time The frame time in seconds. + /// @param drawOrder For each slot in Skeleton::slots, the index of the slot in the new draw order. May be null to use setup pose draw order. void spine_draw_order_timeline_set_frame( spine_draw_order_timeline self, int frame, @@ -22249,6 +22554,7 @@ class SpineDartBindings { _lookup>('spine_event_dispose'); late final _spine_event_dispose = _spine_event_disposePtr.asFunction(); + /// The event's setup pose data. spine_event_data spine_event_get_data( spine_event self, ) { @@ -22261,6 +22567,7 @@ class SpineDartBindings { _lookup>('spine_event_get_data'); late final _spine_event_get_data = _spine_event_get_dataPtr.asFunction(); + /// The animation time this event was keyed. double spine_event_get_time( spine_event self, ) { @@ -22430,6 +22737,7 @@ class SpineDartBindings { _lookup>('spine_event_data_dispose'); late final _spine_event_data_dispose = _spine_event_data_disposePtr.asFunction(); + /// The name of the event, which is unique within the skeleton. ffi.Pointer spine_event_data_get_name( spine_event_data self, ) { @@ -22770,6 +23078,7 @@ class SpineDartBindings { late final _spine_event_timeline_get_rtti = _spine_event_timeline_get_rttiPtr.asFunction(); + /// Fires events for frames > lastTime and < = time. void spine_event_timeline_apply( spine_event_timeline self, spine_skeleton skeleton, @@ -22814,6 +23123,7 @@ class SpineDartBindings { late final _spine_event_timeline_get_frame_count = _spine_event_timeline_get_frame_countPtr.asFunction(); + /// The event for each frame. spine_array_event spine_event_timeline_get_events( spine_event_timeline self, ) { @@ -22827,6 +23137,9 @@ class SpineDartBindings { late final _spine_event_timeline_get_events = _spine_event_timeline_get_eventsPtr.asFunction(); + /// Sets the time and event for the specified frame. + /// + /// @param frame Between 0 and frameCount, inclusive. void spine_event_timeline_set_frame( spine_event_timeline self, int frame, @@ -22932,6 +23245,7 @@ class SpineDartBindings { late final _spine_from_property_get_rtti = _spine_from_property_get_rttiPtr.asFunction(); + /// Reads this property from the specified bone. double spine_from_property_value( spine_from_property self, spine_skeleton skeleton, @@ -23545,6 +23859,8 @@ class SpineDartBindings { late final _spine_ik_constraint_set_target = _spine_ik_constraint_set_targetPtr.asFunction(); + /// Adjusts the bone rotation so the tip is as close to the target position as + /// possible. The target is specified in the world coordinate system. void spine_ik_constraint_apply_1( spine_skeleton skeleton, spine_bone_pose bone, @@ -23574,6 +23890,11 @@ class SpineDartBindings { late final _spine_ik_constraint_apply_1 = _spine_ik_constraint_apply_1Ptr .asFunction(); + /// Adjusts the parent and child bone rotations so the tip of the child is as + /// close to the target position as possible. The target is specified in the + /// world coordinate system. + /// + /// @param child A direct descendant of the parent bone. void spine_ik_constraint_apply_2( spine_skeleton skeleton, spine_bone_pose parent, @@ -23894,6 +24215,7 @@ class SpineDartBindings { late final _spine_ik_constraint_base_is_source_active = _spine_ik_constraint_base_is_source_activePtr.asFunction(); + /// Inherited from Update void spine_ik_constraint_base_update( spine_ik_constraint_base self, spine_skeleton skeleton, @@ -23976,6 +24298,7 @@ class SpineDartBindings { late final _spine_ik_constraint_data_create_method = _spine_ik_constraint_data_create_methodPtr .asFunction(); + /// The bones that are constrained by this IK Constraint. spine_array_bone_data spine_ik_constraint_data_get_bones( spine_ik_constraint_data self, ) { @@ -23990,6 +24313,7 @@ class SpineDartBindings { late final _spine_ik_constraint_data_get_bones = _spine_ik_constraint_data_get_bonesPtr.asFunction(); + /// The bone that is the IK target. spine_bone_data spine_ik_constraint_data_get_target( spine_ik_constraint_data self, ) { @@ -24020,6 +24344,8 @@ class SpineDartBindings { late final _spine_ik_constraint_data_set_target = _spine_ik_constraint_data_set_targetPtr.asFunction(); + /// When true and IkConstraintPose compress or stretch is used, the bone is + /// scaled on both the X and Y axes. bool spine_ik_constraint_data_get_uniform( spine_ik_constraint_data self, ) { @@ -24049,6 +24375,7 @@ class SpineDartBindings { late final _spine_ik_constraint_data_set_uniform = _spine_ik_constraint_data_set_uniformPtr.asFunction(); + /// Resolve ambiguity by forwarding to PosedData's implementation ffi.Pointer spine_ik_constraint_data_get_name( spine_ik_constraint_data self, ) { @@ -24153,6 +24480,11 @@ class SpineDartBindings { late final _spine_ik_constraint_pose_set = _spine_ik_constraint_pose_setPtr.asFunction(); + /// A percentage (0-1) that controls the mix between the constrained and + /// unconstrained rotation. + /// + /// For two bone IK: if the parent bone has local nonuniform scale, the child + /// bone's local Y translation is set to 0. double spine_ik_constraint_pose_get_mix( spine_ik_constraint_pose self, ) { @@ -24182,6 +24514,9 @@ class SpineDartBindings { late final _spine_ik_constraint_pose_set_mix = _spine_ik_constraint_pose_set_mixPtr.asFunction(); + /// For two bone IK, the target bone's distance from the maximum reach of the + /// bones where rotation begins to slow. The bones will not straighten completely + /// until the target is this far out of range. double spine_ik_constraint_pose_get_softness( spine_ik_constraint_pose self, ) { @@ -24212,6 +24547,7 @@ class SpineDartBindings { late final _spine_ik_constraint_pose_set_softness = _spine_ik_constraint_pose_set_softnessPtr.asFunction(); + /// For two bone IK, controls the bend direction of the IK bones, either 1 or -1. int spine_ik_constraint_pose_get_bend_direction( spine_ik_constraint_pose self, ) { @@ -24242,6 +24578,8 @@ class SpineDartBindings { late final _spine_ik_constraint_pose_set_bend_direction = _spine_ik_constraint_pose_set_bend_directionPtr.asFunction(); + /// For one bone IK, when true and the target is too close, the bone is scaled to + /// reach it. bool spine_ik_constraint_pose_get_compress( spine_ik_constraint_pose self, ) { @@ -24271,6 +24609,12 @@ class SpineDartBindings { late final _spine_ik_constraint_pose_set_compress = _spine_ik_constraint_pose_set_compressPtr.asFunction(); + /// When true and the target is out of range, the parent bone is scaled to reach + /// it. + /// + /// For two bone IK: 1) the child bone's local Y translation is set to 0, 2) + /// stretch is not applied if getSoftness() is > 0, and 3) if the parent bone has + /// local nonuniform scale, stretch is not applied. bool spine_ik_constraint_pose_get_stretch( spine_ik_constraint_pose self, ) { @@ -24378,6 +24722,12 @@ class SpineDartBindings { void Function( spine_ik_constraint_timeline, spine_skeleton, double, double, spine_array_event, double, int, int, bool)>(); + /// Sets the time, mix, softness, bend direction, compress, and stretch for the + /// specified frame. + /// + /// @param frame Between 0 and frameCount, inclusive. + /// @param time The frame time in seconds. + /// @param bendDirection 1 or -1. void spine_ik_constraint_timeline_set_frame( spine_ik_constraint_timeline self, int frame, @@ -24675,6 +25025,10 @@ class SpineDartBindings { late final _spine_inherit_timeline_get_rtti = _spine_inherit_timeline_get_rttiPtr.asFunction(); + /// Sets the inherit transform mode for the specified frame. + /// + /// @param frame Between 0 and frameCount, inclusive. + /// @param time The frame time in seconds. void spine_inherit_timeline_set_frame( spine_inherit_timeline self, int frame, @@ -25063,6 +25417,8 @@ class SpineDartBindings { late final _spine_mesh_attachment_set_region_u_vs = _spine_mesh_attachment_set_region_u_vsPtr.asFunction(); + /// The UV pair for each vertex, normalized within the entire texture. See also + /// MeshAttachment::updateRegion spine_array_float spine_mesh_attachment_get_u_vs( spine_mesh_attachment self, ) { @@ -25238,6 +25594,7 @@ class SpineDartBindings { late final _spine_mesh_attachment_set_parent_mesh = _spine_mesh_attachment_set_parent_meshPtr .asFunction(); + /// Nonessential. spine_array_unsigned_short spine_mesh_attachment_get_edges( spine_mesh_attachment self, ) { @@ -25353,6 +25710,7 @@ class SpineDartBindings { late final _spine_mesh_attachment_new_linked_mesh = _spine_mesh_attachment_new_linked_meshPtr.asFunction(); + /// Gets a unique ID for this attachment. int spine_mesh_attachment_get_id( spine_mesh_attachment self, ) { @@ -25602,6 +25960,8 @@ class SpineDartBindings { late final _spine_path_attachment_get_rtti = _spine_path_attachment_get_rttiPtr.asFunction(); + /// The length in the setup pose from the start of the path to the end of each + /// curve. spine_array_float spine_path_attachment_get_lengths( spine_path_attachment self, ) { @@ -25716,6 +26076,17 @@ class SpineDartBindings { late final _spine_path_attachment_copy = _spine_path_attachment_copyPtr.asFunction(); + /// Transforms the attachment's local vertices to world coordinates. If the + /// slot's SlotPose::getDeform() is not empty, it is used to deform the vertices. + /// + /// See https://esotericsoftware.com/spine-runtime-skeletons#World-transforms + /// World transforms in the Spine Runtimes Guide. + /// + /// @param start The index of the first vertices value to transform. Each vertex has 2 values, x and y. + /// @param count The number of world vertex values to output. Must be < = WorldVerticesLength - start. + /// @param worldVertices The output world vertices. Must have a length >= offset + count * stride / 2. + /// @param offset The worldVertices index to begin writing values. + /// @param stride The number of worldVertices entries between the value pairs written. void spine_path_attachment_compute_world_vertices_1( spine_path_attachment self, spine_skeleton skeleton, @@ -25777,6 +26148,7 @@ class SpineDartBindings { _spine_path_attachment_compute_world_vertices_2Ptr.asFunction< void Function(spine_path_attachment, spine_skeleton, spine_slot, int, int, spine_array_float, int, int)>(); + /// Gets a unique ID for this attachment. int spine_path_attachment_get_id( spine_path_attachment self, ) { @@ -26044,6 +26416,7 @@ class SpineDartBindings { late final _spine_path_constraint_copy = _spine_path_constraint_copyPtr .asFunction(); + /// Applies the constraint to the constrained bones. void spine_path_constraint_update( spine_path_constraint self, spine_skeleton skeleton, @@ -26091,6 +26464,7 @@ class SpineDartBindings { late final _spine_path_constraint_is_source_active = _spine_path_constraint_is_source_activePtr.asFunction(); + /// The bones that will be modified by this path constraint. spine_array_bone_pose spine_path_constraint_get_bones( spine_path_constraint self, ) { @@ -26105,6 +26479,7 @@ class SpineDartBindings { late final _spine_path_constraint_get_bones = _spine_path_constraint_get_bonesPtr.asFunction(); + /// The slot whose path attachment will be used to constrained the bones. spine_slot spine_path_constraint_get_slot( spine_path_constraint self, ) { @@ -26424,6 +26799,7 @@ class SpineDartBindings { late final _spine_path_constraint_base_is_source_active = _spine_path_constraint_base_is_source_activePtr.asFunction(); + /// Inherited from Update void spine_path_constraint_base_update( spine_path_constraint_base self, spine_skeleton skeleton, @@ -26507,6 +26883,7 @@ class SpineDartBindings { late final _spine_path_constraint_data_create_method = _spine_path_constraint_data_create_methodPtr .asFunction(); + /// The bones that will be modified by this path constraint. spine_array_bone_data spine_path_constraint_data_get_bones( spine_path_constraint_data self, ) { @@ -26521,6 +26898,7 @@ class SpineDartBindings { late final _spine_path_constraint_data_get_bones = _spine_path_constraint_data_get_bonesPtr.asFunction(); + /// The slot whose path attachment will be used to constrained the bones. spine_slot_data spine_path_constraint_data_get_slot( spine_path_constraint_data self, ) { @@ -26551,6 +26929,7 @@ class SpineDartBindings { late final _spine_path_constraint_data_set_slot = _spine_path_constraint_data_set_slotPtr.asFunction(); + /// The mode for positioning the first bone on the path. int spine_path_constraint_data_get_position_mode( spine_path_constraint_data self, ) { @@ -26581,6 +26960,7 @@ class SpineDartBindings { late final _spine_path_constraint_data_set_position_mode = _spine_path_constraint_data_set_position_modePtr.asFunction(); + /// The mode for positioning the bones after the first bone on the path. int spine_path_constraint_data_get_spacing_mode( spine_path_constraint_data self, ) { @@ -26611,6 +26991,7 @@ class SpineDartBindings { late final _spine_path_constraint_data_set_spacing_mode = _spine_path_constraint_data_set_spacing_modePtr.asFunction(); + /// The mode for adjusting the rotation of the bones. int spine_path_constraint_data_get_rotate_mode( spine_path_constraint_data self, ) { @@ -26641,6 +27022,7 @@ class SpineDartBindings { late final _spine_path_constraint_data_set_rotate_mode = _spine_path_constraint_data_set_rotate_modePtr.asFunction(); + /// An offset added to the constrained bone rotation. double spine_path_constraint_data_get_offset_rotation( spine_path_constraint_data self, ) { @@ -26671,6 +27053,7 @@ class SpineDartBindings { late final _spine_path_constraint_data_set_offset_rotation = _spine_path_constraint_data_set_offset_rotationPtr .asFunction(); + /// Resolve ambiguity by forwarding to PosedData's implementation ffi.Pointer spine_path_constraint_data_get_name( spine_path_constraint_data self, ) { @@ -26815,6 +27198,10 @@ class SpineDartBindings { void Function(spine_path_constraint_mix_timeline, spine_skeleton, double, double, spine_array_event, double, int, int, bool)>(); + /// Sets the time and color for the specified frame. + /// + /// @param frame Between 0 and frameCount, inclusive. + /// @param time The frame time in seconds. void spine_path_constraint_mix_timeline_set_frame( spine_path_constraint_mix_timeline self, int frame, @@ -27112,6 +27499,7 @@ class SpineDartBindings { late final _spine_path_constraint_pose_set = _spine_path_constraint_pose_setPtr .asFunction(); + /// The position along the path. double spine_path_constraint_pose_get_position( spine_path_constraint_pose self, ) { @@ -27142,6 +27530,7 @@ class SpineDartBindings { late final _spine_path_constraint_pose_set_position = _spine_path_constraint_pose_set_positionPtr.asFunction(); + /// The spacing between bones. double spine_path_constraint_pose_get_spacing( spine_path_constraint_pose self, ) { @@ -27172,6 +27561,8 @@ class SpineDartBindings { late final _spine_path_constraint_pose_set_spacing = _spine_path_constraint_pose_set_spacingPtr.asFunction(); + /// A percentage (0-1) that controls the mix between the constrained and + /// unconstrained rotation. double spine_path_constraint_pose_get_mix_rotate( spine_path_constraint_pose self, ) { @@ -27202,6 +27593,8 @@ class SpineDartBindings { late final _spine_path_constraint_pose_set_mix_rotate = _spine_path_constraint_pose_set_mix_rotatePtr.asFunction(); + /// A percentage (0-1) that controls the mix between the constrained and + /// unconstrained translation X. double spine_path_constraint_pose_get_mix_x( spine_path_constraint_pose self, ) { @@ -27232,6 +27625,8 @@ class SpineDartBindings { late final _spine_path_constraint_pose_set_mix_x = _spine_path_constraint_pose_set_mix_xPtr.asFunction(); + /// A percentage (0-1) that controls the mix between the constrained and + /// unconstrained translation Y. double spine_path_constraint_pose_get_mix_y( spine_path_constraint_pose self, ) { @@ -27381,6 +27776,10 @@ class SpineDartBindings { _spine_path_constraint_position_timeline_set_constraint_indexPtr .asFunction(); + /// Sets the time and value for the specified frame. + /// + /// @param frame Between 0 and frameCount, inclusive. + /// @param time The frame time in seconds. void spine_path_constraint_position_timeline_set_frame( spine_path_constraint_position_timeline self, int frame, @@ -27402,6 +27801,7 @@ class SpineDartBindings { late final _spine_path_constraint_position_timeline_set_frame = _spine_path_constraint_position_timeline_set_framePtr .asFunction(); + /// Returns the interpolated value for the specified time. double spine_path_constraint_position_timeline_get_curve_value( spine_path_constraint_position_timeline self, double time, @@ -27853,6 +28253,10 @@ class SpineDartBindings { _spine_path_constraint_spacing_timeline_set_constraint_indexPtr .asFunction(); + /// Sets the time and value for the specified frame. + /// + /// @param frame Between 0 and frameCount, inclusive. + /// @param time The frame time in seconds. void spine_path_constraint_spacing_timeline_set_frame( spine_path_constraint_spacing_timeline self, int frame, @@ -27874,6 +28278,7 @@ class SpineDartBindings { late final _spine_path_constraint_spacing_timeline_set_frame = _spine_path_constraint_spacing_timeline_set_framePtr .asFunction(); + /// Returns the interpolated value for the specified time. double spine_path_constraint_spacing_timeline_get_curve_value( spine_path_constraint_spacing_timeline self, double time, @@ -28325,6 +28730,8 @@ class SpineDartBindings { late final _spine_physics_constraint_reset = _spine_physics_constraint_resetPtr.asFunction(); + /// Translates the physics constraint so next update() forces are applied as if + /// the bone moved an additional amount in world space. void spine_physics_constraint_translate( spine_physics_constraint self, double x, @@ -28343,6 +28750,8 @@ class SpineDartBindings { late final _spine_physics_constraint_translate = _spine_physics_constraint_translatePtr.asFunction(); + /// Rotates the physics constraint so next update() forces are applied as if the + /// bone rotated around the specified point in world space. void spine_physics_constraint_rotate( spine_physics_constraint self, double x, @@ -28363,6 +28772,7 @@ class SpineDartBindings { late final _spine_physics_constraint_rotate = _spine_physics_constraint_rotatePtr.asFunction(); + /// The bone constrained by this physics constraint. spine_bone_pose spine_physics_constraint_get_bone( spine_physics_constraint self, ) { @@ -28686,6 +29096,7 @@ class SpineDartBindings { late final _spine_physics_constraint_base_is_source_active = _spine_physics_constraint_base_is_source_activePtr.asFunction(); + /// Inherited from Update void spine_physics_constraint_base_update( spine_physics_constraint_base self, spine_skeleton skeleton, @@ -28833,6 +29244,10 @@ class SpineDartBindings { _spine_physics_constraint_damping_timeline_set_constraint_indexPtr .asFunction(); + /// Sets the time and value for the specified frame. + /// + /// @param frame Between 0 and frameCount, inclusive. + /// @param time The frame time in seconds. void spine_physics_constraint_damping_timeline_set_frame( spine_physics_constraint_damping_timeline self, int frame, @@ -28855,6 +29270,7 @@ class SpineDartBindings { _spine_physics_constraint_damping_timeline_set_framePtr .asFunction(); + /// Returns the interpolated value for the specified time. double spine_physics_constraint_damping_timeline_get_curve_value( spine_physics_constraint_damping_timeline self, double time, @@ -29245,6 +29661,7 @@ class SpineDartBindings { late final _spine_physics_constraint_data_create_method = _spine_physics_constraint_data_create_methodPtr .asFunction(); + /// The bone constrained by this physics constraint. spine_bone_data spine_physics_constraint_data_get_bone( spine_physics_constraint_data self, ) { @@ -29695,6 +30112,7 @@ class SpineDartBindings { late final _spine_physics_constraint_data_set_mix_global = _spine_physics_constraint_data_set_mix_globalPtr.asFunction(); + /// Resolve ambiguity by forwarding to PosedData's implementation ffi.Pointer spine_physics_constraint_data_get_name( spine_physics_constraint_data self, ) { @@ -29882,6 +30300,10 @@ class SpineDartBindings { _spine_physics_constraint_gravity_timeline_set_constraint_indexPtr .asFunction(); + /// Sets the time and value for the specified frame. + /// + /// @param frame Between 0 and frameCount, inclusive. + /// @param time The frame time in seconds. void spine_physics_constraint_gravity_timeline_set_frame( spine_physics_constraint_gravity_timeline self, int frame, @@ -29904,6 +30326,7 @@ class SpineDartBindings { _spine_physics_constraint_gravity_timeline_set_framePtr .asFunction(); + /// Returns the interpolated value for the specified time. double spine_physics_constraint_gravity_timeline_get_curve_value( spine_physics_constraint_gravity_timeline self, double time, @@ -30356,6 +30779,10 @@ class SpineDartBindings { _spine_physics_constraint_inertia_timeline_set_constraint_indexPtr .asFunction(); + /// Sets the time and value for the specified frame. + /// + /// @param frame Between 0 and frameCount, inclusive. + /// @param time The frame time in seconds. void spine_physics_constraint_inertia_timeline_set_frame( spine_physics_constraint_inertia_timeline self, int frame, @@ -30378,6 +30805,7 @@ class SpineDartBindings { _spine_physics_constraint_inertia_timeline_set_framePtr .asFunction(); + /// Returns the interpolated value for the specified time. double spine_physics_constraint_inertia_timeline_get_curve_value( spine_physics_constraint_inertia_timeline self, double time, @@ -30829,6 +31257,10 @@ class SpineDartBindings { _spine_physics_constraint_mass_timeline_set_constraint_indexPtr .asFunction(); + /// Sets the time and value for the specified frame. + /// + /// @param frame Between 0 and frameCount, inclusive. + /// @param time The frame time in seconds. void spine_physics_constraint_mass_timeline_set_frame( spine_physics_constraint_mass_timeline self, int frame, @@ -30850,6 +31282,7 @@ class SpineDartBindings { late final _spine_physics_constraint_mass_timeline_set_frame = _spine_physics_constraint_mass_timeline_set_framePtr .asFunction(); + /// Returns the interpolated value for the specified time. double spine_physics_constraint_mass_timeline_get_curve_value( spine_physics_constraint_mass_timeline self, double time, @@ -31297,6 +31730,10 @@ class SpineDartBindings { _spine_physics_constraint_mix_timeline_set_constraint_indexPtr .asFunction(); + /// Sets the time and value for the specified frame. + /// + /// @param frame Between 0 and frameCount, inclusive. + /// @param time The frame time in seconds. void spine_physics_constraint_mix_timeline_set_frame( spine_physics_constraint_mix_timeline self, int frame, @@ -31317,6 +31754,7 @@ class SpineDartBindings { late final _spine_physics_constraint_mix_timeline_set_frame = _spine_physics_constraint_mix_timeline_set_framePtr .asFunction(); + /// Returns the interpolated value for the specified time. double spine_physics_constraint_mix_timeline_get_curve_value( spine_physics_constraint_mix_timeline self, double time, @@ -31864,6 +32302,8 @@ class SpineDartBindings { late final _spine_physics_constraint_pose_set_gravity = _spine_physics_constraint_pose_set_gravityPtr.asFunction(); + /// A percentage (0-1) that controls the mix between the constrained and + /// unconstrained poses. double spine_physics_constraint_pose_get_mix( spine_physics_constraint_pose self, ) { @@ -31894,6 +32334,7 @@ class SpineDartBindings { late final _spine_physics_constraint_pose_set_mix = _spine_physics_constraint_pose_set_mixPtr.asFunction(); + /// @param constraintIndex -1 for all physics constraints in the skeleton. spine_physics_constraint_reset_timeline spine_physics_constraint_reset_timeline_create( int frameCount, int constraintIndex, @@ -32026,6 +32467,7 @@ class SpineDartBindings { _spine_physics_constraint_reset_timeline_set_constraint_indexPtr .asFunction(); + /// Sets the time for the specified frame. void spine_physics_constraint_reset_timeline_set_frame( spine_physics_constraint_reset_timeline self, int frame, @@ -32234,6 +32676,10 @@ class SpineDartBindings { _spine_physics_constraint_strength_timeline_set_constraint_indexPtr .asFunction(); + /// Sets the time and value for the specified frame. + /// + /// @param frame Between 0 and frameCount, inclusive. + /// @param time The frame time in seconds. void spine_physics_constraint_strength_timeline_set_frame( spine_physics_constraint_strength_timeline self, int frame, @@ -32256,6 +32702,7 @@ class SpineDartBindings { _spine_physics_constraint_strength_timeline_set_framePtr .asFunction(); + /// Returns the interpolated value for the specified time. double spine_physics_constraint_strength_timeline_get_curve_value( spine_physics_constraint_strength_timeline self, double time, @@ -32680,6 +33127,10 @@ class SpineDartBindings { _spine_physics_constraint_timeline_set_constraint_indexPtr .asFunction(); + /// Sets the time and value for the specified frame. + /// + /// @param frame Between 0 and frameCount, inclusive. + /// @param time The frame time in seconds. void spine_physics_constraint_timeline_set_frame( spine_physics_constraint_timeline self, int frame, @@ -32700,6 +33151,7 @@ class SpineDartBindings { late final _spine_physics_constraint_timeline_set_frame = _spine_physics_constraint_timeline_set_framePtr .asFunction(); + /// Returns the interpolated value for the specified time. double spine_physics_constraint_timeline_get_curve_value( spine_physics_constraint_timeline self, double time, @@ -33143,6 +33595,10 @@ class SpineDartBindings { _spine_physics_constraint_wind_timeline_set_constraint_indexPtr .asFunction(); + /// Sets the time and value for the specified frame. + /// + /// @param frame Between 0 and frameCount, inclusive. + /// @param time The frame time in seconds. void spine_physics_constraint_wind_timeline_set_frame( spine_physics_constraint_wind_timeline self, int frame, @@ -33164,6 +33620,7 @@ class SpineDartBindings { late final _spine_physics_constraint_wind_timeline_set_frame = _spine_physics_constraint_wind_timeline_set_framePtr .asFunction(); + /// Returns the interpolated value for the specified time. double spine_physics_constraint_wind_timeline_get_curve_value( spine_physics_constraint_wind_timeline self, double time, @@ -33932,6 +34389,8 @@ class SpineDartBindings { _lookup>('spine_posed_data_dispose'); late final _spine_posed_data_dispose = _spine_posed_data_disposePtr.asFunction(); + /// The constraint's name, which is unique across all constraints in the skeleton + /// of the same type. ffi.Pointer spine_posed_data_get_name( spine_posed_data self, ) { @@ -33945,6 +34404,10 @@ class SpineDartBindings { late final _spine_posed_data_get_name = _spine_posed_data_get_namePtr.asFunction Function(spine_posed_data)>(); + /// When true, Skeleton::updateWorldTransform(Physics) only updates this + /// constraint if the Skeleton::getSkin() contains this constraint. + /// + /// See Skin::getConstraints(). bool spine_posed_data_get_skin_required( spine_posed_data self, ) { @@ -34026,6 +34489,12 @@ class SpineDartBindings { late final _spine_region_attachment_update_region = _spine_region_attachment_update_regionPtr.asFunction(); + /// Transforms the attachment's four vertices to world coordinates. + /// + /// @param slot The parent slot. + /// @param worldVertices The output world vertices. Must have a length greater than or equal to offset + 8. + /// @param offset The worldVertices index to begin writing values. + /// @param stride The number of worldVertices entries between the value pairs written. void spine_region_attachment_compute_world_vertices_1( spine_region_attachment self, spine_slot slot, @@ -34673,6 +35142,10 @@ class SpineDartBindings { late final _spine_rgb2_timeline_get_rtti = _spine_rgb2_timeline_get_rttiPtr.asFunction(); + /// Sets the time, light color, and dark color for the specified frame. + /// + /// @param frame Between 0 and frameCount, inclusive. + /// @param time The frame time in seconds. void spine_rgb2_timeline_set_frame( spine_rgb2_timeline self, int frame, @@ -34985,6 +35458,10 @@ class SpineDartBindings { late final _spine_rgba2_timeline_get_rtti = _spine_rgba2_timeline_get_rttiPtr.asFunction(); + /// Sets the time, light color, and dark color for the specified frame. + /// + /// @param frame Between 0 and frameCount, inclusive. + /// @param time The frame time in seconds. void spine_rgba2_timeline_set_frame( spine_rgba2_timeline self, int frame, @@ -35300,6 +35777,10 @@ class SpineDartBindings { late final _spine_rgba_timeline_get_rtti = _spine_rgba_timeline_get_rttiPtr.asFunction(); + /// Sets the time and color for the specified frame. + /// + /// @param frame Between 0 and frameCount, inclusive. + /// @param time The frame time in seconds. void spine_rgba_timeline_set_frame( spine_rgba_timeline self, int frame, @@ -35608,6 +36089,10 @@ class SpineDartBindings { late final _spine_rgb_timeline_get_rtti = _spine_rgb_timeline_get_rttiPtr.asFunction(); + /// Sets the time and color for the specified frame. + /// + /// @param frame Between 0 and frameCount, inclusive. + /// @param time The frame time in seconds. void spine_rgb_timeline_set_frame( spine_rgb_timeline self, int frame, @@ -35974,6 +36459,10 @@ class SpineDartBindings { late final _spine_rotate_timeline_set_bone_index = _spine_rotate_timeline_set_bone_indexPtr.asFunction(); + /// Sets the time and value for the specified frame. + /// + /// @param frame Between 0 and frameCount, inclusive. + /// @param time The frame time in seconds. void spine_rotate_timeline_set_frame( spine_rotate_timeline self, int frame, @@ -35994,6 +36483,7 @@ class SpineDartBindings { late final _spine_rotate_timeline_set_frame = _spine_rotate_timeline_set_framePtr.asFunction(); + /// Returns the interpolated value for the specified time. double spine_rotate_timeline_get_curve_value( spine_rotate_timeline self, double time, @@ -36756,6 +37246,10 @@ class SpineDartBindings { late final _spine_scale_x_timeline_set_bone_index = _spine_scale_x_timeline_set_bone_indexPtr.asFunction(); + /// Sets the time and value for the specified frame. + /// + /// @param frame Between 0 and frameCount, inclusive. + /// @param time The frame time in seconds. void spine_scale_x_timeline_set_frame( spine_scale_x_timeline self, int frame, @@ -36776,6 +37270,7 @@ class SpineDartBindings { late final _spine_scale_x_timeline_set_frame = _spine_scale_x_timeline_set_framePtr.asFunction(); + /// Returns the interpolated value for the specified time. double spine_scale_x_timeline_get_curve_value( spine_scale_x_timeline self, double time, @@ -37183,6 +37678,10 @@ class SpineDartBindings { late final _spine_scale_y_timeline_set_bone_index = _spine_scale_y_timeline_set_bone_indexPtr.asFunction(); + /// Sets the time and value for the specified frame. + /// + /// @param frame Between 0 and frameCount, inclusive. + /// @param time The frame time in seconds. void spine_scale_y_timeline_set_frame( spine_scale_y_timeline self, int frame, @@ -37203,6 +37702,7 @@ class SpineDartBindings { late final _spine_scale_y_timeline_set_frame = _spine_scale_y_timeline_set_framePtr.asFunction(); + /// Returns the interpolated value for the specified time. double spine_scale_y_timeline_get_curve_value( spine_scale_y_timeline self, double time, @@ -37577,6 +38077,7 @@ class SpineDartBindings { late final _spine_sequence_get_path = _spine_sequence_get_pathPtr .asFunction Function(spine_sequence, ffi.Pointer, int)>(); + /// Returns a unique ID for this attachment. int spine_sequence_get_id( spine_sequence self, ) { @@ -37656,6 +38157,7 @@ class SpineDartBindings { late final _spine_sequence_set_digits = _spine_sequence_set_digitsPtr.asFunction(); + /// The index of the region to show for the setup pose. int spine_sequence_get_setup_index( spine_sequence self, ) { @@ -37773,6 +38275,10 @@ class SpineDartBindings { void Function( spine_sequence_timeline, spine_skeleton, double, double, spine_array_event, double, int, int, bool)>(); + /// Sets the time, mode, index, and frame time for the specified frame. + /// + /// @param frame Between 0 and frameCount, inclusive. + /// @param delay Seconds between frames. void spine_sequence_timeline_set_frame( spine_sequence_timeline self, int frame, @@ -38327,6 +38833,10 @@ class SpineDartBindings { late final _spine_shear_x_timeline_set_bone_index = _spine_shear_x_timeline_set_bone_indexPtr.asFunction(); + /// Sets the time and value for the specified frame. + /// + /// @param frame Between 0 and frameCount, inclusive. + /// @param time The frame time in seconds. void spine_shear_x_timeline_set_frame( spine_shear_x_timeline self, int frame, @@ -38347,6 +38857,7 @@ class SpineDartBindings { late final _spine_shear_x_timeline_set_frame = _spine_shear_x_timeline_set_framePtr.asFunction(); + /// Returns the interpolated value for the specified time. double spine_shear_x_timeline_get_curve_value( spine_shear_x_timeline self, double time, @@ -38754,6 +39265,10 @@ class SpineDartBindings { late final _spine_shear_y_timeline_set_bone_index = _spine_shear_y_timeline_set_bone_indexPtr.asFunction(); + /// Sets the time and value for the specified frame. + /// + /// @param frame Between 0 and frameCount, inclusive. + /// @param time The frame time in seconds. void spine_shear_y_timeline_set_frame( spine_shear_y_timeline self, int frame, @@ -38774,6 +39289,7 @@ class SpineDartBindings { late final _spine_shear_y_timeline_set_frame = _spine_shear_y_timeline_set_framePtr.asFunction(); + /// Returns the interpolated value for the specified time. double spine_shear_y_timeline_get_curve_value( spine_shear_y_timeline self, double time, @@ -39101,6 +39617,8 @@ class SpineDartBindings { _lookup>('spine_skeleton_dispose'); late final _spine_skeleton_dispose = _spine_skeleton_disposePtr.asFunction(); + /// Caches information about bones and constraints. Must be called if bones, + /// constraints or weighted path attachments are added or removed. void spine_skeleton_update_cache( spine_skeleton self, ) { @@ -39168,6 +39686,11 @@ class SpineDartBindings { _lookup>('spine_skeleton_sort_reset'); late final _spine_skeleton_sort_reset = _spine_skeleton_sort_resetPtr.asFunction(); + /// Updates the world transform for each bone and applies all constraints. + /// + /// See [World + /// transforms](http://esotericsoftware.com/spine-runtime-skeletons#World-transforms) + /// in the Spine Runtimes Guide. void spine_skeleton_update_world_transform( spine_skeleton self, int physics, @@ -39184,6 +39707,7 @@ class SpineDartBindings { late final _spine_skeleton_update_world_transform = _spine_skeleton_update_world_transformPtr.asFunction(); + /// Sets the bones, constraints, and slots to their setup pose values. void spine_skeleton_setup_pose( spine_skeleton self, ) { @@ -39196,6 +39720,7 @@ class SpineDartBindings { _lookup>('spine_skeleton_setup_pose'); late final _spine_skeleton_setup_pose = _spine_skeleton_setup_posePtr.asFunction(); + /// Sets the bones and constraints to their setup pose values. void spine_skeleton_setup_pose_bones( spine_skeleton self, ) { @@ -39344,6 +39869,7 @@ class SpineDartBindings { _lookup>('spine_skeleton_get_skin'); late final _spine_skeleton_get_skin = _spine_skeleton_get_skinPtr.asFunction(); + /// Sets a skin by name (see setSkin). void spine_skeleton_set_skin_1( spine_skeleton self, ffi.Pointer skinName, @@ -39360,6 +39886,16 @@ class SpineDartBindings { late final _spine_skeleton_set_skin_1 = _spine_skeleton_set_skin_1Ptr.asFunction)>(); + /// Attachments from the new skin are attached if the corresponding attachment + /// from the old skin was attached. If there was no old skin, each slot's setup + /// mode attachment is attached from the new skin. After changing the skin, the + /// visible attachments can be reset to those attached in the setup pose by + /// calling See Skeleton::setSlotsToSetupPose() Also, often + /// AnimationState::apply(Skeleton & ) is called before the next time the + /// skeleton is rendered to allow any attachment keys in the current animation(s) + /// to hide or show attachments from the new skin. + /// + /// @param newSkin May be NULL. void spine_skeleton_set_skin_2( spine_skeleton self, spine_skin newSkin, @@ -39411,6 +39947,7 @@ class SpineDartBindings { late final _spine_skeleton_get_attachment_2 = _spine_skeleton_get_attachment_2Ptr .asFunction)>(); + /// @param attachmentName May be empty. void spine_skeleton_set_attachment( spine_skeleton self, ffi.Pointer slotName, @@ -39456,6 +39993,13 @@ class SpineDartBindings { late final _spine_skeleton_get_physics_constraints = _spine_skeleton_get_physics_constraintsPtr.asFunction(); + /// Returns the axis aligned bounding box (AABB) of the region and mesh + /// attachments for the current pose. + /// + /// @param outX The horizontal distance between the skeleton origin and the left side of the AABB. + /// @param outY The vertical distance between the skeleton origin and the bottom side of the AABB. + /// @param outWidth The width of the AABB + /// @param outHeight The height of the AABB. void spine_skeleton_get_bounds_1( spine_skeleton self, ffi.Pointer outX, @@ -39480,6 +40024,15 @@ class SpineDartBindings { void Function(spine_skeleton, ffi.Pointer, ffi.Pointer, ffi.Pointer, ffi.Pointer)>(); + /// Returns the axis aligned bounding box (AABB) of the region and mesh + /// attachments for the current pose. + /// + /// @param outX The horizontal distance between the skeleton origin and the left side of the AABB. + /// @param outY The vertical distance between the skeleton origin and the bottom side of the AABB. + /// @param outWidth The width of the AABB + /// @param outHeight The height of the AABB. + /// @param outVertexBuffer Reference to hold an array of floats. This method will assign it with new floats as needed. + /// @param clipping Pointer to a SkeletonClipping instance or NULL. If a clipper is given, clipping attachments will be taken into account. void spine_skeleton_get_bounds_2( spine_skeleton self, ffi.Pointer outX, @@ -39827,6 +40380,7 @@ class SpineDartBindings { late final _spine_skeleton_set_gravity_y = _spine_skeleton_set_gravity_yPtr.asFunction(); + /// Rotates the physics constraint so next { void spine_skeleton_physics_translate( spine_skeleton self, double x, @@ -39845,6 +40399,7 @@ class SpineDartBindings { late final _spine_skeleton_physics_translate = _spine_skeleton_physics_translatePtr.asFunction(); + /// Calls { void spine_skeleton_physics_rotate( spine_skeleton self, double x, @@ -40034,6 +40589,11 @@ class SpineDartBindings { late final _spine_skeleton_bounds_dispose = _spine_skeleton_bounds_disposePtr.asFunction(); + /// Clears any previous polygons, finds all visible bounding box attachments, and + /// computes the world vertices for each bounding box's polygon. + /// + /// @param skeleton The skeleton. + /// @param updateAabb If true, the axis aligned bounding box containing all the polygons is computed. If false, the SkeletonBounds AABB methods will always return true. void spine_skeleton_bounds_update( spine_skeleton_bounds self, spine_skeleton skeleton, @@ -40052,6 +40612,7 @@ class SpineDartBindings { late final _spine_skeleton_bounds_update = _spine_skeleton_bounds_updatePtr.asFunction(); + /// Returns true if the axis aligned bounding box contains the point. bool spine_skeleton_bounds_aabb_contains_point( spine_skeleton_bounds self, double x, @@ -40070,6 +40631,7 @@ class SpineDartBindings { late final _spine_skeleton_bounds_aabb_contains_point = _spine_skeleton_bounds_aabb_contains_pointPtr.asFunction(); + /// Returns true if the axis aligned bounding box intersects the line segment. bool spine_skeleton_bounds_aabb_intersects_segment( spine_skeleton_bounds self, double x1, @@ -40092,6 +40654,8 @@ class SpineDartBindings { late final _spine_skeleton_bounds_aabb_intersects_segment = _spine_skeleton_bounds_aabb_intersects_segmentPtr .asFunction(); + /// Returns true if the axis aligned bounding box intersects the axis aligned + /// bounding box of the specified bounds. bool spine_skeleton_bounds_aabb_intersects_skeleton( spine_skeleton_bounds self, spine_skeleton_bounds bounds, @@ -40108,6 +40672,7 @@ class SpineDartBindings { late final _spine_skeleton_bounds_aabb_intersects_skeleton = _spine_skeleton_bounds_aabb_intersects_skeletonPtr .asFunction(); + /// Returns true if the polygon contains the point. bool spine_skeleton_bounds_contains_point_1( spine_skeleton_bounds self, spine_polygon polygon, @@ -40169,6 +40734,7 @@ class SpineDartBindings { late final _spine_skeleton_bounds_intersects_segment_1 = _spine_skeleton_bounds_intersects_segment_1Ptr .asFunction(); + /// Returns true if the polygon contains any part of the line segment. bool spine_skeleton_bounds_intersects_segment_2( spine_skeleton_bounds self, spine_polygon polygon, @@ -40226,6 +40792,7 @@ class SpineDartBindings { late final _spine_skeleton_bounds_get_bounding_box = _spine_skeleton_bounds_get_bounding_boxPtr .asFunction(); + /// Returns all polygons or an empty array. Requires a call to update() first. spine_array_polygon spine_skeleton_bounds_get_polygons( spine_skeleton_bounds self, ) { @@ -40240,6 +40807,7 @@ class SpineDartBindings { late final _spine_skeleton_bounds_get_polygons = _spine_skeleton_bounds_get_polygonsPtr.asFunction(); + /// Returns all bounding boxes. Requires a call to update() first. spine_array_bounding_box_attachment spine_skeleton_bounds_get_bounding_boxes( spine_skeleton_bounds self, ) { @@ -40254,6 +40822,7 @@ class SpineDartBindings { late final _spine_skeleton_bounds_get_bounding_boxes = _spine_skeleton_bounds_get_bounding_boxesPtr .asFunction(); + /// The left edge of the axis aligned bounding box. double spine_skeleton_bounds_get_min_x( spine_skeleton_bounds self, ) { @@ -40267,6 +40836,7 @@ class SpineDartBindings { late final _spine_skeleton_bounds_get_min_x = _spine_skeleton_bounds_get_min_xPtr.asFunction(); + /// The bottom edge of the axis aligned bounding box. double spine_skeleton_bounds_get_min_y( spine_skeleton_bounds self, ) { @@ -40280,6 +40850,7 @@ class SpineDartBindings { late final _spine_skeleton_bounds_get_min_y = _spine_skeleton_bounds_get_min_yPtr.asFunction(); + /// The right edge of the axis aligned bounding box. double spine_skeleton_bounds_get_max_x( spine_skeleton_bounds self, ) { @@ -40293,6 +40864,7 @@ class SpineDartBindings { late final _spine_skeleton_bounds_get_max_x = _spine_skeleton_bounds_get_max_xPtr.asFunction(); + /// The top edge of the axis aligned bounding box. double spine_skeleton_bounds_get_max_y( spine_skeleton_bounds self, ) { @@ -40306,6 +40878,7 @@ class SpineDartBindings { late final _spine_skeleton_bounds_get_max_y = _spine_skeleton_bounds_get_max_yPtr.asFunction(); + /// The width of the axis aligned bounding box. double spine_skeleton_bounds_get_width( spine_skeleton_bounds self, ) { @@ -40319,6 +40892,7 @@ class SpineDartBindings { late final _spine_skeleton_bounds_get_width = _spine_skeleton_bounds_get_widthPtr.asFunction(); + /// The height of the axis aligned bounding box. double spine_skeleton_bounds_get_height( spine_skeleton_bounds self, ) { @@ -40692,6 +41266,8 @@ class SpineDartBindings { late final _spine_skin_disposePtr = _lookup>('spine_skin_dispose'); late final _spine_skin_dispose = _spine_skin_disposePtr.asFunction(); + /// Adds an attachment to the skin for the specified slot index and name. If the + /// name already exists for the slot, the previous value is replaced. void spine_skin_set_attachment( spine_skin self, int slotIndex, @@ -40730,6 +41306,7 @@ class SpineDartBindings { late final _spine_skin_get_attachment = _spine_skin_get_attachmentPtr.asFunction)>(); + /// Removes the attachment from the skin. void spine_skin_remove_attachment( spine_skin self, int slotIndex, @@ -40748,6 +41325,11 @@ class SpineDartBindings { late final _spine_skin_remove_attachment = _spine_skin_remove_attachmentPtr.asFunction)>(); + /// Finds the attachments for a given slot. The results are added to the passed + /// array of Attachments. + /// + /// @param slotIndex The target slotIndex. To find the slot index, use SkeletonData::findSlot and SlotData::getIndex. + /// @param attachments Found Attachments will be added to this array. void spine_skin_find_attachments_for_slot( spine_skin self, int slotIndex, @@ -40778,6 +41360,8 @@ class SpineDartBindings { _lookup Function(spine_skin)>>('spine_skin_get_name'); late final _spine_skin_get_name = _spine_skin_get_namePtr.asFunction Function(spine_skin)>(); + /// Adds all attachments, bones, and constraints from the specified skin to this + /// skin. void spine_skin_add_skin( spine_skin self, spine_skin other, @@ -40792,6 +41376,8 @@ class SpineDartBindings { _lookup>('spine_skin_add_skin'); late final _spine_skin_add_skin = _spine_skin_add_skinPtr.asFunction(); + /// Adds all attachments, bones, and constraints from the specified skin to this + /// skin. Attachments are deep copied. void spine_skin_copy_skin( spine_skin self, spine_skin other, @@ -41234,6 +41820,7 @@ class SpineDartBindings { late final _spine_slider_base_is_source_active = _spine_slider_base_is_source_activePtr.asFunction(); + /// Inherited from Update void spine_slider_base_update( spine_slider_base self, spine_skeleton skeleton, @@ -41297,6 +41884,7 @@ class SpineDartBindings { late final _spine_slider_data_get_rtti = _spine_slider_data_get_rttiPtr.asFunction(); + /// Creates a slider instance. spine_constraint spine_slider_data_create_method( spine_slider_data self, spine_skeleton skeleton, @@ -41539,6 +42127,7 @@ class SpineDartBindings { late final _spine_slider_data_set_local = _spine_slider_data_set_localPtr.asFunction(); + /// Resolve ambiguity by forwarding to PosedData's implementation ffi.Pointer spine_slider_data_get_name( spine_slider_data self, ) { @@ -41707,6 +42296,10 @@ class SpineDartBindings { late final _spine_slider_mix_timeline_set_constraint_index = _spine_slider_mix_timeline_set_constraint_indexPtr.asFunction(); + /// Sets the time and value for the specified frame. + /// + /// @param frame Between 0 and frameCount, inclusive. + /// @param time The frame time in seconds. void spine_slider_mix_timeline_set_frame( spine_slider_mix_timeline self, int frame, @@ -41727,6 +42320,7 @@ class SpineDartBindings { late final _spine_slider_mix_timeline_set_frame = _spine_slider_mix_timeline_set_framePtr .asFunction(); + /// Returns the interpolated value for the specified time. double spine_slider_mix_timeline_get_curve_value( spine_slider_mix_timeline self, double time, @@ -42228,6 +42822,10 @@ class SpineDartBindings { late final _spine_slider_timeline_set_constraint_index = _spine_slider_timeline_set_constraint_indexPtr.asFunction(); + /// Sets the time and value for the specified frame. + /// + /// @param frame Between 0 and frameCount, inclusive. + /// @param time The frame time in seconds. void spine_slider_timeline_set_frame( spine_slider_timeline self, int frame, @@ -42248,6 +42846,7 @@ class SpineDartBindings { late final _spine_slider_timeline_set_frame = _spine_slider_timeline_set_framePtr.asFunction(); + /// Returns the interpolated value for the specified time. double spine_slider_timeline_get_curve_value( spine_slider_timeline self, double time, @@ -42575,6 +43174,7 @@ class SpineDartBindings { late final _spine_slot_disposePtr = _lookup>('spine_slot_dispose'); late final _spine_slot_dispose = _spine_slot_disposePtr.asFunction(); + /// The bone this slot belongs to. spine_bone spine_slot_get_bone( spine_slot self, ) { @@ -42599,6 +43199,7 @@ class SpineDartBindings { _lookup>('spine_slot_setup_pose'); late final _spine_slot_setup_pose = _spine_slot_setup_posePtr.asFunction(); + /// The constraint's setup pose data. spine_slot_data spine_slot_get_data( spine_slot self, ) { @@ -42975,6 +43576,7 @@ class SpineDartBindings { _lookup>('spine_slot_data_dispose'); late final _spine_slot_data_dispose = _spine_slot_data_disposePtr.asFunction(); + /// The index of the slot in Skeleton::getSlots(). int spine_slot_data_get_index( spine_slot_data self, ) { @@ -42987,6 +43589,7 @@ class SpineDartBindings { _lookup>('spine_slot_data_get_index'); late final _spine_slot_data_get_index = _spine_slot_data_get_indexPtr.asFunction(); + /// The bone this slot belongs to. spine_bone_data spine_slot_data_get_bone_data( spine_slot_data self, ) { @@ -43016,6 +43619,8 @@ class SpineDartBindings { late final _spine_slot_data_set_attachment_name = _spine_slot_data_set_attachment_namePtr.asFunction)>(); + /// The name of the attachment that is visible for this slot in the setup pose, + /// or empty if no attachment is visible. ffi.Pointer spine_slot_data_get_attachment_name( spine_slot_data self, ) { @@ -43030,6 +43635,7 @@ class SpineDartBindings { late final _spine_slot_data_get_attachment_name = _spine_slot_data_get_attachment_namePtr.asFunction Function(spine_slot_data)>(); + /// The blend mode for drawing the slot's attachment. int spine_slot_data_get_blend_mode( spine_slot_data self, ) { @@ -43058,6 +43664,8 @@ class SpineDartBindings { late final _spine_slot_data_set_blend_mode = _spine_slot_data_set_blend_modePtr.asFunction(); + /// False if the slot was hidden in Spine and nonessential data was exported. + /// Does not affect runtime rendering. bool spine_slot_data_get_visible( spine_slot_data self, ) { @@ -43099,6 +43707,8 @@ class SpineDartBindings { late final _spine_slot_data_get_setup_pose = _spine_slot_data_get_setup_posePtr.asFunction(); + /// The constraint's name, which is unique across all constraints in the skeleton + /// of the same type. ffi.Pointer spine_slot_data_get_name( spine_slot_data self, ) { @@ -43112,6 +43722,10 @@ class SpineDartBindings { late final _spine_slot_data_get_name = _spine_slot_data_get_namePtr.asFunction Function(spine_slot_data)>(); + /// When true, Skeleton::updateWorldTransform(Physics) only updates this + /// constraint if the Skeleton::getSkin() contains this constraint. + /// + /// See Skin::getConstraints(). bool spine_slot_data_get_skin_required( spine_slot_data self, ) { @@ -43175,6 +43789,8 @@ class SpineDartBindings { late final _spine_slot_pose_set = _spine_slot_pose_setPtr.asFunction(); + /// The color used to tint the slot's attachment. If getDarkColor() is set, this + /// is used as the light color for two color tinting. spine_color spine_slot_pose_get_color( spine_slot_pose self, ) { @@ -43188,6 +43804,8 @@ class SpineDartBindings { late final _spine_slot_pose_get_color = _spine_slot_pose_get_colorPtr.asFunction(); + /// The dark color used to tint the slot's attachment for two color tinting. The + /// dark color's alpha is not used. spine_color spine_slot_pose_get_dark_color( spine_slot_pose self, ) { @@ -43201,6 +43819,7 @@ class SpineDartBindings { late final _spine_slot_pose_get_dark_color = _spine_slot_pose_get_dark_colorPtr.asFunction(); + /// Returns true if this slot has a dark color. bool spine_slot_pose_has_dark_color( spine_slot_pose self, ) { @@ -43242,6 +43861,10 @@ class SpineDartBindings { late final _spine_slot_pose_get_attachment = _spine_slot_pose_get_attachmentPtr.asFunction(); + /// Sets the slot's attachment and, if the attachment changed, resets + /// sequenceIndex and clears the deform. The deform is not cleared if the old + /// attachment has the same VertexAttachment::getTimelineAttachment() as the + /// specified attachment. void spine_slot_pose_set_attachment( spine_slot_pose self, spine_attachment attachment, @@ -43258,6 +43881,8 @@ class SpineDartBindings { late final _spine_slot_pose_set_attachment = _spine_slot_pose_set_attachmentPtr.asFunction(); + /// The index of the texture region to display when the slot's attachment has a + /// Sequence. -1 represents the Sequence::getSetupIndex(). int spine_slot_pose_get_sequence_index( spine_slot_pose self, ) { @@ -43286,6 +43911,12 @@ class SpineDartBindings { late final _spine_slot_pose_set_sequence_index = _spine_slot_pose_set_sequence_indexPtr.asFunction(); + /// Values to deform the slot's attachment. For an unweighted mesh, the entries + /// are local positions for each vertex. For a weighted mesh, the entries are an + /// offset for each vertex which will be added to the mesh's local vertex + /// positions. + /// + /// See VertexAttachment::computeWorldVertices() and DeformTimeline. spine_array_float spine_slot_pose_get_deform( spine_slot_pose self, ) { @@ -43325,6 +43956,8 @@ class SpineDartBindings { late final _spine_slot_timeline_get_rtti = _spine_slot_timeline_get_rttiPtr.asFunction(); + /// The index of the slot in Skeleton::getSlots() that will be changed when this + /// timeline is applied. int spine_slot_timeline_get_slot_index( spine_slot_timeline self, ) { @@ -43629,6 +44262,16 @@ class SpineDartBindings { _lookup>('spine_timeline_get_rtti'); late final _spine_timeline_get_rtti = _spine_timeline_get_rttiPtr.asFunction(); + /// Sets the value(s) for the specified time. + /// + /// @param skeleton The skeleton the timeline is being applied to. This provides access to the bones, slots, and other skeleton components the timeline may change. + /// @param lastTime lastTime The time this timeline was last applied. Timelines such as EventTimeline trigger only at specific times rather than every frame. In that case, the timeline triggers everything between lastTime (exclusive) and time (inclusive). + /// @param time The time within the animation. Most timelines find the key before and the key after this time so they can interpolate between the keys. + /// @param events If any events are fired, they are added to this array. Can be NULL to ignore firing events or if the timeline does not fire events. May be NULL. + /// @param alpha alpha 0 applies the current or setup pose value (depending on pose parameter). 1 applies the timeline value. Between 0 and 1 applies a value between the current or setup pose and the timeline value. By adjusting alpha over time, an animation can be mixed in or out. alpha can also be useful to apply animations on top of each other (layered). + /// @param blend Controls how mixing is applied when alpha is than 1. + /// @param direction Indicates whether the timeline is mixing in or out. Used by timelines which perform instant transitions such as DrawOrderTimeline and AttachmentTimeline. + /// @param appliedPose True to modify the applied pose. void spine_timeline_apply( spine_timeline self, spine_skeleton skeleton, @@ -43757,6 +44400,7 @@ class SpineDartBindings { late final _spine_to_property_get_rtti = _spine_to_property_get_rttiPtr.asFunction(); + /// Reads the mix for this property from the specified pose. double spine_to_property_mix( spine_to_property self, spine_transform_constraint_pose pose, @@ -43773,6 +44417,7 @@ class SpineDartBindings { late final _spine_to_property_mix = _spine_to_property_mixPtr.asFunction(); + /// Applies the value to this property. void spine_to_property_apply( spine_to_property self, spine_skeleton skeleton, @@ -44408,6 +45053,7 @@ class SpineDartBindings { _lookup>('spine_track_entry_dispose'); late final _spine_track_entry_dispose = _spine_track_entry_disposePtr.asFunction(); + /// The index of the track where this entry is either current or queued. int spine_track_entry_get_track_index( spine_track_entry self, ) { @@ -44421,6 +45067,7 @@ class SpineDartBindings { late final _spine_track_entry_get_track_index = _spine_track_entry_get_track_indexPtr.asFunction(); + /// The animation to apply for this track entry. spine_animation spine_track_entry_get_animation( spine_track_entry self, ) { @@ -44434,6 +45081,7 @@ class SpineDartBindings { late final _spine_track_entry_get_animation = _spine_track_entry_get_animationPtr.asFunction(); + /// Sets the animation for this track entry. void spine_track_entry_set_animation( spine_track_entry self, spine_animation animation, @@ -44463,6 +45111,8 @@ class SpineDartBindings { late final _spine_track_entry_get_previous = _spine_track_entry_get_previousPtr.asFunction(); + /// If true, the animation will repeat. If false, it will not, instead its last + /// frame is applied if played beyond its duration. bool spine_track_entry_get_loop( spine_track_entry self, ) { @@ -44491,6 +45141,20 @@ class SpineDartBindings { late final _spine_track_entry_set_loop = _spine_track_entry_set_loopPtr.asFunction(); + /// If true, when mixing from the previous animation to this animation, the + /// previous animation is applied as normal instead of being mixed out. + /// + /// When mixing between animations that key the same property, if a lower track + /// also keys that property then the value will briefly dip toward the lower + /// track value during the mix. This happens because the first animation mixes + /// from 100% to 0% while the second animation mixes from 0% to 100%. Setting + /// holdPrevious to true applies the first animation at 100% during the mix so + /// the lower track value is overwritten. Such dipping does not occur on the + /// lowest track which keys the property, only when a higher track also keys the + /// property. + /// + /// Snapping will occur if holdPrevious is true and this animation does not key + /// all the same properties as the previous animation. bool spine_track_entry_get_hold_previous( spine_track_entry self, ) { @@ -44577,6 +45241,19 @@ class SpineDartBindings { late final _spine_track_entry_set_shortest_rotation = _spine_track_entry_set_shortest_rotationPtr.asFunction(); + /// Seconds to postpone playing the animation. Must be >= 0. When this track + /// entry is the current track entry, delay postpones incrementing the + /// getTrackTime(). When this track entry is queued, delay is the time from the + /// start of the previous animation to when this track entry will become the + /// current track entry (ie when the previous track entry getTrackTime() >= this + /// track entry's delay). + /// + /// getTimeScale() affects the delay. + /// + /// When passing delay < = 0 to AnimationState::addAnimation(int, Animation, + /// bool, float) this delay is set using a mix duration from AnimationStateData. + /// To change the getMixDuration() afterward, use setMixDuration(float, float) so + /// this delay is adjusted. double spine_track_entry_get_delay( spine_track_entry self, ) { @@ -44605,6 +45282,9 @@ class SpineDartBindings { late final _spine_track_entry_set_delay = _spine_track_entry_set_delayPtr.asFunction(); + /// Current time in seconds this track entry has been the current track entry. + /// The track time determines getAnimationTime(). The track time can be set to + /// start the animation at a time other than 0, without affecting looping. double spine_track_entry_get_track_time( spine_track_entry self, ) { @@ -44633,6 +45313,15 @@ class SpineDartBindings { late final _spine_track_entry_set_track_time = _spine_track_entry_set_track_timePtr.asFunction(); + /// The track time in seconds when this animation will be removed from the track. + /// Defaults to the highest possible float value, meaning the animation will be + /// applied until a new animation is set or the track is cleared. If the track + /// end time is reached, no other animations are queued for playback, and mixing + /// from any previous animations is complete, then the properties keyed by the + /// animation are set to the setup pose and the track is cleared. + /// + /// It may be desired to use AnimationState::addEmptyAnimation(int, float, float) + /// rather than have the animation abruptly cease being applied. double spine_track_entry_get_track_end( spine_track_entry self, ) { @@ -44661,6 +45350,12 @@ class SpineDartBindings { late final _spine_track_entry_set_track_end = _spine_track_entry_set_track_endPtr.asFunction(); + /// Seconds when this animation starts, both initially and after looping. + /// Defaults to 0. + /// + /// When changing the animation start time, it often makes sense to set + /// TrackEntry.AnimationLast to the same value to prevent timeline keys before + /// the start time from triggering. double spine_track_entry_get_animation_start( spine_track_entry self, ) { @@ -44690,6 +45385,9 @@ class SpineDartBindings { late final _spine_track_entry_set_animation_start = _spine_track_entry_set_animation_startPtr.asFunction(); + /// Seconds for the last frame of this animation. Non-looping animations won't + /// play past this time. Looping animations will loop back to + /// TrackEntry.AnimationStart at this time. Defaults to the animation duration. double spine_track_entry_get_animation_end( spine_track_entry self, ) { @@ -44719,6 +45417,11 @@ class SpineDartBindings { late final _spine_track_entry_set_animation_end = _spine_track_entry_set_animation_endPtr.asFunction(); + /// The time in seconds this animation was last applied. Some timelines use this + /// for one-time triggers. Eg, when this animation is applied, event timelines + /// will fire all events between the animation last time (exclusive) and + /// animation time (inclusive). Defaults to -1 to ensure triggers on frame 0 + /// happen the first time this animation is applied. double spine_track_entry_get_animation_last( spine_track_entry self, ) { @@ -44748,6 +45451,13 @@ class SpineDartBindings { late final _spine_track_entry_set_animation_last = _spine_track_entry_set_animation_lastPtr.asFunction(); + /// Uses getTrackTime() to compute the animationTime. When the trackTime is 0, + /// the animationTime is equal to the animationStart time. + /// + /// The animationTime is between getAnimationStart() and getAnimationEnd(), + /// except if this track entry is non-looping and getAnimationEnd() is >= to the + /// animation duration, then animationTime continues to increase past + /// getAnimationEnd(). double spine_track_entry_get_animation_time( spine_track_entry self, ) { @@ -44761,6 +45471,21 @@ class SpineDartBindings { late final _spine_track_entry_get_animation_time = _spine_track_entry_get_animation_timePtr.asFunction(); + /// Multiplier for the delta time when this track entry is updated, causing time + /// for this animation to pass slower or faster. Defaults to 1. + /// + /// Values < 0 are not supported. To play an animation in reverse, use + /// getReverse(). + /// + /// getMixTime() is not affected by track entry time scale, so getMixDuration() + /// may need to be adjusted to match the animation speed. + /// + /// When using AnimationState::addAnimation(int, Animation, bool, float) with a + /// delay < = 0, the getDelay() is set using the mix duration from the + /// AnimationStateData, assuming time scale to be 1. If the time scale is not 1, + /// the delay may need to be adjusted. + /// + /// See AnimationState getTimeScale() for affecting all animations. double spine_track_entry_get_time_scale( spine_track_entry self, ) { @@ -44789,6 +45514,12 @@ class SpineDartBindings { late final _spine_track_entry_set_time_scale = _spine_track_entry_set_time_scalePtr.asFunction(); + /// Values less than 1 mix this animation with the last skeleton pose. Defaults + /// to 1, which overwrites the last skeleton pose with this animation. + /// + /// Typically track 0 is used to completely pose the skeleton, then alpha can be + /// used on higher tracks. It doesn't make sense to use alpha on track 0 if the + /// skeleton pose is from the last frame render. double spine_track_entry_get_alpha( spine_track_entry self, ) { @@ -44817,6 +45548,10 @@ class SpineDartBindings { late final _spine_track_entry_set_alpha = _spine_track_entry_set_alphaPtr.asFunction(); + /// When the mix percentage (mix time / mix duration) is less than the event + /// threshold, event timelines for the animation being mixed out will be applied. + /// Defaults to 0, so event timelines are not applied for an animation being + /// mixed out. double spine_track_entry_get_event_threshold( spine_track_entry self, ) { @@ -44846,6 +45581,10 @@ class SpineDartBindings { late final _spine_track_entry_set_event_threshold = _spine_track_entry_set_event_thresholdPtr.asFunction(); + /// When the mix percentage (mix time / mix duration) is less than the attachment + /// threshold, attachment timelines for the animation being mixed out will be + /// applied. Defaults to 0, so attachment timelines are not applied for an + /// animation being mixed out. double spine_track_entry_get_mix_attachment_threshold( spine_track_entry self, ) { @@ -44876,6 +45615,9 @@ class SpineDartBindings { late final _spine_track_entry_set_mix_attachment_threshold = _spine_track_entry_set_mix_attachment_thresholdPtr.asFunction(); + /// When getAlpha() is greater than alphaAttachmentThreshold, attachment + /// timelines are applied. Defaults to 0, so attachment timelines are always + /// applied. double spine_track_entry_get_alpha_attachment_threshold( spine_track_entry self, ) { @@ -44906,6 +45648,10 @@ class SpineDartBindings { late final _spine_track_entry_set_alpha_attachment_threshold = _spine_track_entry_set_alpha_attachment_thresholdPtr.asFunction(); + /// When the mix percentage (mix time / mix duration) is less than the draw order + /// threshold, draw order timelines for the animation being mixed out will be + /// applied. Defaults to 0, so draw order timelines are not applied for an + /// animation being mixed out. double spine_track_entry_get_mix_draw_order_threshold( spine_track_entry self, ) { @@ -44949,6 +45695,7 @@ class SpineDartBindings { late final _spine_track_entry_get_next = _spine_track_entry_get_nextPtr.asFunction(); + /// Returns true if at least one loop has been completed. bool spine_track_entry_is_complete( spine_track_entry self, ) { @@ -44962,6 +45709,9 @@ class SpineDartBindings { late final _spine_track_entry_is_complete = _spine_track_entry_is_completePtr.asFunction(); + /// Seconds from 0 to the mix duration when mixing from the previous animation to + /// this animation. May be slightly more than TrackEntry.MixDuration when the mix + /// is complete. double spine_track_entry_get_mix_time( spine_track_entry self, ) { @@ -44990,6 +45740,17 @@ class SpineDartBindings { late final _spine_track_entry_set_mix_time = _spine_track_entry_set_mix_timePtr.asFunction(); + /// Seconds for mixing from the previous animation to this animation. Defaults to + /// the value provided by AnimationStateData based on the animation before this + /// animation (if any). + /// + /// The mix duration can be set manually rather than use the value from + /// AnimationStateData.GetMix. In that case, the mixDuration must be set before + /// AnimationState.update(float) is next called. + /// + /// When using AnimationState::addAnimation(int, Animation, bool, float) with a + /// delay less than or equal to 0, note the Delay is set using the mix duration + /// from the AnimationStateData double spine_track_entry_get_mix_duration( spine_track_entry self, ) { @@ -45019,6 +45780,9 @@ class SpineDartBindings { late final _spine_track_entry_set_mix_duration_1 = _spine_track_entry_set_mix_duration_1Ptr.asFunction(); + /// Sets both getMixDuration() and getDelay(). + /// + /// @param delay If > 0, sets TrackEntry::getDelay(). If < = 0, the delay set is the duration of the previous track entry minus the specified mix duration plus the specified delay (ie the mix ends at (delay = 0) or before (delay < 0) the previous track entry duration). If the previous entry is looping, its next loop completion is used instead of its duration. void spine_track_entry_set_mix_duration_2( spine_track_entry self, double mixDuration, @@ -45091,6 +45855,16 @@ class SpineDartBindings { late final _spine_track_entry_get_mixing_to = _spine_track_entry_get_mixing_toPtr.asFunction(); + /// Resets the rotation directions for mixing this entry's rotate timelines. This + /// can be useful to avoid bones rotating the long way around when using alpha + /// and starting animations on other tracks. + /// + /// Mixing involves finding a rotation between two others, which has two possible + /// solutions: the short way or the long way around. The two rotations likely + /// change over time, so which direction is the short or long way also changes. + /// If the short way was always chosen, bones would flip to the other side when + /// that direction became the long way. TrackEntry chooses the short way the + /// first time it is applied and remembers that direction. void spine_track_entry_reset_rotation_directions( spine_track_entry self, ) { @@ -45117,6 +45891,7 @@ class SpineDartBindings { late final _spine_track_entry_get_track_complete = _spine_track_entry_get_track_completePtr.asFunction(); + /// Returns true if this entry is for the empty animation. bool spine_track_entry_is_empty_animation( spine_track_entry self, ) { @@ -45130,6 +45905,9 @@ class SpineDartBindings { late final _spine_track_entry_is_empty_animation = _spine_track_entry_is_empty_animationPtr.asFunction(); + /// Returns true if this track entry has been applied at least once. + /// + /// See AnimationState::apply(Skeleton). bool spine_track_entry_was_applied( spine_track_entry self, ) { @@ -45143,6 +45921,8 @@ class SpineDartBindings { late final _spine_track_entry_was_applied = _spine_track_entry_was_appliedPtr.asFunction(); + /// Returns true if there is a getNext() track entry that is ready to become the + /// current track entry during the next AnimationState::update(float)} bool spine_track_entry_is_next_ready( spine_track_entry self, ) { @@ -45259,6 +46039,7 @@ class SpineDartBindings { late final _spine_transform_constraint_copy = _spine_transform_constraint_copyPtr .asFunction(); + /// Applies the constraint to the constrained bones. void spine_transform_constraint_update( spine_transform_constraint self, spine_skeleton skeleton, @@ -45307,6 +46088,7 @@ class SpineDartBindings { late final _spine_transform_constraint_is_source_active = _spine_transform_constraint_is_source_activePtr.asFunction(); + /// The bones that will be modified by this transform constraint. spine_array_bone_pose spine_transform_constraint_get_bones( spine_transform_constraint self, ) { @@ -45321,6 +46103,7 @@ class SpineDartBindings { late final _spine_transform_constraint_get_bones = _spine_transform_constraint_get_bonesPtr.asFunction(); + /// The bone whose world transform will be copied to the constrained bones. spine_bone spine_transform_constraint_get_source( spine_transform_constraint self, ) { @@ -45646,6 +46429,7 @@ class SpineDartBindings { late final _spine_transform_constraint_base_is_source_active = _spine_transform_constraint_base_is_source_activePtr.asFunction(); + /// Inherited from Update void spine_transform_constraint_base_update( spine_transform_constraint_base self, spine_skeleton skeleton, @@ -45731,6 +46515,7 @@ class SpineDartBindings { late final _spine_transform_constraint_data_create_method = _spine_transform_constraint_data_create_methodPtr .asFunction(); + /// The bones that will be modified by this transform constraint. spine_array_bone_data spine_transform_constraint_data_get_bones( spine_transform_constraint_data self, ) { @@ -45745,6 +46530,7 @@ class SpineDartBindings { late final _spine_transform_constraint_data_get_bones = _spine_transform_constraint_data_get_bonesPtr .asFunction(); + /// The bone whose world transform will be copied to the constrained bones. spine_bone_data spine_transform_constraint_data_get_source( spine_transform_constraint_data self, ) { @@ -45775,6 +46561,7 @@ class SpineDartBindings { late final _spine_transform_constraint_data_set_source = _spine_transform_constraint_data_set_sourcePtr .asFunction(); + /// An offset added to the constrained bone rotation. double spine_transform_constraint_data_get_offset_rotation( spine_transform_constraint_data self, ) { @@ -45807,6 +46594,7 @@ class SpineDartBindings { _spine_transform_constraint_data_set_offset_rotationPtr .asFunction(); + /// An offset added to the constrained bone X translation. double spine_transform_constraint_data_get_offset_x( spine_transform_constraint_data self, ) { @@ -45837,6 +46625,7 @@ class SpineDartBindings { late final _spine_transform_constraint_data_set_offset_x = _spine_transform_constraint_data_set_offset_xPtr .asFunction(); + /// An offset added to the constrained bone Y translation. double spine_transform_constraint_data_get_offset_y( spine_transform_constraint_data self, ) { @@ -45867,6 +46656,7 @@ class SpineDartBindings { late final _spine_transform_constraint_data_set_offset_y = _spine_transform_constraint_data_set_offset_yPtr .asFunction(); + /// An offset added to the constrained bone scaleX. double spine_transform_constraint_data_get_offset_scale_x( spine_transform_constraint_data self, ) { @@ -45899,6 +46689,7 @@ class SpineDartBindings { _spine_transform_constraint_data_set_offset_scale_xPtr .asFunction(); + /// An offset added to the constrained bone scaleY. double spine_transform_constraint_data_get_offset_scale_y( spine_transform_constraint_data self, ) { @@ -45931,6 +46722,7 @@ class SpineDartBindings { _spine_transform_constraint_data_set_offset_scale_yPtr .asFunction(); + /// An offset added to the constrained bone shearY. double spine_transform_constraint_data_get_offset_shear_y( spine_transform_constraint_data self, ) { @@ -45963,6 +46755,7 @@ class SpineDartBindings { _spine_transform_constraint_data_set_offset_shear_yPtr .asFunction(); + /// Reads the source bone's local transform instead of its world transform. bool spine_transform_constraint_data_get_local_source( spine_transform_constraint_data self, ) { @@ -45993,6 +46786,8 @@ class SpineDartBindings { late final _spine_transform_constraint_data_set_local_source = _spine_transform_constraint_data_set_local_sourcePtr .asFunction(); + /// Sets the constrained bones' local transforms instead of their world + /// transforms. bool spine_transform_constraint_data_get_local_target( spine_transform_constraint_data self, ) { @@ -46023,6 +46818,8 @@ class SpineDartBindings { late final _spine_transform_constraint_data_set_local_target = _spine_transform_constraint_data_set_local_targetPtr .asFunction(); + /// Adds the source bone transform to the constrained bones instead of setting it + /// absolutely. bool spine_transform_constraint_data_get_additive( spine_transform_constraint_data self, ) { @@ -46053,6 +46850,8 @@ class SpineDartBindings { late final _spine_transform_constraint_data_set_additive = _spine_transform_constraint_data_set_additivePtr .asFunction(); + /// Prevents constrained bones from exceeding the ranged defined by offset and + /// max. bool spine_transform_constraint_data_get_clamp( spine_transform_constraint_data self, ) { @@ -46083,6 +46882,7 @@ class SpineDartBindings { late final _spine_transform_constraint_data_set_clamp = _spine_transform_constraint_data_set_clampPtr.asFunction(); + /// The mapping of transform properties to other transform properties. spine_array_from_property spine_transform_constraint_data_get_properties( spine_transform_constraint_data self, ) { @@ -46097,6 +46897,7 @@ class SpineDartBindings { late final _spine_transform_constraint_data_get_properties = _spine_transform_constraint_data_get_propertiesPtr .asFunction(); + /// Resolve ambiguity by forwarding to PosedData's implementation ffi.Pointer spine_transform_constraint_data_get_name( spine_transform_constraint_data self, ) { @@ -46203,6 +47004,8 @@ class SpineDartBindings { late final _spine_transform_constraint_pose_set = _spine_transform_constraint_pose_setPtr .asFunction(); + /// A percentage (0-1) that controls the mix between the constrained and + /// unconstrained rotation. double spine_transform_constraint_pose_get_mix_rotate( spine_transform_constraint_pose self, ) { @@ -46233,6 +47036,8 @@ class SpineDartBindings { late final _spine_transform_constraint_pose_set_mix_rotate = _spine_transform_constraint_pose_set_mix_rotatePtr .asFunction(); + /// A percentage (0-1) that controls the mix between the constrained and + /// unconstrained translation X. double spine_transform_constraint_pose_get_mix_x( spine_transform_constraint_pose self, ) { @@ -46263,6 +47068,8 @@ class SpineDartBindings { late final _spine_transform_constraint_pose_set_mix_x = _spine_transform_constraint_pose_set_mix_xPtr .asFunction(); + /// A percentage (0-1) that controls the mix between the constrained and + /// unconstrained translation Y. double spine_transform_constraint_pose_get_mix_y( spine_transform_constraint_pose self, ) { @@ -46293,6 +47100,8 @@ class SpineDartBindings { late final _spine_transform_constraint_pose_set_mix_y = _spine_transform_constraint_pose_set_mix_yPtr .asFunction(); + /// A percentage (0-1) that controls the mix between the constrained and + /// unconstrained scale X. double spine_transform_constraint_pose_get_mix_scale_x( spine_transform_constraint_pose self, ) { @@ -46323,6 +47132,8 @@ class SpineDartBindings { late final _spine_transform_constraint_pose_set_mix_scale_x = _spine_transform_constraint_pose_set_mix_scale_xPtr .asFunction(); + /// A percentage (0-1) that controls the mix between the constrained and + /// unconstrained scale Y. double spine_transform_constraint_pose_get_mix_scale_y( spine_transform_constraint_pose self, ) { @@ -46353,6 +47164,8 @@ class SpineDartBindings { late final _spine_transform_constraint_pose_set_mix_scale_y = _spine_transform_constraint_pose_set_mix_scale_yPtr .asFunction(); + /// A percentage (0-1) that controls the mix between the constrained and + /// unconstrained shear Y. double spine_transform_constraint_pose_get_mix_shear_y( spine_transform_constraint_pose self, ) { @@ -46469,6 +47282,11 @@ class SpineDartBindings { void Function(spine_transform_constraint_timeline, spine_skeleton, double, double, spine_array_event, double, int, int, bool)>(); + /// Sets the time, rotate mix, translate mix, scale mix, and shear mix for the + /// specified frame. + /// + /// @param frame Between 0 and frameCount, inclusive. + /// @param time The frame time in seconds. void spine_transform_constraint_timeline_set_frame( spine_transform_constraint_timeline self, int frame, @@ -47155,6 +47973,10 @@ class SpineDartBindings { late final _spine_translate_x_timeline_set_bone_index = _spine_translate_x_timeline_set_bone_indexPtr.asFunction(); + /// Sets the time and value for the specified frame. + /// + /// @param frame Between 0 and frameCount, inclusive. + /// @param time The frame time in seconds. void spine_translate_x_timeline_set_frame( spine_translate_x_timeline self, int frame, @@ -47175,6 +47997,7 @@ class SpineDartBindings { late final _spine_translate_x_timeline_set_frame = _spine_translate_x_timeline_set_framePtr .asFunction(); + /// Returns the interpolated value for the specified time. double spine_translate_x_timeline_get_curve_value( spine_translate_x_timeline self, double time, @@ -47586,6 +48409,10 @@ class SpineDartBindings { late final _spine_translate_y_timeline_set_bone_index = _spine_translate_y_timeline_set_bone_indexPtr.asFunction(); + /// Sets the time and value for the specified frame. + /// + /// @param frame Between 0 and frameCount, inclusive. + /// @param time The frame time in seconds. void spine_translate_y_timeline_set_frame( spine_translate_y_timeline self, int frame, @@ -47606,6 +48433,7 @@ class SpineDartBindings { late final _spine_translate_y_timeline_set_frame = _spine_translate_y_timeline_set_framePtr .asFunction(); + /// Returns the interpolated value for the specified time. double spine_translate_y_timeline_get_curve_value( spine_translate_y_timeline self, double time, @@ -47934,6 +48762,7 @@ class SpineDartBindings { _lookup>('spine_update_get_rtti'); late final _spine_update_get_rtti = _spine_update_get_rttiPtr.asFunction(); + /// @param physics Determines how physics and other non-deterministic updates are applied. void spine_update_update( spine_update self, spine_skeleton skeleton, @@ -47984,6 +48813,17 @@ class SpineDartBindings { late final _spine_vertex_attachment_get_rtti = _spine_vertex_attachment_get_rttiPtr.asFunction(); + /// Transforms the attachment's local vertices to world coordinates. If the + /// slot's SlotPose::getDeform() is not empty, it is used to deform the vertices. + /// + /// See https://esotericsoftware.com/spine-runtime-skeletons#World-transforms + /// World transforms in the Spine Runtimes Guide. + /// + /// @param start The index of the first vertices value to transform. Each vertex has 2 values, x and y. + /// @param count The number of world vertex values to output. Must be < = WorldVerticesLength - start. + /// @param worldVertices The output world vertices. Must have a length >= offset + count * stride / 2. + /// @param offset The worldVertices index to begin writing values. + /// @param stride The number of worldVertices entries between the value pairs written. void spine_vertex_attachment_compute_world_vertices_1( spine_vertex_attachment self, spine_skeleton skeleton, @@ -48045,6 +48885,7 @@ class SpineDartBindings { _spine_vertex_attachment_compute_world_vertices_2Ptr.asFunction< void Function(spine_vertex_attachment, spine_skeleton, spine_slot, int, int, spine_array_float, int, int)>(); + /// Gets a unique ID for this attachment. int spine_vertex_attachment_get_id( spine_vertex_attachment self, ) { diff --git a/spine-flutter/lib/generated/timeline.dart b/spine-flutter/lib/generated/timeline.dart index e7be3310e..f489a2d87 100644 --- a/spine-flutter/lib/generated/timeline.dart +++ b/spine-flutter/lib/generated/timeline.dart @@ -52,6 +52,16 @@ abstract class Timeline { return Rtti.fromPointer(result); } + /// Sets the value(s) for the specified time. + /// + /// [skeleton] The skeleton the timeline is being applied to. This provides access to the bones, slots, and other skeleton components the timeline may change. + /// [lastTime] lastTime The time this timeline was last applied. Timelines such as EventTimeline trigger only at specific times rather than every frame. In that case, the timeline triggers everything between lastTime (exclusive) and time (inclusive). + /// [time] The time within the animation. Most timelines find the key before and the key after this time so they can interpolate between the keys. + /// [events] If any events are fired, they are added to this array. Can be NULL to ignore firing events or if the timeline does not fire events. May be NULL. + /// [alpha] alpha 0 applies the current or setup pose value (depending on pose parameter). 1 applies the timeline value. Between 0 and 1 applies a value between the current or setup pose and the timeline value. By adjusting alpha over time, an animation can be mixed in or out. alpha can also be useful to apply animations on top of each other (layered). + /// [blend] Controls how mixing is applied when alpha is than 1. + /// [direction] Indicates whether the timeline is mixing in or out. Used by timelines which perform instant transitions such as DrawOrderTimeline and AttachmentTimeline. + /// [appliedPose] True to modify the applied pose. void apply(Skeleton skeleton, double lastTime, double time, ArrayEvent? events, double alpha, MixBlend blend, MixDirection direction, bool appliedPose) { SpineBindings.bindings.spine_timeline_apply(_ptr, skeleton.nativePtr.cast(), lastTime, time, diff --git a/spine-flutter/lib/generated/to_property.dart b/spine-flutter/lib/generated/to_property.dart index 80f5e6684..097802a5e 100644 --- a/spine-flutter/lib/generated/to_property.dart +++ b/spine-flutter/lib/generated/to_property.dart @@ -37,7 +37,7 @@ import 'bone_pose.dart'; import 'skeleton.dart'; import 'transform_constraint_pose.dart'; -/// ToProperty wrapper +/// Constrained property for a TransformConstraint. abstract class ToProperty { final Pointer _ptr; @@ -51,11 +51,13 @@ abstract class ToProperty { return Rtti.fromPointer(result); } + /// Reads the mix for this property from the specified pose. double mix(TransformConstraintPose pose) { final result = SpineBindings.bindings.spine_to_property_mix(_ptr, pose.nativePtr.cast()); return result; } + /// Applies the value to this property. void apply(Skeleton skeleton, TransformConstraintPose pose, BonePose bone, double value, bool local, bool additive) { SpineBindings.bindings.spine_to_property_apply( _ptr, skeleton.nativePtr.cast(), pose.nativePtr.cast(), bone.nativePtr.cast(), value, local, additive); diff --git a/spine-flutter/lib/generated/track_entry.dart b/spine-flutter/lib/generated/track_entry.dart index fef1a8000..866275fb0 100644 --- a/spine-flutter/lib/generated/track_entry.dart +++ b/spine-flutter/lib/generated/track_entry.dart @@ -36,7 +36,7 @@ import 'animation.dart'; import 'animation_state.dart'; import 'mix_blend.dart'; -/// TrackEntry wrapper +/// State for the playback of an animation class TrackEntry { final Pointer _ptr; @@ -54,16 +54,19 @@ class TrackEntry { SpineBindings.bindings.spine_track_entry_dispose(_ptr); } + /// The index of the track where this entry is either current or queued. int get trackIndex { final result = SpineBindings.bindings.spine_track_entry_get_track_index(_ptr); return result; } + /// The animation to apply for this track entry. Animation get animation { final result = SpineBindings.bindings.spine_track_entry_get_animation(_ptr); return Animation.fromPointer(result); } + /// Sets the animation for this track entry. set animation(Animation value) { SpineBindings.bindings.spine_track_entry_set_animation(_ptr, value.nativePtr.cast()); } @@ -73,6 +76,8 @@ class TrackEntry { return result.address == 0 ? null : TrackEntry.fromPointer(result); } + /// If true, the animation will repeat. If false, it will not, instead its + /// last frame is applied if played beyond its duration. bool get loop { final result = SpineBindings.bindings.spine_track_entry_get_loop(_ptr); return result; @@ -82,6 +87,20 @@ class TrackEntry { SpineBindings.bindings.spine_track_entry_set_loop(_ptr, value); } + /// If true, when mixing from the previous animation to this animation, the + /// previous animation is applied as normal instead of being mixed out. + /// + /// When mixing between animations that key the same property, if a lower + /// track also keys that property then the value will briefly dip toward the + /// lower track value during the mix. This happens because the first animation + /// mixes from 100% to 0% while the second animation mixes from 0% to 100%. + /// Setting holdPrevious to true applies the first animation at 100% during + /// the mix so the lower track value is overwritten. Such dipping does not + /// occur on the lowest track which keys the property, only when a higher + /// track also keys the property. + /// + /// Snapping will occur if holdPrevious is true and this animation does not + /// key all the same properties as the previous animation. bool get holdPrevious { final result = SpineBindings.bindings.spine_track_entry_get_hold_previous(_ptr); return result; @@ -109,6 +128,19 @@ class TrackEntry { SpineBindings.bindings.spine_track_entry_set_shortest_rotation(_ptr, value); } + /// Seconds to postpone playing the animation. Must be >= 0. When this track + /// entry is the current track entry, delay postpones incrementing the + /// getTrackTime(). When this track entry is queued, delay is the time from + /// the start of the previous animation to when this track entry will become + /// the current track entry (ie when the previous track entry getTrackTime() + /// >= this track entry's delay). + /// + /// getTimeScale() affects the delay. + /// + /// When passing delay < = 0 to AnimationState::addAnimation(int, Animation, + /// bool, float) this delay is set using a mix duration from + /// AnimationStateData. To change the getMixDuration() afterward, use + /// setMixDuration(float, float) so this delay is adjusted. double get delay { final result = SpineBindings.bindings.spine_track_entry_get_delay(_ptr); return result; @@ -118,6 +150,9 @@ class TrackEntry { SpineBindings.bindings.spine_track_entry_set_delay(_ptr, value); } + /// Current time in seconds this track entry has been the current track entry. + /// The track time determines getAnimationTime(). The track time can be set to + /// start the animation at a time other than 0, without affecting looping. double get trackTime { final result = SpineBindings.bindings.spine_track_entry_get_track_time(_ptr); return result; @@ -127,6 +162,16 @@ class TrackEntry { SpineBindings.bindings.spine_track_entry_set_track_time(_ptr, value); } + /// The track time in seconds when this animation will be removed from the + /// track. Defaults to the highest possible float value, meaning the animation + /// will be applied until a new animation is set or the track is cleared. If + /// the track end time is reached, no other animations are queued for + /// playback, and mixing from any previous animations is complete, then the + /// properties keyed by the animation are set to the setup pose and the track + /// is cleared. + /// + /// It may be desired to use AnimationState::addEmptyAnimation(int, float, + /// float) rather than have the animation abruptly cease being applied. double get trackEnd { final result = SpineBindings.bindings.spine_track_entry_get_track_end(_ptr); return result; @@ -136,6 +181,12 @@ class TrackEntry { SpineBindings.bindings.spine_track_entry_set_track_end(_ptr, value); } + /// Seconds when this animation starts, both initially and after looping. + /// Defaults to 0. + /// + /// When changing the animation start time, it often makes sense to set + /// TrackEntry.AnimationLast to the same value to prevent timeline keys before + /// the start time from triggering. double get animationStart { final result = SpineBindings.bindings.spine_track_entry_get_animation_start(_ptr); return result; @@ -145,6 +196,10 @@ class TrackEntry { SpineBindings.bindings.spine_track_entry_set_animation_start(_ptr, value); } + /// Seconds for the last frame of this animation. Non-looping animations won't + /// play past this time. Looping animations will loop back to + /// TrackEntry.AnimationStart at this time. Defaults to the animation + /// duration. double get animationEnd { final result = SpineBindings.bindings.spine_track_entry_get_animation_end(_ptr); return result; @@ -154,6 +209,11 @@ class TrackEntry { SpineBindings.bindings.spine_track_entry_set_animation_end(_ptr, value); } + /// The time in seconds this animation was last applied. Some timelines use + /// this for one-time triggers. Eg, when this animation is applied, event + /// timelines will fire all events between the animation last time (exclusive) + /// and animation time (inclusive). Defaults to -1 to ensure triggers on frame + /// 0 happen the first time this animation is applied. double get animationLast { final result = SpineBindings.bindings.spine_track_entry_get_animation_last(_ptr); return result; @@ -163,11 +223,33 @@ class TrackEntry { SpineBindings.bindings.spine_track_entry_set_animation_last(_ptr, value); } + /// Uses getTrackTime() to compute the animationTime. When the trackTime is 0, + /// the animationTime is equal to the animationStart time. + /// + /// The animationTime is between getAnimationStart() and getAnimationEnd(), + /// except if this track entry is non-looping and getAnimationEnd() is >= to + /// the animation duration, then animationTime continues to increase past + /// getAnimationEnd(). double get animationTime { final result = SpineBindings.bindings.spine_track_entry_get_animation_time(_ptr); return result; } + /// Multiplier for the delta time when this track entry is updated, causing + /// time for this animation to pass slower or faster. Defaults to 1. + /// + /// Values < 0 are not supported. To play an animation in reverse, use + /// getReverse(). + /// + /// getMixTime() is not affected by track entry time scale, so + /// getMixDuration() may need to be adjusted to match the animation speed. + /// + /// When using AnimationState::addAnimation(int, Animation, bool, float) with + /// a delay < = 0, the getDelay() is set using the mix duration from the + /// AnimationStateData, assuming time scale to be 1. If the time scale is not + /// 1, the delay may need to be adjusted. + /// + /// See AnimationState getTimeScale() for affecting all animations. double get timeScale { final result = SpineBindings.bindings.spine_track_entry_get_time_scale(_ptr); return result; @@ -177,6 +259,13 @@ class TrackEntry { SpineBindings.bindings.spine_track_entry_set_time_scale(_ptr, value); } + /// Values less than 1 mix this animation with the last skeleton pose. + /// Defaults to 1, which overwrites the last skeleton pose with this + /// animation. + /// + /// Typically track 0 is used to completely pose the skeleton, then alpha can + /// be used on higher tracks. It doesn't make sense to use alpha on track 0 if + /// the skeleton pose is from the last frame render. double get alpha { final result = SpineBindings.bindings.spine_track_entry_get_alpha(_ptr); return result; @@ -186,6 +275,10 @@ class TrackEntry { SpineBindings.bindings.spine_track_entry_set_alpha(_ptr, value); } + /// When the mix percentage (mix time / mix duration) is less than the event + /// threshold, event timelines for the animation being mixed out will be + /// applied. Defaults to 0, so event timelines are not applied for an + /// animation being mixed out. double get eventThreshold { final result = SpineBindings.bindings.spine_track_entry_get_event_threshold(_ptr); return result; @@ -195,6 +288,10 @@ class TrackEntry { SpineBindings.bindings.spine_track_entry_set_event_threshold(_ptr, value); } + /// When the mix percentage (mix time / mix duration) is less than the + /// attachment threshold, attachment timelines for the animation being mixed + /// out will be applied. Defaults to 0, so attachment timelines are not + /// applied for an animation being mixed out. double get mixAttachmentThreshold { final result = SpineBindings.bindings.spine_track_entry_get_mix_attachment_threshold(_ptr); return result; @@ -204,6 +301,9 @@ class TrackEntry { SpineBindings.bindings.spine_track_entry_set_mix_attachment_threshold(_ptr, value); } + /// When getAlpha() is greater than alphaAttachmentThreshold, attachment + /// timelines are applied. Defaults to 0, so attachment timelines are always + /// applied. double get alphaAttachmentThreshold { final result = SpineBindings.bindings.spine_track_entry_get_alpha_attachment_threshold(_ptr); return result; @@ -213,6 +313,10 @@ class TrackEntry { SpineBindings.bindings.spine_track_entry_set_alpha_attachment_threshold(_ptr, value); } + /// When the mix percentage (mix time / mix duration) is less than the draw + /// order threshold, draw order timelines for the animation being mixed out + /// will be applied. Defaults to 0, so draw order timelines are not applied + /// for an animation being mixed out. double get mixDrawOrderThreshold { final result = SpineBindings.bindings.spine_track_entry_get_mix_draw_order_threshold(_ptr); return result; @@ -222,16 +326,21 @@ class TrackEntry { SpineBindings.bindings.spine_track_entry_set_mix_draw_order_threshold(_ptr, value); } + /// The animation queued to start after this animation, or NULL. TrackEntry? get next { final result = SpineBindings.bindings.spine_track_entry_get_next(_ptr); return result.address == 0 ? null : TrackEntry.fromPointer(result); } + /// Returns true if at least one loop has been completed. bool get isComplete { final result = SpineBindings.bindings.spine_track_entry_is_complete(_ptr); return result; } + /// Seconds from 0 to the mix duration when mixing from the previous animation + /// to this animation. May be slightly more than TrackEntry.MixDuration when + /// the mix is complete. double get mixTime { final result = SpineBindings.bindings.spine_track_entry_get_mix_time(_ptr); return result; @@ -241,6 +350,17 @@ class TrackEntry { SpineBindings.bindings.spine_track_entry_set_mix_time(_ptr, value); } + /// Seconds for mixing from the previous animation to this animation. Defaults + /// to the value provided by AnimationStateData based on the animation before + /// this animation (if any). + /// + /// The mix duration can be set manually rather than use the value from + /// AnimationStateData.GetMix. In that case, the mixDuration must be set + /// before AnimationState.update(float) is next called. + /// + /// When using AnimationState::addAnimation(int, Animation, bool, float) with + /// a delay less than or equal to 0, note the Delay is set using the mix + /// duration from the AnimationStateData double get mixDuration { final result = SpineBindings.bindings.spine_track_entry_get_mix_duration(_ptr); return result; @@ -255,16 +375,33 @@ class TrackEntry { SpineBindings.bindings.spine_track_entry_set_mix_blend(_ptr, value.value); } + /// The track entry for the previous animation when mixing from the previous + /// animation to this animation, or NULL if no mixing is currently occuring. + /// When mixing from multiple animations, MixingFrom makes up a double linked + /// list with MixingTo. TrackEntry? get mixingFrom { final result = SpineBindings.bindings.spine_track_entry_get_mixing_from(_ptr); return result.address == 0 ? null : TrackEntry.fromPointer(result); } + /// The track entry for the next animation when mixing from this animation, or + /// NULL if no mixing is currently occuring. When mixing from multiple + /// animations, MixingTo makes up a double linked list with MixingFrom. TrackEntry? get mixingTo { final result = SpineBindings.bindings.spine_track_entry_get_mixing_to(_ptr); return result.address == 0 ? null : TrackEntry.fromPointer(result); } + /// Resets the rotation directions for mixing this entry's rotate timelines. + /// This can be useful to avoid bones rotating the long way around when using + /// alpha and starting animations on other tracks. + /// + /// Mixing involves finding a rotation between two others, which has two + /// possible solutions: the short way or the long way around. The two + /// rotations likely change over time, so which direction is the short or long + /// way also changes. If the short way was always chosen, bones would flip to + /// the other side when that direction became the long way. TrackEntry chooses + /// the short way the first time it is applied and remembers that direction. void resetRotationDirections() { SpineBindings.bindings.spine_track_entry_reset_rotation_directions(_ptr); } @@ -274,21 +411,29 @@ class TrackEntry { return result; } + /// Returns true if this entry is for the empty animation. bool get isEmptyAnimation { final result = SpineBindings.bindings.spine_track_entry_is_empty_animation(_ptr); return result; } + /// Returns true if this track entry has been applied at least once. + /// + /// See AnimationState::apply(Skeleton). bool get wasApplied { final result = SpineBindings.bindings.spine_track_entry_was_applied(_ptr); return result; } + /// Returns true if there is a getNext() track entry that is ready to become + /// the current track entry during the next AnimationState::update(float)} bool get isNextReady { final result = SpineBindings.bindings.spine_track_entry_is_next_ready(_ptr); return result; } + /// The AnimationState this track entry belongs to. May be NULL if TrackEntry + /// is directly instantiated. AnimationState? get animationState { final result = SpineBindings.bindings.spine_track_entry_get_animation_state(_ptr); return result.address == 0 ? null : AnimationState.fromPointer(result); @@ -308,6 +453,9 @@ class TrackEntry { SpineBindings.bindings.spine_track_entry_set_mix_duration_1(_ptr, value); } + /// Sets both getMixDuration() and getDelay(). + /// + /// [delay] If > 0, sets TrackEntry::getDelay(). If < = 0, the delay set is the duration of the previous track entry minus the specified mix duration plus the specified delay (ie the mix ends at (delay = 0) or before (delay < 0) the previous track entry duration). If the previous entry is looping, its next loop completion is used instead of its duration. void setMixDuration2(double mixDuration, double delay) { SpineBindings.bindings.spine_track_entry_set_mix_duration_2(_ptr, mixDuration, delay); } diff --git a/spine-flutter/lib/generated/transform_constraint.dart b/spine-flutter/lib/generated/transform_constraint.dart index f45d5dab4..016be770a 100644 --- a/spine-flutter/lib/generated/transform_constraint.dart +++ b/spine-flutter/lib/generated/transform_constraint.dart @@ -65,11 +65,13 @@ class TransformConstraint extends TransformConstraintBase { return TransformConstraint.fromPointer(result); } + /// The bones that will be modified by this transform constraint. ArrayBonePose get bones { final result = SpineBindings.bindings.spine_transform_constraint_get_bones(_ptr); return ArrayBonePose.fromPointer(result); } + /// The bone whose world transform will be copied to the constrained bones. Bone get source { final result = SpineBindings.bindings.spine_transform_constraint_get_source(_ptr); return Bone.fromPointer(result); diff --git a/spine-flutter/lib/generated/transform_constraint_base.dart b/spine-flutter/lib/generated/transform_constraint_base.dart index d4742641a..1f8328fd1 100644 --- a/spine-flutter/lib/generated/transform_constraint_base.dart +++ b/spine-flutter/lib/generated/transform_constraint_base.dart @@ -41,7 +41,7 @@ import 'skeleton.dart'; import 'transform_constraint_data.dart'; import 'transform_constraint_pose.dart'; -/// TransformConstraintBase wrapper +/// Non-exported base class that inherits from the template abstract class TransformConstraintBase extends PosedActive implements Posed, Constraint { final Pointer _ptr; @@ -101,6 +101,7 @@ abstract class TransformConstraintBase extends PosedActive implements Posed, Con return result; } + /// Inherited from Update @override void update(Skeleton skeleton, Physics physics) { SpineBindings.bindings.spine_transform_constraint_base_update(_ptr, skeleton.nativePtr.cast(), physics.value); diff --git a/spine-flutter/lib/generated/transform_constraint_data.dart b/spine-flutter/lib/generated/transform_constraint_data.dart index 541d39f75..c14a3b3e1 100644 --- a/spine-flutter/lib/generated/transform_constraint_data.dart +++ b/spine-flutter/lib/generated/transform_constraint_data.dart @@ -47,7 +47,10 @@ import 'slider.dart'; import 'transform_constraint.dart'; import 'transform_constraint_pose.dart'; -/// TransformConstraintData wrapper +/// Stores the setup pose for a TransformConstraint. +/// +/// See https://esotericsoftware.com/spine-transform-constraints Transform +/// constraints in the Spine User Guide. class TransformConstraintData extends PosedData implements ConstraintData { final Pointer _ptr; @@ -101,11 +104,13 @@ class TransformConstraintData extends PosedData implements ConstraintData { } } + /// The bones that will be modified by this transform constraint. ArrayBoneData get bones { final result = SpineBindings.bindings.spine_transform_constraint_data_get_bones(_ptr); return ArrayBoneData.fromPointer(result); } + /// The bone whose world transform will be copied to the constrained bones. BoneData get source { final result = SpineBindings.bindings.spine_transform_constraint_data_get_source(_ptr); return BoneData.fromPointer(result); @@ -115,6 +120,7 @@ class TransformConstraintData extends PosedData implements ConstraintData { SpineBindings.bindings.spine_transform_constraint_data_set_source(_ptr, value.nativePtr.cast()); } + /// An offset added to the constrained bone rotation. double get offsetRotation { final result = SpineBindings.bindings.spine_transform_constraint_data_get_offset_rotation(_ptr); return result; @@ -124,6 +130,7 @@ class TransformConstraintData extends PosedData implements ConstraintData { SpineBindings.bindings.spine_transform_constraint_data_set_offset_rotation(_ptr, value); } + /// An offset added to the constrained bone X translation. double get offsetX { final result = SpineBindings.bindings.spine_transform_constraint_data_get_offset_x(_ptr); return result; @@ -133,6 +140,7 @@ class TransformConstraintData extends PosedData implements ConstraintData { SpineBindings.bindings.spine_transform_constraint_data_set_offset_x(_ptr, value); } + /// An offset added to the constrained bone Y translation. double get offsetY { final result = SpineBindings.bindings.spine_transform_constraint_data_get_offset_y(_ptr); return result; @@ -142,6 +150,7 @@ class TransformConstraintData extends PosedData implements ConstraintData { SpineBindings.bindings.spine_transform_constraint_data_set_offset_y(_ptr, value); } + /// An offset added to the constrained bone scaleX. double get offsetScaleX { final result = SpineBindings.bindings.spine_transform_constraint_data_get_offset_scale_x(_ptr); return result; @@ -151,6 +160,7 @@ class TransformConstraintData extends PosedData implements ConstraintData { SpineBindings.bindings.spine_transform_constraint_data_set_offset_scale_x(_ptr, value); } + /// An offset added to the constrained bone scaleY. double get offsetScaleY { final result = SpineBindings.bindings.spine_transform_constraint_data_get_offset_scale_y(_ptr); return result; @@ -160,6 +170,7 @@ class TransformConstraintData extends PosedData implements ConstraintData { SpineBindings.bindings.spine_transform_constraint_data_set_offset_scale_y(_ptr, value); } + /// An offset added to the constrained bone shearY. double get offsetShearY { final result = SpineBindings.bindings.spine_transform_constraint_data_get_offset_shear_y(_ptr); return result; @@ -169,6 +180,7 @@ class TransformConstraintData extends PosedData implements ConstraintData { SpineBindings.bindings.spine_transform_constraint_data_set_offset_shear_y(_ptr, value); } + /// Reads the source bone's local transform instead of its world transform. bool get localSource { final result = SpineBindings.bindings.spine_transform_constraint_data_get_local_source(_ptr); return result; @@ -178,6 +190,8 @@ class TransformConstraintData extends PosedData implements ConstraintData { SpineBindings.bindings.spine_transform_constraint_data_set_local_source(_ptr, value); } + /// Sets the constrained bones' local transforms instead of their world + /// transforms. bool get localTarget { final result = SpineBindings.bindings.spine_transform_constraint_data_get_local_target(_ptr); return result; @@ -187,6 +201,8 @@ class TransformConstraintData extends PosedData implements ConstraintData { SpineBindings.bindings.spine_transform_constraint_data_set_local_target(_ptr, value); } + /// Adds the source bone transform to the constrained bones instead of setting + /// it absolutely. bool get additive { final result = SpineBindings.bindings.spine_transform_constraint_data_get_additive(_ptr); return result; @@ -196,6 +212,8 @@ class TransformConstraintData extends PosedData implements ConstraintData { SpineBindings.bindings.spine_transform_constraint_data_set_additive(_ptr, value); } + /// Prevents constrained bones from exceeding the ranged defined by offset and + /// max. bool get clamp { final result = SpineBindings.bindings.spine_transform_constraint_data_get_clamp(_ptr); return result; @@ -205,6 +223,7 @@ class TransformConstraintData extends PosedData implements ConstraintData { SpineBindings.bindings.spine_transform_constraint_data_set_clamp(_ptr, value); } + /// The mapping of transform properties to other transform properties. ArrayFromProperty get properties { final result = SpineBindings.bindings.spine_transform_constraint_data_get_properties(_ptr); return ArrayFromProperty.fromPointer(result); diff --git a/spine-flutter/lib/generated/transform_constraint_pose.dart b/spine-flutter/lib/generated/transform_constraint_pose.dart index f936d3ae3..28768b6ea 100644 --- a/spine-flutter/lib/generated/transform_constraint_pose.dart +++ b/spine-flutter/lib/generated/transform_constraint_pose.dart @@ -33,7 +33,7 @@ import 'package:universal_ffi/ffi.dart'; import 'spine_dart_bindings_generated.dart'; import '../spine_bindings.dart'; -/// TransformConstraintPose wrapper +/// Stores a pose for a transform constraint. class TransformConstraintPose { final Pointer _ptr; @@ -55,6 +55,8 @@ class TransformConstraintPose { SpineBindings.bindings.spine_transform_constraint_pose_set(_ptr, pose.nativePtr.cast()); } + /// A percentage (0-1) that controls the mix between the constrained and + /// unconstrained rotation. double get mixRotate { final result = SpineBindings.bindings.spine_transform_constraint_pose_get_mix_rotate(_ptr); return result; @@ -64,6 +66,8 @@ class TransformConstraintPose { SpineBindings.bindings.spine_transform_constraint_pose_set_mix_rotate(_ptr, value); } + /// A percentage (0-1) that controls the mix between the constrained and + /// unconstrained translation X. double get mixX { final result = SpineBindings.bindings.spine_transform_constraint_pose_get_mix_x(_ptr); return result; @@ -73,6 +77,8 @@ class TransformConstraintPose { SpineBindings.bindings.spine_transform_constraint_pose_set_mix_x(_ptr, value); } + /// A percentage (0-1) that controls the mix between the constrained and + /// unconstrained translation Y. double get mixY { final result = SpineBindings.bindings.spine_transform_constraint_pose_get_mix_y(_ptr); return result; @@ -82,6 +88,8 @@ class TransformConstraintPose { SpineBindings.bindings.spine_transform_constraint_pose_set_mix_y(_ptr, value); } + /// A percentage (0-1) that controls the mix between the constrained and + /// unconstrained scale X. double get mixScaleX { final result = SpineBindings.bindings.spine_transform_constraint_pose_get_mix_scale_x(_ptr); return result; @@ -91,6 +99,8 @@ class TransformConstraintPose { SpineBindings.bindings.spine_transform_constraint_pose_set_mix_scale_x(_ptr, value); } + /// A percentage (0-1) that controls the mix between the constrained and + /// unconstrained scale Y. double get mixScaleY { final result = SpineBindings.bindings.spine_transform_constraint_pose_get_mix_scale_y(_ptr); return result; @@ -100,6 +110,8 @@ class TransformConstraintPose { SpineBindings.bindings.spine_transform_constraint_pose_set_mix_scale_y(_ptr, value); } + /// A percentage (0-1) that controls the mix between the constrained and + /// unconstrained shear Y. double get mixShearY { final result = SpineBindings.bindings.spine_transform_constraint_pose_get_mix_shear_y(_ptr); return result; diff --git a/spine-flutter/lib/generated/transform_constraint_timeline.dart b/spine-flutter/lib/generated/transform_constraint_timeline.dart index 07d15cc81..909924fe9 100644 --- a/spine-flutter/lib/generated/transform_constraint_timeline.dart +++ b/spine-flutter/lib/generated/transform_constraint_timeline.dart @@ -35,7 +35,11 @@ import '../spine_bindings.dart'; import 'constraint_timeline.dart'; import 'curve_timeline.dart'; -/// TransformConstraintTimeline wrapper +/// Changes a transform constraint's TransformConstraintPose::getMixRotate(), +/// TransformConstraintPose::getMixX(), TransformConstraintPose::getMixY(), +/// TransformConstraintPose::getMixScaleX(), +/// TransformConstraintPose::getMixScaleY(), and +/// TransformConstraintPose::getMixShearY(). class TransformConstraintTimeline extends CurveTimeline implements ConstraintTimeline { final Pointer _ptr; @@ -56,6 +60,11 @@ class TransformConstraintTimeline extends CurveTimeline implements ConstraintTim SpineBindings.bindings.spine_transform_constraint_timeline_dispose(_ptr); } + /// Sets the time, rotate mix, translate mix, scale mix, and shear mix for the + /// specified frame. + /// + /// [frame] Between 0 and frameCount, inclusive. + /// [time] The frame time in seconds. void setFrame(int frame, double time, double mixRotate, double mixX, double mixY, double mixScaleX, double mixScaleY, double mixShearY) { SpineBindings.bindings.spine_transform_constraint_timeline_set_frame( diff --git a/spine-flutter/lib/generated/translate_timeline.dart b/spine-flutter/lib/generated/translate_timeline.dart index 6c1d19303..1ffc9158f 100644 --- a/spine-flutter/lib/generated/translate_timeline.dart +++ b/spine-flutter/lib/generated/translate_timeline.dart @@ -34,7 +34,7 @@ import 'spine_dart_bindings_generated.dart'; import '../spine_bindings.dart'; import 'bone_timeline2.dart'; -/// TranslateTimeline wrapper +/// Changes a bone's local X and Y translation. class TranslateTimeline extends BoneTimeline2 { final Pointer _ptr; diff --git a/spine-flutter/lib/generated/translate_x_timeline.dart b/spine-flutter/lib/generated/translate_x_timeline.dart index a24ca81e8..1c8d611ce 100644 --- a/spine-flutter/lib/generated/translate_x_timeline.dart +++ b/spine-flutter/lib/generated/translate_x_timeline.dart @@ -34,7 +34,7 @@ import 'spine_dart_bindings_generated.dart'; import '../spine_bindings.dart'; import 'bone_timeline1.dart'; -/// TranslateXTimeline wrapper +/// Changes a bone's local X translation. class TranslateXTimeline extends BoneTimeline1 { final Pointer _ptr; diff --git a/spine-flutter/lib/generated/translate_y_timeline.dart b/spine-flutter/lib/generated/translate_y_timeline.dart index 6b0316bfe..6f3e65295 100644 --- a/spine-flutter/lib/generated/translate_y_timeline.dart +++ b/spine-flutter/lib/generated/translate_y_timeline.dart @@ -34,7 +34,7 @@ import 'spine_dart_bindings_generated.dart'; import '../spine_bindings.dart'; import 'bone_timeline1.dart'; -/// TranslateYTimeline wrapper +/// Changes a bone's local Y translation. class TranslateYTimeline extends BoneTimeline1 { final Pointer _ptr; diff --git a/spine-flutter/lib/generated/update.dart b/spine-flutter/lib/generated/update.dart index f8bdba181..f984fe5c6 100644 --- a/spine-flutter/lib/generated/update.dart +++ b/spine-flutter/lib/generated/update.dart @@ -35,7 +35,7 @@ import 'rtti.dart'; import 'physics.dart'; import 'skeleton.dart'; -/// Update wrapper +/// The interface for items updated by Skeleton::updateWorldTransform(). abstract class Update { Pointer get nativePtr; Rtti get rtti; diff --git a/spine-flutter/lib/generated/vertex_attachment.dart b/spine-flutter/lib/generated/vertex_attachment.dart index 0afe22e6f..bddbd6da6 100644 --- a/spine-flutter/lib/generated/vertex_attachment.dart +++ b/spine-flutter/lib/generated/vertex_attachment.dart @@ -44,7 +44,8 @@ import 'region_attachment.dart'; import 'skeleton.dart'; import 'slot.dart'; -/// VertexAttachment wrapper +/// An attachment with vertices that are transformed by one or more bones and +/// can be deformed by a slot's SlotPose::getDeform(). abstract class VertexAttachment extends Attachment { final Pointer _ptr; @@ -55,6 +56,7 @@ abstract class VertexAttachment extends Attachment { @override Pointer get nativePtr => _ptr; + /// Gets a unique ID for this attachment. int get id { final result = SpineBindings.bindings.spine_vertex_attachment_get_id(_ptr); return result; diff --git a/spine-ios/Sources/SpineSwift/Generated/Animation.swift b/spine-ios/Sources/SpineSwift/Generated/Animation.swift index 01f4270d2..7c822dc15 100644 --- a/spine-ios/Sources/SpineSwift/Generated/Animation.swift +++ b/spine-ios/Sources/SpineSwift/Generated/Animation.swift @@ -32,7 +32,7 @@ import Foundation import SpineC -/// Animation wrapper +/// Stores a list of timelines to animate a skeleton's pose over time. @objc(SpineAnimation) @objcMembers public class Animation: NSObject { @@ -48,6 +48,8 @@ public class Animation: NSObject { self.init(fromPointer: ptr!) } + /// If the returned array or the timelines it contains are modified, setTimelines() must be + /// called. public var timelines: ArrayTimeline { get { let result = spine_animation_get_timelines(_ptr.assumingMemoryBound(to: spine_animation_wrapper.self)) @@ -58,6 +60,9 @@ public class Animation: NSObject { } } + /// The duration of the animation in seconds, which is usually the highest time of all frames in + /// the timeline. The duration is used to know when it has completed and when it should loop + /// back to the start. public var duration: Float { get { let result = spine_animation_get_duration(_ptr.assumingMemoryBound(to: spine_animation_wrapper.self)) @@ -68,25 +73,41 @@ public class Animation: NSObject { } } + /// The animation's name, which is unique across all animations in the skeleton. public var name: String { let result = spine_animation_get_name(_ptr.assumingMemoryBound(to: spine_animation_wrapper.self)) return String(cString: result!) } + /// The bone indices affected by this animation. public var bones: ArrayInt { let result = spine_animation_get_bones(_ptr.assumingMemoryBound(to: spine_animation_wrapper.self)) return ArrayInt(fromPointer: result!) } + /// Returns true if this animation contains a timeline with any of the specified property IDs. public func hasTimeline(_ ids: ArrayPropertyId) -> Bool { let result = spine_animation_has_timeline(_ptr.assumingMemoryBound(to: spine_animation_wrapper.self), ids._ptr.assumingMemoryBound(to: spine_array_property_id_wrapper.self)) return result } + /// Applies the animation's timelines to the specified skeleton. + /// + /// See Timeline::apply(). + /// + /// - Parameter skeleton: The skeleton the animation is being applied to. This provides access to the bones, slots, and other skeleton components the timelines may change. + /// - Parameter lastTime: The last time in seconds this animation was applied. Some timelines trigger only at specific times rather than every frame. Pass -1 the first time an animation is applied to ensure frame 0 is triggered. + /// - Parameter time: The time in seconds the skeleton is being posed for. Most timelines find the frame before and the frame after this time and interpolate between the frame values. If beyond the getDuration() and loop is true then the animation will repeat, else the last frame will be applied. + /// - Parameter loop: If true, the animation repeats after the getDuration(). + /// - Parameter events: If any events are fired, they are added to this list. Can be null to ignore fired events or if no timelines fire events. + /// - Parameter alpha: 0 applies the current or setup values (depending on blend). 1 applies the timeline values. Between 0 and 1 applies values between the current or setup values and the timeline values. By adjusting alpha over time, an animation can be mixed in or out. alpha can also be useful to apply animations on top of each other (layering). + /// - Parameter blend: Controls how mixing is applied when alpha < 1. + /// - Parameter direction: Indicates whether the timelines are mixing in or out. Used by timelines which perform instant transitions, such as DrawOrderTimeline or AttachmentTimeline. public func apply(_ skeleton: Skeleton, _ lastTime: Float, _ time: Float, _ loop: Bool, _ events: ArrayEvent?, _ alpha: Float, _ blend: MixBlend, _ direction: MixDirection, _ appliedPose: Bool) { spine_animation_apply(_ptr.assumingMemoryBound(to: spine_animation_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self), lastTime, time, loop, events?._ptr.assumingMemoryBound(to: spine_array_event_wrapper.self), alpha, spine_mix_blend(rawValue: UInt32(blend.rawValue)), spine_mix_direction(rawValue: UInt32(direction.rawValue)), appliedPose) } + /// - Parameter target: After the first and before the last entry. public static func search(_ values: ArrayFloat, _ target: Float) -> Int32 { let result = spine_animation_search_1(values._ptr.assumingMemoryBound(to: spine_array_float_wrapper.self), target) return result diff --git a/spine-ios/Sources/SpineSwift/Generated/Atlas.swift b/spine-ios/Sources/SpineSwift/Generated/Atlas.swift index 57d113f98..7e42d1dfc 100644 --- a/spine-ios/Sources/SpineSwift/Generated/Atlas.swift +++ b/spine-ios/Sources/SpineSwift/Generated/Atlas.swift @@ -57,6 +57,11 @@ public class Atlas: NSObject { spine_atlas_flip_v(_ptr.assumingMemoryBound(to: spine_atlas_wrapper.self)) } + /// Returns the first region found with the specified name. This method uses String comparison + /// to find the region, so the result should be cached rather than calling this method multiple + /// times. + /// + /// - Returns: The region, or nullptr. public func findRegion(_ name: String) -> AtlasRegion? { let result = spine_atlas_find_region(_ptr.assumingMemoryBound(to: spine_atlas_wrapper.self), name) return result.map { AtlasRegion(fromPointer: $0) } diff --git a/spine-ios/Sources/SpineSwift/Generated/Bone.swift b/spine-ios/Sources/SpineSwift/Generated/Bone.swift index e979b6c8d..dcb493026 100644 --- a/spine-ios/Sources/SpineSwift/Generated/Bone.swift +++ b/spine-ios/Sources/SpineSwift/Generated/Bone.swift @@ -32,7 +32,12 @@ import Foundation import SpineC -/// Bone wrapper +/// The current pose for a bone, before constraints are applied. +/// +/// A bone has a local transform which is used to compute its world transform. A bone also has an +/// applied transform, which is a local transform that can be applied to compute the world +/// transform. The local transform and applied transform may differ if a constraint or application +/// code modifies the world transform after it was computed from the local transform. @objc(SpineBone) @objcMembers public class Bone: PosedActive, Posed, Update { @@ -41,11 +46,13 @@ public class Bone: PosedActive, Posed, Update { super.init(fromPointer: UnsafeMutableRawPointer(ptr).assumingMemoryBound(to: spine_posed_active_wrapper.self)) } + /// - Parameter parent: May be NULL. public convenience init(_ data: BoneData, _ parent: Bone?) { let ptr = spine_bone_create(data._ptr.assumingMemoryBound(to: spine_bone_data_wrapper.self), parent?._ptr.assumingMemoryBound(to: spine_bone_wrapper.self)) self.init(fromPointer: ptr!) } + /// Copy constructor. Does not copy the children bones. public static func from(_ bone: Bone, _ parent: Bone?) -> Bone { let ptr = spine_bone_create2(bone._ptr.assumingMemoryBound(to: spine_bone_wrapper.self), parent?._ptr.assumingMemoryBound(to: spine_bone_wrapper.self)) return Bone(fromPointer: ptr!) @@ -56,16 +63,19 @@ public class Bone: PosedActive, Posed, Update { return Rtti(fromPointer: result!) } + /// The parent bone, or null if this is the root bone. public var parent: Bone? { let result = spine_bone_get_parent(_ptr.assumingMemoryBound(to: spine_bone_wrapper.self)) return result.map { Bone(fromPointer: $0) } } + /// The immediate children of this bone. public var children: ArrayBone { let result = spine_bone_get_children(_ptr.assumingMemoryBound(to: spine_bone_wrapper.self)) return ArrayBone(fromPointer: result!) } + /// The constraint's setup pose data. public var data: BoneData { let result = spine_bone_get_data(_ptr.assumingMemoryBound(to: spine_bone_wrapper.self)) return BoneData(fromPointer: result!) diff --git a/spine-ios/Sources/SpineSwift/Generated/Color.swift b/spine-ios/Sources/SpineSwift/Generated/Color.swift index defad1351..1c19e0b73 100644 --- a/spine-ios/Sources/SpineSwift/Generated/Color.swift +++ b/spine-ios/Sources/SpineSwift/Generated/Color.swift @@ -103,10 +103,12 @@ public class Color: NSObject { return result } + /// Convert packed RGBA8888 integer to Color public func rgba8888ToColor(_ value: Int32) { spine_color_rgba8888_to_color(_ptr.assumingMemoryBound(to: spine_color_wrapper.self), value) } + /// Convert packed RGB888 integer to Color (no alpha) public func rgb888ToColor(_ value: Int32) { spine_color_rgb888_to_color(_ptr.assumingMemoryBound(to: spine_color_wrapper.self), value) } diff --git a/spine-ios/Sources/SpineSwift/Generated/Event.swift b/spine-ios/Sources/SpineSwift/Generated/Event.swift index ed57cee51..ca5825f3c 100644 --- a/spine-ios/Sources/SpineSwift/Generated/Event.swift +++ b/spine-ios/Sources/SpineSwift/Generated/Event.swift @@ -32,7 +32,12 @@ import Foundation import SpineC -/// Event wrapper +/// Stores the current pose values for an Event. +/// +/// See Timeline::apply(), AnimationStateListener::event(), and +/// +/// - SeeAlso: +/// - https://esotericsoftware.com/spine-events Events in the Spine User Guide. @objc(SpineEvent) @objcMembers public class Event: NSObject { @@ -48,11 +53,13 @@ public class Event: NSObject { self.init(fromPointer: ptr!) } + /// The event's setup pose data. public var data: EventData { let result = spine_event_get_data(_ptr.assumingMemoryBound(to: spine_event_wrapper.self)) return EventData(fromPointer: result!) } + /// The animation time this event was keyed. public var time: Float { let result = spine_event_get_time(_ptr.assumingMemoryBound(to: spine_event_wrapper.self)) return result diff --git a/spine-ios/Sources/SpineSwift/Generated/Sequence.swift b/spine-ios/Sources/SpineSwift/Generated/Sequence.swift index a402bae8f..1502f29ab 100644 --- a/spine-ios/Sources/SpineSwift/Generated/Sequence.swift +++ b/spine-ios/Sources/SpineSwift/Generated/Sequence.swift @@ -48,6 +48,7 @@ public class Sequence: NSObject { self.init(fromPointer: ptr!) } + /// Returns a unique ID for this attachment. public var id: Int32 { get { let result = spine_sequence_get_id(_ptr.assumingMemoryBound(to: spine_sequence_wrapper.self)) @@ -78,6 +79,7 @@ public class Sequence: NSObject { } } + /// The index of the region to show for the setup pose. public var setupIndex: Int32 { get { let result = spine_sequence_get_setup_index(_ptr.assumingMemoryBound(to: spine_sequence_wrapper.self)) diff --git a/spine-ios/Sources/SpineSwift/Generated/Skeleton.swift b/spine-ios/Sources/SpineSwift/Generated/Skeleton.swift index f2415d3c2..c957d48d9 100644 --- a/spine-ios/Sources/SpineSwift/Generated/Skeleton.swift +++ b/spine-ios/Sources/SpineSwift/Generated/Skeleton.swift @@ -195,6 +195,8 @@ public class Skeleton: NSObject { } } + /// Caches information about bones and constraints. Must be called if bones, constraints or + /// weighted path attachments are added or removed. public func updateCache() { spine_skeleton_update_cache(_ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self)) } @@ -215,14 +217,20 @@ public class Skeleton: NSObject { spine_skeleton_sort_reset(bones._ptr.assumingMemoryBound(to: spine_array_bone_wrapper.self)) } + /// Updates the world transform for each bone and applies all constraints. + /// + /// See [World transforms](http://esotericsoftware.com/spine-runtime-skeletons#World-transforms) + /// in the Spine Runtimes Guide. public func updateWorldTransform(_ physics: Physics) { spine_skeleton_update_world_transform(_ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self), spine_physics(rawValue: UInt32(physics.rawValue))) } + /// Sets the bones, constraints, and slots to their setup pose values. public func setupPose() { spine_skeleton_setup_pose(_ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self)) } + /// Sets the bones and constraints to their setup pose values. public func setupPoseBones() { spine_skeleton_setup_pose_bones(_ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self)) } @@ -231,16 +239,19 @@ public class Skeleton: NSObject { spine_skeleton_setup_pose_slots(_ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self)) } + /// - Returns: May be NULL. public func findBone(_ boneName: String) -> Bone? { let result = spine_skeleton_find_bone(_ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self), boneName) return result.map { Bone(fromPointer: $0) } } + /// - Returns: May be NULL. public func findSlot(_ slotName: String) -> Slot? { let result = spine_skeleton_find_slot(_ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self), slotName) return result.map { Slot(fromPointer: $0) } } + /// - Parameter attachmentName: May be empty. public func setAttachment(_ slotName: String, _ attachmentName: String) { spine_skeleton_set_attachment(_ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self), slotName, attachmentName) } @@ -253,10 +264,12 @@ public class Skeleton: NSObject { spine_skeleton_set_position(_ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self), x, y) } + /// Rotates the physics constraint so next { public func physicsTranslate(_ x: Float, _ y: Float) { spine_skeleton_physics_translate(_ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self), x, y) } + /// Calls { public func physicsRotate(_ x: Float, _ y: Float, _ degrees: Float) { spine_skeleton_physics_rotate(_ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self), x, y, degrees) } @@ -265,14 +278,25 @@ public class Skeleton: NSObject { spine_skeleton_update(_ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self), delta) } + /// Sets a skin by name (see setSkin). public func setSkin(_ skinName: String) { spine_skeleton_set_skin_1(_ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self), skinName) } + /// Attachments from the new skin are attached if the corresponding attachment from the old skin + /// was attached. If there was no old skin, each slot's setup mode attachment is attached from + /// the new skin. After changing the skin, the visible attachments can be reset to those + /// attached in the setup pose by calling See Skeleton::setSlotsToSetupPose() Also, often + /// AnimationState::apply(Skeleton & ) is called before the next time the skeleton is rendered + /// to allow any attachment keys in the current animation(s) to hide or show attachments from + /// the new skin. + /// + /// - Parameter newSkin: May be NULL. public func setSkin2(_ newSkin: Skin?) { spine_skeleton_set_skin_2(_ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self), newSkin?._ptr.assumingMemoryBound(to: spine_skin_wrapper.self)) } + /// - Returns: May be NULL. public func getAttachment(_ slotName: String, _ attachmentName: String) -> Attachment? { let result = spine_skeleton_get_attachment_1(_ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self), slotName, attachmentName) guard let ptr = result else { return nil } @@ -302,6 +326,7 @@ public class Skeleton: NSObject { } } + /// - Returns: May be NULL. public func getAttachment2(_ slotIndex: Int32, _ attachmentName: String) -> Attachment? { let result = spine_skeleton_get_attachment_2(_ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self), slotIndex, attachmentName) guard let ptr = result else { return nil } diff --git a/spine-ios/Sources/SpineSwift/Generated/Skin.swift b/spine-ios/Sources/SpineSwift/Generated/Skin.swift index 5a3ddb08d..693a51738 100644 --- a/spine-ios/Sources/SpineSwift/Generated/Skin.swift +++ b/spine-ios/Sources/SpineSwift/Generated/Skin.swift @@ -32,7 +32,9 @@ import Foundation import SpineC -/// Skin wrapper +/// Stores attachments by slot index and attachment name. See SkeletonData::getDefaultSkin, +/// Skeleton::getSkin, and http://esotericsoftware.com/spine-runtime-skins in the Spine Runtimes +/// Guide. @objc(SpineSkin) @objcMembers public class Skin: NSObject { @@ -68,10 +70,13 @@ public class Skin: NSObject { return Color(fromPointer: result!) } + /// Adds an attachment to the skin for the specified slot index and name. If the name already + /// exists for the slot, the previous value is replaced. public func setAttachment(_ slotIndex: Int, _ name: String, _ attachment: Attachment) { spine_skin_set_attachment(_ptr.assumingMemoryBound(to: spine_skin_wrapper.self), slotIndex, name, attachment._ptr.assumingMemoryBound(to: spine_attachment_wrapper.self)) } + /// Returns the attachment for the specified slot index and name, or NULL. public func getAttachment(_ slotIndex: Int, _ name: String) -> Attachment? { let result = spine_skin_get_attachment(_ptr.assumingMemoryBound(to: spine_skin_wrapper.self), slotIndex, name) guard let ptr = result else { return nil } @@ -101,18 +106,27 @@ public class Skin: NSObject { } } + /// Removes the attachment from the skin. public func removeAttachment(_ slotIndex: Int, _ name: String) { spine_skin_remove_attachment(_ptr.assumingMemoryBound(to: spine_skin_wrapper.self), slotIndex, name) } + /// Finds the attachments for a given slot. The results are added to the passed array of + /// Attachments. + /// + /// - Parameter slotIndex: The target slotIndex. To find the slot index, use SkeletonData::findSlot and SlotData::getIndex. + /// - Parameter attachments: Found Attachments will be added to this array. public func findAttachmentsForSlot(_ slotIndex: Int, _ attachments: ArrayAttachment) { spine_skin_find_attachments_for_slot(_ptr.assumingMemoryBound(to: spine_skin_wrapper.self), slotIndex, attachments._ptr.assumingMemoryBound(to: spine_array_attachment_wrapper.self)) } + /// Adds all attachments, bones, and constraints from the specified skin to this skin. public func addSkin(_ other: Skin) { spine_skin_add_skin(_ptr.assumingMemoryBound(to: spine_skin_wrapper.self), other._ptr.assumingMemoryBound(to: spine_skin_wrapper.self)) } + /// Adds all attachments, bones, and constraints from the specified skin to this skin. + /// Attachments are deep copied. public func copySkin(_ other: Skin) { spine_skin_copy_skin(_ptr.assumingMemoryBound(to: spine_skin_wrapper.self), other._ptr.assumingMemoryBound(to: spine_skin_wrapper.self)) } diff --git a/spine-ios/Sources/SpineSwift/Generated/Slot.swift b/spine-ios/Sources/SpineSwift/Generated/Slot.swift index 7abb41495..9a8bdccad 100644 --- a/spine-ios/Sources/SpineSwift/Generated/Slot.swift +++ b/spine-ios/Sources/SpineSwift/Generated/Slot.swift @@ -32,7 +32,9 @@ import Foundation import SpineC -/// Slot wrapper +/// Stores a slot's current pose. Slots organize attachments for Skeleton drawOrder purposes and +/// provide a place to store state for an attachment. State cannot be stored in an attachment itself +/// because attachments are stateless and may be shared across multiple skeletons. @objc(SpineSlot) @objcMembers public class Slot: NSObject, Posed { @@ -48,11 +50,13 @@ public class Slot: NSObject, Posed { self.init(fromPointer: ptr!) } + /// The bone this slot belongs to. public var bone: Bone { let result = spine_slot_get_bone(_ptr.assumingMemoryBound(to: spine_slot_wrapper.self)) return Bone(fromPointer: result!) } + /// The constraint's setup pose data. public var data: SlotData { let result = spine_slot_get_data(_ptr.assumingMemoryBound(to: spine_slot_wrapper.self)) return SlotData(fromPointer: result!) diff --git a/spine-ios/Sources/SpineSwift/Generated/Timeline.swift b/spine-ios/Sources/SpineSwift/Generated/Timeline.swift index 8671126ea..30ef89927 100644 --- a/spine-ios/Sources/SpineSwift/Generated/Timeline.swift +++ b/spine-ios/Sources/SpineSwift/Generated/Timeline.swift @@ -73,6 +73,16 @@ open class Timeline: NSObject { return ArrayPropertyId(fromPointer: result!) } + /// Sets the value(s) for the specified time. + /// + /// - Parameter skeleton: The skeleton the timeline is being applied to. This provides access to the bones, slots, and other skeleton components the timeline may change. + /// - Parameter lastTime: lastTime The time this timeline was last applied. Timelines such as EventTimeline trigger only at specific times rather than every frame. In that case, the timeline triggers everything between lastTime (exclusive) and time (inclusive). + /// - Parameter time: The time within the animation. Most timelines find the key before and the key after this time so they can interpolate between the keys. + /// - Parameter events: If any events are fired, they are added to this array. Can be NULL to ignore firing events or if the timeline does not fire events. May be NULL. + /// - Parameter alpha: alpha 0 applies the current or setup pose value (depending on pose parameter). 1 applies the timeline value. Between 0 and 1 applies a value between the current or setup pose and the timeline value. By adjusting alpha over time, an animation can be mixed in or out. alpha can also be useful to apply animations on top of each other (layered). + /// - Parameter blend: Controls how mixing is applied when alpha is than 1. + /// - Parameter direction: Indicates whether the timeline is mixing in or out. Used by timelines which perform instant transitions such as DrawOrderTimeline and AttachmentTimeline. + /// - Parameter appliedPose: True to modify the applied pose. public func apply(_ skeleton: Skeleton, _ lastTime: Float, _ time: Float, _ events: ArrayEvent?, _ alpha: Float, _ blend: MixBlend, _ direction: MixDirection, _ appliedPose: Bool) { spine_timeline_apply(_ptr.assumingMemoryBound(to: spine_timeline_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self), lastTime, time, events?._ptr.assumingMemoryBound(to: spine_array_event_wrapper.self), alpha, spine_mix_blend(rawValue: UInt32(blend.rawValue)), spine_mix_direction(rawValue: UInt32(direction.rawValue)), appliedPose) } diff --git a/spine-ios/Sources/SpineSwift/Generated/Update.swift b/spine-ios/Sources/SpineSwift/Generated/Update.swift index ed7580d76..d5de4ec83 100644 --- a/spine-ios/Sources/SpineSwift/Generated/Update.swift +++ b/spine-ios/Sources/SpineSwift/Generated/Update.swift @@ -32,7 +32,7 @@ import Foundation import SpineC -/// Update wrapper +/// The interface for items updated by Skeleton::updateWorldTransform(). public protocol Update { var _ptr: UnsafeMutableRawPointer { get } var rtti: Rtti { get } diff --git a/spine-ios/Sources/SpineSwift/Generated/animation_state.swift b/spine-ios/Sources/SpineSwift/Generated/animation_state.swift index bc9de2c8d..9fb29ecae 100644 --- a/spine-ios/Sources/SpineSwift/Generated/animation_state.swift +++ b/spine-ios/Sources/SpineSwift/Generated/animation_state.swift @@ -48,6 +48,10 @@ public class AnimationState: NSObject { self.init(fromPointer: ptr!) } + /// Sets an empty animation for every track, discarding any queued animations, and mixes to it + /// over the specified mix duration. + /// + /// See Empty animations in the Spine Runtimes Guide. public var emptyAnimations: Float { get { fatalError("Setter-only property") } set(newValue) { @@ -55,16 +59,23 @@ public class AnimationState: NSObject { } } + /// The AnimationStateData to look up mix durations. public var data: AnimationStateData { let result = spine_animation_state_get_data(_ptr.assumingMemoryBound(to: spine_animation_state_wrapper.self)) return AnimationStateData(fromPointer: result!) } + /// The list of tracks that have had animations, which may contain null entries for tracks that + /// currently have no animation. public var tracks: ArrayTrackEntry { let result = spine_animation_state_get_tracks(_ptr.assumingMemoryBound(to: spine_animation_state_wrapper.self)) return ArrayTrackEntry(fromPointer: result!) } + /// Multiplier for the delta time when the animation state is updated, causing time for all + /// animations and mixes to play slower or faster. Defaults to 1. + /// + /// See TrackEntry TrackEntry::getTimeScale() for affecting a single animation. public var timeScale: Float { get { let result = spine_animation_state_get_time_scale(_ptr.assumingMemoryBound(to: spine_animation_state_wrapper.self)) @@ -90,33 +101,77 @@ public class AnimationState: NSObject { return result } + /// Increments each track entry TrackEntry::getTrackTime(), setting queued animations as current + /// if needed. public func update(_ delta: Float) { spine_animation_state_update(_ptr.assumingMemoryBound(to: spine_animation_state_wrapper.self), delta) } + /// Poses the skeleton using the track entry animations. The animation state is not changed, so + /// can be applied to multiple skeletons to pose them identically. + /// + /// - Returns: True if any animations were applied. public func apply(_ skeleton: Skeleton) -> Bool { let result = spine_animation_state_apply(_ptr.assumingMemoryBound(to: spine_animation_state_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self)) return result } + /// Removes all animations from all tracks, leaving skeletons in their current pose. + /// + /// It may be desired to use AnimationState::setEmptyAnimations(float) to mix the skeletons back + /// to the setup pose, rather than leaving them in their current pose. public func clearTracks() { spine_animation_state_clear_tracks(_ptr.assumingMemoryBound(to: spine_animation_state_wrapper.self)) } + /// Removes all animations from the track, leaving skeletons in their current pose. + /// + /// It may be desired to use AnimationState::setEmptyAnimation(int, float) to mix the skeletons + /// back to the setup pose, rather than leaving them in their current pose. public func clearTrack(_ trackIndex: Int) { spine_animation_state_clear_track(_ptr.assumingMemoryBound(to: spine_animation_state_wrapper.self), trackIndex) } + /// Sets an empty animation for a track, discarding any queued animations, and sets the track + /// entry's TrackEntry::getMixDuration(). An empty animation has no timelines and serves as a + /// placeholder for mixing in or out. + /// + /// Mixing out is done by setting an empty animation with a mix duration using either + /// setEmptyAnimation(int, float), setEmptyAnimations(float), or addEmptyAnimation(int, float, + /// float). Mixing to an empty animation causes the previous animation to be applied less and + /// less over the mix duration. Properties keyed in the previous animation transition to the + /// value from lower tracks or to the setup pose value if no lower tracks key the property. A + /// mix duration of 0 still mixes out over one frame. +/// + /// Mixing in is done by first setting an empty animation, then adding an animation using + /// addAnimation(int, Animation, bool, float) with the desired delay (an empty animation has a + /// duration of 0) and on the returned track entry, set the TrackEntry::setMixDuration(float). + /// Mixing from an empty animation causes the new animation to be applied more and more over the + /// mix duration. Properties keyed in the new animation transition from the value from lower + /// tracks or from the setup pose value if no lower tracks key the property to the value keyed + /// in the new animation. +/// + /// See Empty animations in the Spine Runtimes Guide. public func setEmptyAnimation(_ trackIndex: Int, _ mixDuration: Float) -> TrackEntry { let result = spine_animation_state_set_empty_animation(_ptr.assumingMemoryBound(to: spine_animation_state_wrapper.self), trackIndex, mixDuration) return TrackEntry(fromPointer: result!) } + /// Adds an empty animation to be played after the current or last queued animation for a track, + /// and sets the track entry's TrackEntry::getMixDuration(). If the track has no entries, it is + /// equivalent to calling setEmptyAnimation(int, float). + /// + /// See setEmptyAnimation(int, float) and Empty animations in the Spine Runtimes Guide. + /// + /// - Parameter delay: If > 0, sets TrackEntry::getDelay(). If < = 0, the delay set is the duration of the previous track entry minus any mix duration plus the specified delay (ie the mix ends at ( delay = 0) or before ( delay < 0) the previous track entry duration). If the previous entry is looping, its next loop completion is used instead of its duration. + /// + /// - Returns: A track entry to allow further customization of animation playback. References to the track entry must not be kept after the AnimationStateListener::dispose(TrackEntry) event occurs. public func addEmptyAnimation(_ trackIndex: Int, _ mixDuration: Float, _ delay: Float) -> TrackEntry { let result = spine_animation_state_add_empty_animation(_ptr.assumingMemoryBound(to: spine_animation_state_wrapper.self), trackIndex, mixDuration, delay) return TrackEntry(fromPointer: result!) } + /// - Returns: The track entry for the animation currently playing on the track, or NULL if no animation is currently playing. public func getCurrent(_ trackIndex: Int) -> TrackEntry? { let result = spine_animation_state_get_current(_ptr.assumingMemoryBound(to: spine_animation_state_wrapper.self), trackIndex) return result.map { TrackEntry(fromPointer: $0) } @@ -134,21 +189,41 @@ public class AnimationState: NSObject { spine_animation_state_dispose_track_entry(_ptr.assumingMemoryBound(to: spine_animation_state_wrapper.self), entry?._ptr.assumingMemoryBound(to: spine_track_entry_wrapper.self)) } + /// Sets an animation by name. + /// + /// See setAnimation(int, Animation, bool). public func setAnimation(_ trackIndex: Int, _ animationName: String, _ loop: Bool) -> TrackEntry { let result = spine_animation_state_set_animation_1(_ptr.assumingMemoryBound(to: spine_animation_state_wrapper.self), trackIndex, animationName, loop) return TrackEntry(fromPointer: result!) } + /// Sets the current animation for a track, discarding any queued animations. + /// + /// If the formerly current track entry is for the same animation and was never applied to a + /// skeleton, it is replaced (not mixed from). + /// + /// - Parameter loop: If true, the animation will repeat. If false, it will not, instead its last frame is applied if played beyond its duration. In either case TrackEntry.TrackEnd determines when the track is cleared. + /// + /// - Returns: A track entry to allow further customization of animation playback. References to the track entry must not be kept after AnimationState.Dispose. public func setAnimation2(_ trackIndex: Int, _ animation: Animation, _ loop: Bool) -> TrackEntry { let result = spine_animation_state_set_animation_2(_ptr.assumingMemoryBound(to: spine_animation_state_wrapper.self), trackIndex, animation._ptr.assumingMemoryBound(to: spine_animation_wrapper.self), loop) return TrackEntry(fromPointer: result!) } + /// Queues an animation by name. + /// + /// See addAnimation(int, Animation, bool, float). public func addAnimation(_ trackIndex: Int, _ animationName: String, _ loop: Bool, _ delay: Float) -> TrackEntry { let result = spine_animation_state_add_animation_1(_ptr.assumingMemoryBound(to: spine_animation_state_wrapper.self), trackIndex, animationName, loop, delay) return TrackEntry(fromPointer: result!) } + /// Adds an animation to be played delay seconds after the current or last queued animation for + /// a track. If the track has no entries, this is equivalent to calling setAnimation. + /// + /// - Parameter delay: Seconds to begin this animation after the start of the previous animation. May be < = 0 to use the animation duration of the previous track minus any mix duration plus the negative delay. + /// + /// - Returns: A track entry to allow further customization of animation playback. References to the track entry must not be kept after AnimationState.Dispose public func addAnimation2(_ trackIndex: Int, _ animation: Animation, _ loop: Bool, _ delay: Float) -> TrackEntry { let result = spine_animation_state_add_animation_2(_ptr.assumingMemoryBound(to: spine_animation_state_wrapper.self), trackIndex, animation._ptr.assumingMemoryBound(to: spine_animation_wrapper.self), loop, delay) return TrackEntry(fromPointer: result!) diff --git a/spine-ios/Sources/SpineSwift/Generated/animation_state_data.swift b/spine-ios/Sources/SpineSwift/Generated/animation_state_data.swift index 2d48a07a3..ce3ebacc3 100644 --- a/spine-ios/Sources/SpineSwift/Generated/animation_state_data.swift +++ b/spine-ios/Sources/SpineSwift/Generated/animation_state_data.swift @@ -32,7 +32,7 @@ import Foundation import SpineC -/// AnimationStateData wrapper +/// Stores mix (crossfade) durations to be applied when AnimationState animations are changed. @objc(SpineAnimationStateData) @objcMembers public class AnimationStateData: NSObject { @@ -48,11 +48,14 @@ public class AnimationStateData: NSObject { self.init(fromPointer: ptr!) } + /// The SkeletonData to look up animations when they are specified by name. public var skeletonData: SkeletonData { let result = spine_animation_state_data_get_skeleton_data(_ptr.assumingMemoryBound(to: spine_animation_state_data_wrapper.self)) return SkeletonData(fromPointer: result!) } + /// The mix duration to use when no mix duration has been specifically defined between two + /// animations. public var defaultMix: Float { get { let result = spine_animation_state_data_get_default_mix(_ptr.assumingMemoryBound(to: spine_animation_state_data_wrapper.self)) @@ -63,19 +66,25 @@ public class AnimationStateData: NSObject { } } + /// The mix duration to use when changing from the specified animation to the other, or the + /// DefaultMix if no mix duration has been set. public func getMix(_ from: Animation, _ to: Animation) -> Float { let result = spine_animation_state_data_get_mix(_ptr.assumingMemoryBound(to: spine_animation_state_data_wrapper.self), from._ptr.assumingMemoryBound(to: spine_animation_wrapper.self), to._ptr.assumingMemoryBound(to: spine_animation_wrapper.self)) return result } + /// Removes all mixes and sets the default mix to 0. public func clear() { spine_animation_state_data_clear(_ptr.assumingMemoryBound(to: spine_animation_state_data_wrapper.self)) } + /// Sets a mix duration by animation names. public func setMix(_ fromName: String, _ toName: String, _ duration: Float) { spine_animation_state_data_set_mix_1(_ptr.assumingMemoryBound(to: spine_animation_state_data_wrapper.self), fromName, toName, duration) } + /// Sets a mix duration when changing from the specified animation to the other. See + /// TrackEntry.MixDuration. public func setMix2(_ from: Animation, _ to: Animation, _ duration: Float) { spine_animation_state_data_set_mix_2(_ptr.assumingMemoryBound(to: spine_animation_state_data_wrapper.self), from._ptr.assumingMemoryBound(to: spine_animation_wrapper.self), to._ptr.assumingMemoryBound(to: spine_animation_wrapper.self), duration) } diff --git a/spine-ios/Sources/SpineSwift/Generated/atlas_attachment_loader.swift b/spine-ios/Sources/SpineSwift/Generated/atlas_attachment_loader.swift index e2fdfdc9f..fe2639a1b 100644 --- a/spine-ios/Sources/SpineSwift/Generated/atlas_attachment_loader.swift +++ b/spine-ios/Sources/SpineSwift/Generated/atlas_attachment_loader.swift @@ -32,7 +32,10 @@ import Foundation import SpineC -/// AtlasAttachmentLoader wrapper +/// An AttachmentLoader that configures attachments using texture regions from an Atlas. +/// +/// See https://esotericsoftware.com/spine-loading-skeleton-data#JSON-and-binary-data Loading +/// skeleton data in the Spine Runtimes Guide. @objc(SpineAtlasAttachmentLoader) @objcMembers public class AtlasAttachmentLoader: NSObject, AttachmentLoader { diff --git a/spine-ios/Sources/SpineSwift/Generated/attachment_timeline.swift b/spine-ios/Sources/SpineSwift/Generated/attachment_timeline.swift index 8b739792b..82a0b21ea 100644 --- a/spine-ios/Sources/SpineSwift/Generated/attachment_timeline.swift +++ b/spine-ios/Sources/SpineSwift/Generated/attachment_timeline.swift @@ -56,6 +56,10 @@ public class AttachmentTimeline: Timeline, SlotTimeline { } } + /// Sets the time and attachment name for the specified frame. + /// + /// - Parameter frame: Between 0 and frameCount, inclusive. + /// - Parameter time: The frame time in seconds. public func setFrame(_ frame: Int32, _ time: Float, _ attachmentName: String) { spine_attachment_timeline_set_frame(_ptr.assumingMemoryBound(to: spine_attachment_timeline_wrapper.self), frame, time, attachmentName) } diff --git a/spine-ios/Sources/SpineSwift/Generated/bone_data.swift b/spine-ios/Sources/SpineSwift/Generated/bone_data.swift index 69b4f5574..17f66710f 100644 --- a/spine-ios/Sources/SpineSwift/Generated/bone_data.swift +++ b/spine-ios/Sources/SpineSwift/Generated/bone_data.swift @@ -46,11 +46,13 @@ public class BoneData: PosedData { self.init(fromPointer: ptr!) } + /// The index of the bone in Skeleton.Bones public var index: Int32 { let result = spine_bone_data_get_index(_ptr.assumingMemoryBound(to: spine_bone_data_wrapper.self)) return result } + /// May be NULL. public var parent: BoneData? { let result = spine_bone_data_get_parent(_ptr.assumingMemoryBound(to: spine_bone_data_wrapper.self)) return result.map { BoneData(fromPointer: $0) } diff --git a/spine-ios/Sources/SpineSwift/Generated/bone_local.swift b/spine-ios/Sources/SpineSwift/Generated/bone_local.swift index c496b7ea3..08c7b70e0 100644 --- a/spine-ios/Sources/SpineSwift/Generated/bone_local.swift +++ b/spine-ios/Sources/SpineSwift/Generated/bone_local.swift @@ -32,7 +32,7 @@ import Foundation import SpineC -/// BoneLocal wrapper +/// Stores a bone's local pose. @objc(SpineBoneLocal) @objcMembers public class BoneLocal: NSObject { @@ -48,6 +48,7 @@ public class BoneLocal: NSObject { self.init(fromPointer: ptr!) } + /// The local x translation. public var x: Float { get { let result = spine_bone_local_get_x(_ptr.assumingMemoryBound(to: spine_bone_local_wrapper.self)) @@ -58,6 +59,7 @@ public class BoneLocal: NSObject { } } + /// The local y translation. public var y: Float { get { let result = spine_bone_local_get_y(_ptr.assumingMemoryBound(to: spine_bone_local_wrapper.self)) @@ -68,6 +70,7 @@ public class BoneLocal: NSObject { } } + /// The local rotation in degrees, counter clockwise. public var rotation: Float { get { let result = spine_bone_local_get_rotation(_ptr.assumingMemoryBound(to: spine_bone_local_wrapper.self)) @@ -78,6 +81,7 @@ public class BoneLocal: NSObject { } } + /// The local scaleX. public var scaleX: Float { get { let result = spine_bone_local_get_scale_x(_ptr.assumingMemoryBound(to: spine_bone_local_wrapper.self)) @@ -88,6 +92,7 @@ public class BoneLocal: NSObject { } } + /// The local scaleY. public var scaleY: Float { get { let result = spine_bone_local_get_scale_y(_ptr.assumingMemoryBound(to: spine_bone_local_wrapper.self)) @@ -98,6 +103,7 @@ public class BoneLocal: NSObject { } } + /// The local shearX. public var shearX: Float { get { let result = spine_bone_local_get_shear_x(_ptr.assumingMemoryBound(to: spine_bone_local_wrapper.self)) @@ -108,6 +114,7 @@ public class BoneLocal: NSObject { } } + /// The local shearY. public var shearY: Float { get { let result = spine_bone_local_get_shear_y(_ptr.assumingMemoryBound(to: spine_bone_local_wrapper.self)) @@ -118,6 +125,7 @@ public class BoneLocal: NSObject { } } + /// Determines how parent world transforms affect this bone. public var inherit: Inherit { get { let result = spine_bone_local_get_inherit(_ptr.assumingMemoryBound(to: spine_bone_local_wrapper.self)) diff --git a/spine-ios/Sources/SpineSwift/Generated/bone_pose.swift b/spine-ios/Sources/SpineSwift/Generated/bone_pose.swift index d8d1857f3..b31717bd4 100644 --- a/spine-ios/Sources/SpineSwift/Generated/bone_pose.swift +++ b/spine-ios/Sources/SpineSwift/Generated/bone_pose.swift @@ -32,7 +32,8 @@ import Foundation import SpineC -/// BonePose wrapper +/// The applied pose for a bone. This is the Bone pose with constraints applied and the world +/// transform computed by Skeleton::updateWorldTransform(Physics). @objc(SpineBonePose) @objcMembers public class BonePose: BoneLocal, Update { @@ -51,6 +52,8 @@ public class BonePose: BoneLocal, Update { return Rtti(fromPointer: result!) } + /// Part of the world transform matrix for the X axis. If changed, updateLocalTransform() should + /// be called. public var a: Float { get { let result = spine_bone_pose_get_a(_ptr.assumingMemoryBound(to: spine_bone_pose_wrapper.self)) @@ -61,6 +64,8 @@ public class BonePose: BoneLocal, Update { } } + /// Part of the world transform matrix for the Y axis. If changed, updateLocalTransform() should + /// be called. public var b: Float { get { let result = spine_bone_pose_get_b(_ptr.assumingMemoryBound(to: spine_bone_pose_wrapper.self)) @@ -71,6 +76,8 @@ public class BonePose: BoneLocal, Update { } } + /// Part of the world transform matrix for the X axis. If changed, updateLocalTransform() should + /// be called. public var c: Float { get { let result = spine_bone_pose_get_c(_ptr.assumingMemoryBound(to: spine_bone_pose_wrapper.self)) @@ -81,6 +88,8 @@ public class BonePose: BoneLocal, Update { } } + /// Part of the world transform matrix for the Y axis. If changed, updateLocalTransform() should + /// be called. public var d: Float { get { let result = spine_bone_pose_get_d(_ptr.assumingMemoryBound(to: spine_bone_pose_wrapper.self)) @@ -91,6 +100,7 @@ public class BonePose: BoneLocal, Update { } } + /// The world X position. If changed, updateLocalTransform() should be called. public var worldX: Float { get { let result = spine_bone_pose_get_world_x(_ptr.assumingMemoryBound(to: spine_bone_pose_wrapper.self)) @@ -101,6 +111,7 @@ public class BonePose: BoneLocal, Update { } } + /// The world Y position. If changed, updateLocalTransform() should be called. public var worldY: Float { get { let result = spine_bone_pose_get_world_y(_ptr.assumingMemoryBound(to: spine_bone_pose_wrapper.self)) @@ -111,38 +122,58 @@ public class BonePose: BoneLocal, Update { } } + /// The world rotation for the X axis, calculated using a and c. public var worldRotationX: Float { let result = spine_bone_pose_get_world_rotation_x(_ptr.assumingMemoryBound(to: spine_bone_pose_wrapper.self)) return result } + /// The world rotation for the Y axis, calculated using b and d. public var worldRotationY: Float { let result = spine_bone_pose_get_world_rotation_y(_ptr.assumingMemoryBound(to: spine_bone_pose_wrapper.self)) return result } + /// The magnitude (always positive) of the world scale X, calculated using a and c. public var worldScaleX: Float { let result = spine_bone_pose_get_world_scale_x(_ptr.assumingMemoryBound(to: spine_bone_pose_wrapper.self)) return result } + /// The magnitude (always positive) of the world scale Y, calculated using b and d. public var worldScaleY: Float { let result = spine_bone_pose_get_world_scale_y(_ptr.assumingMemoryBound(to: spine_bone_pose_wrapper.self)) return result } + /// Called by Skeleton::updateCache() to compute the world transform, if needed. public func update(_ skeleton: Skeleton, _ physics: Physics) { spine_bone_pose_update(_ptr.assumingMemoryBound(to: spine_bone_pose_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self), spine_physics(rawValue: UInt32(physics.rawValue))) } + /// Computes the world transform using the parent bone's applied pose and this pose. Child bones + /// are not updated. + /// + /// See World transforms in the Spine Runtimes Guide. public func updateWorldTransform(_ skeleton: Skeleton) { spine_bone_pose_update_world_transform(_ptr.assumingMemoryBound(to: spine_bone_pose_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self)) } + /// Computes the local transform values from the world transform. + /// + /// If the world transform is modified (by a constraint, rotateWorld(), etc) then this method + /// should be called so the local transform matches the world transform. The local transform may + /// be needed by other code (eg to apply another constraint). +/// + /// Some information is ambiguous in the world transform, such as -1,-1 scale versus 180 + /// rotation. The local transform after calling this method is equivalent to the local transform + /// used to compute the world transform, but may not be identical. public func updateLocalTransform(_ skeleton: Skeleton) { spine_bone_pose_update_local_transform(_ptr.assumingMemoryBound(to: spine_bone_pose_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self)) } + /// If the world transform has been modified and the local transform no longer matches, + /// updateLocalTransform() is called. public func validateLocalTransform(_ skeleton: Skeleton) { spine_bone_pose_validate_local_transform(_ptr.assumingMemoryBound(to: spine_bone_pose_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self)) } @@ -159,16 +190,22 @@ public class BonePose: BoneLocal, Update { spine_bone_pose_reset_world(_ptr.assumingMemoryBound(to: spine_bone_pose_wrapper.self), update) } + /// Transforms a world rotation to a local rotation. public func worldToLocalRotation(_ worldRotation: Float) -> Float { let result = spine_bone_pose_world_to_local_rotation(_ptr.assumingMemoryBound(to: spine_bone_pose_wrapper.self), worldRotation) return result } + /// Transforms a local rotation to a world rotation. public func localToWorldRotation(_ localRotation: Float) -> Float { let result = spine_bone_pose_local_to_world_rotation(_ptr.assumingMemoryBound(to: spine_bone_pose_wrapper.self), localRotation) return result } + /// Rotates the world transform the specified amount. + /// + /// After changes are made to the world transform, updateLocalTransform() should be called on + /// this bone and any child bones, recursively. public func rotateWorld(_ degrees: Float) { spine_bone_pose_rotate_world(_ptr.assumingMemoryBound(to: spine_bone_pose_wrapper.self), degrees) } diff --git a/spine-ios/Sources/SpineSwift/Generated/bone_timeline.swift b/spine-ios/Sources/SpineSwift/Generated/bone_timeline.swift index aaac3b194..38d9d1a39 100644 --- a/spine-ios/Sources/SpineSwift/Generated/bone_timeline.swift +++ b/spine-ios/Sources/SpineSwift/Generated/bone_timeline.swift @@ -32,7 +32,7 @@ import Foundation import SpineC -/// BoneTimeline wrapper +/// An interface for timelines which change the property of a bone. public protocol BoneTimeline { var _ptr: UnsafeMutableRawPointer { get } var rtti: Rtti { get } diff --git a/spine-ios/Sources/SpineSwift/Generated/bone_timeline1.swift b/spine-ios/Sources/SpineSwift/Generated/bone_timeline1.swift index 74a359e37..7ca2bb894 100644 --- a/spine-ios/Sources/SpineSwift/Generated/bone_timeline1.swift +++ b/spine-ios/Sources/SpineSwift/Generated/bone_timeline1.swift @@ -32,7 +32,7 @@ import Foundation import SpineC -/// BoneTimeline1 wrapper +/// Base class for timelines that animate a single bone property. @objc(SpineBoneTimeline1) @objcMembers open class BoneTimeline1: CurveTimeline1, BoneTimeline { diff --git a/spine-ios/Sources/SpineSwift/Generated/bone_timeline2.swift b/spine-ios/Sources/SpineSwift/Generated/bone_timeline2.swift index 5fe705468..d9c589e5c 100644 --- a/spine-ios/Sources/SpineSwift/Generated/bone_timeline2.swift +++ b/spine-ios/Sources/SpineSwift/Generated/bone_timeline2.swift @@ -32,7 +32,7 @@ import Foundation import SpineC -/// BoneTimeline2 wrapper +/// Base class for timelines that animate two bone properties. @objc(SpineBoneTimeline2) @objcMembers open class BoneTimeline2: CurveTimeline, BoneTimeline { diff --git a/spine-ios/Sources/SpineSwift/Generated/bounding_box_attachment.swift b/spine-ios/Sources/SpineSwift/Generated/bounding_box_attachment.swift index 6e76b81cf..b47ebc180 100644 --- a/spine-ios/Sources/SpineSwift/Generated/bounding_box_attachment.swift +++ b/spine-ios/Sources/SpineSwift/Generated/bounding_box_attachment.swift @@ -32,7 +32,7 @@ import Foundation import SpineC -/// BoundingBoxAttachment wrapper +/// Attachment that has a polygon for bounds checking. @objc(SpineBoundingBoxAttachment) @objcMembers public class BoundingBoxAttachment: VertexAttachment { diff --git a/spine-ios/Sources/SpineSwift/Generated/constraint_timeline.swift b/spine-ios/Sources/SpineSwift/Generated/constraint_timeline.swift index fb3bcbf6e..cf3a8ac88 100644 --- a/spine-ios/Sources/SpineSwift/Generated/constraint_timeline.swift +++ b/spine-ios/Sources/SpineSwift/Generated/constraint_timeline.swift @@ -32,7 +32,7 @@ import Foundation import SpineC -/// ConstraintTimeline wrapper +/// An interface for timelines which change the property of a constraint. public protocol ConstraintTimeline { var _ptr: UnsafeMutableRawPointer { get } var rtti: Rtti { get } diff --git a/spine-ios/Sources/SpineSwift/Generated/constraint_timeline1.swift b/spine-ios/Sources/SpineSwift/Generated/constraint_timeline1.swift index 1baecd96f..be02a6f64 100644 --- a/spine-ios/Sources/SpineSwift/Generated/constraint_timeline1.swift +++ b/spine-ios/Sources/SpineSwift/Generated/constraint_timeline1.swift @@ -32,7 +32,7 @@ import Foundation import SpineC -/// ConstraintTimeline1 wrapper +/// Base class for single-value constraint timelines. @objc(SpineConstraintTimeline1) @objcMembers open class ConstraintTimeline1: CurveTimeline1, ConstraintTimeline { diff --git a/spine-ios/Sources/SpineSwift/Generated/curve_timeline.swift b/spine-ios/Sources/SpineSwift/Generated/curve_timeline.swift index f5a4b6b21..420083f03 100644 --- a/spine-ios/Sources/SpineSwift/Generated/curve_timeline.swift +++ b/spine-ios/Sources/SpineSwift/Generated/curve_timeline.swift @@ -32,7 +32,7 @@ import Foundation import SpineC -/// CurveTimeline wrapper +/// Base class for frames that use an interpolation bezier curve. @objc(SpineCurveTimeline) @objcMembers open class CurveTimeline: Timeline { diff --git a/spine-ios/Sources/SpineSwift/Generated/curve_timeline1.swift b/spine-ios/Sources/SpineSwift/Generated/curve_timeline1.swift index 838b0fe42..a75e5bbe6 100644 --- a/spine-ios/Sources/SpineSwift/Generated/curve_timeline1.swift +++ b/spine-ios/Sources/SpineSwift/Generated/curve_timeline1.swift @@ -32,7 +32,7 @@ import Foundation import SpineC -/// CurveTimeline1 wrapper +/// The base class for a CurveTimeline that sets one property. @objc(SpineCurveTimeline1) @objcMembers open class CurveTimeline1: CurveTimeline { @@ -41,10 +41,15 @@ open class CurveTimeline1: CurveTimeline { super.init(fromPointer: UnsafeMutableRawPointer(ptr).assumingMemoryBound(to: spine_curve_timeline_wrapper.self)) } + /// Sets the time and value for the specified frame. + /// + /// - Parameter frame: Between 0 and frameCount, inclusive. + /// - Parameter time: The frame time in seconds. public func setFrame(_ frame: Int, _ time: Float, _ value: Float) { spine_curve_timeline1_set_frame(_ptr.assumingMemoryBound(to: spine_curve_timeline1_wrapper.self), frame, time, value) } + /// Returns the interpolated value for the specified time. public func getCurveValue(_ time: Float) -> Float { let result = spine_curve_timeline1_get_curve_value(_ptr.assumingMemoryBound(to: spine_curve_timeline1_wrapper.self), time) return result diff --git a/spine-ios/Sources/SpineSwift/Generated/deform_timeline.swift b/spine-ios/Sources/SpineSwift/Generated/deform_timeline.swift index 98ab5ae0f..ab08a8a8c 100644 --- a/spine-ios/Sources/SpineSwift/Generated/deform_timeline.swift +++ b/spine-ios/Sources/SpineSwift/Generated/deform_timeline.swift @@ -32,7 +32,7 @@ import Foundation import SpineC -/// DeformTimeline wrapper +/// Changes a slot's SlotPose::getDeform() to deform a VertexAttachment. @objc(SpineDeformTimeline) @objcMembers public class DeformTimeline: SlotCurveTimeline { @@ -46,6 +46,7 @@ public class DeformTimeline: SlotCurveTimeline { self.init(fromPointer: ptr!) } + /// The attachment that will be deformed. public var attachment: VertexAttachment { get { let result = spine_deform_timeline_get_attachment(_ptr.assumingMemoryBound(to: spine_deform_timeline_wrapper.self)) @@ -73,6 +74,7 @@ public class DeformTimeline: SlotCurveTimeline { } } + /// Sets the time and vertices for the specified frame. public func setFrame(_ frameIndex: Int32, _ time: Float, _ vertices: ArrayFloat) { spine_deform_timeline_set_frame(_ptr.assumingMemoryBound(to: spine_deform_timeline_wrapper.self), frameIndex, time, vertices._ptr.assumingMemoryBound(to: spine_array_float_wrapper.self)) } diff --git a/spine-ios/Sources/SpineSwift/Generated/draw_order_timeline.swift b/spine-ios/Sources/SpineSwift/Generated/draw_order_timeline.swift index d67bc4f80..1037f26ea 100644 --- a/spine-ios/Sources/SpineSwift/Generated/draw_order_timeline.swift +++ b/spine-ios/Sources/SpineSwift/Generated/draw_order_timeline.swift @@ -32,7 +32,7 @@ import Foundation import SpineC -/// DrawOrderTimeline wrapper +/// Changes a skeleton's Skeleton::getDrawOrder(). @objc(SpineDrawOrderTimeline) @objcMembers public class DrawOrderTimeline: Timeline { @@ -46,6 +46,11 @@ public class DrawOrderTimeline: Timeline { self.init(fromPointer: ptr!) } + /// Sets the time and draw order for the specified frame. + /// + /// - Parameter frame: Between 0 and frameCount, inclusive. + /// - Parameter time: The frame time in seconds. + /// - Parameter drawOrder: For each slot in Skeleton::slots, the index of the slot in the new draw order. May be null to use setup pose draw order. public func setFrame(_ frame: Int, _ time: Float, _ drawOrder: ArrayInt?) { spine_draw_order_timeline_set_frame(_ptr.assumingMemoryBound(to: spine_draw_order_timeline_wrapper.self), frame, time, drawOrder?._ptr.assumingMemoryBound(to: spine_array_int_wrapper.self)) } diff --git a/spine-ios/Sources/SpineSwift/Generated/event_data.swift b/spine-ios/Sources/SpineSwift/Generated/event_data.swift index 3789588c3..646bff045 100644 --- a/spine-ios/Sources/SpineSwift/Generated/event_data.swift +++ b/spine-ios/Sources/SpineSwift/Generated/event_data.swift @@ -32,7 +32,7 @@ import Foundation import SpineC -/// EventData wrapper +/// Stores the setup pose values for an Event. @objc(SpineEventData) @objcMembers public class EventData: NSObject { @@ -48,6 +48,7 @@ public class EventData: NSObject { self.init(fromPointer: ptr!) } + /// The name of the event, which is unique within the skeleton. public var name: String { let result = spine_event_data_get_name(_ptr.assumingMemoryBound(to: spine_event_data_wrapper.self)) return String(cString: result!) diff --git a/spine-ios/Sources/SpineSwift/Generated/event_timeline.swift b/spine-ios/Sources/SpineSwift/Generated/event_timeline.swift index 30042b057..2ca8eb241 100644 --- a/spine-ios/Sources/SpineSwift/Generated/event_timeline.swift +++ b/spine-ios/Sources/SpineSwift/Generated/event_timeline.swift @@ -32,7 +32,7 @@ import Foundation import SpineC -/// EventTimeline wrapper +/// Fires an Event when specific animation times are reached. @objc(SpineEventTimeline) @objcMembers public class EventTimeline: Timeline { @@ -46,11 +46,15 @@ public class EventTimeline: Timeline { self.init(fromPointer: ptr!) } + /// The event for each frame. public var events: ArrayEvent { let result = spine_event_timeline_get_events(_ptr.assumingMemoryBound(to: spine_event_timeline_wrapper.self)) return ArrayEvent(fromPointer: result!) } + /// Sets the time and event for the specified frame. + /// + /// - Parameter frame: Between 0 and frameCount, inclusive. public func setFrame(_ frame: Int, _ event: Event) { spine_event_timeline_set_frame(_ptr.assumingMemoryBound(to: spine_event_timeline_wrapper.self), frame, event._ptr.assumingMemoryBound(to: spine_event_wrapper.self)) } diff --git a/spine-ios/Sources/SpineSwift/Generated/from_property.swift b/spine-ios/Sources/SpineSwift/Generated/from_property.swift index f322efea6..aae78bc40 100644 --- a/spine-ios/Sources/SpineSwift/Generated/from_property.swift +++ b/spine-ios/Sources/SpineSwift/Generated/from_property.swift @@ -32,7 +32,7 @@ import Foundation import SpineC -/// FromProperty wrapper +/// Source property for a TransformConstraint. @objc(SpineFromProperty) @objcMembers open class FromProperty: NSObject { diff --git a/spine-ios/Sources/SpineSwift/Generated/ik_constraint.swift b/spine-ios/Sources/SpineSwift/Generated/ik_constraint.swift index 7ff567406..65f72ea3c 100644 --- a/spine-ios/Sources/SpineSwift/Generated/ik_constraint.swift +++ b/spine-ios/Sources/SpineSwift/Generated/ik_constraint.swift @@ -66,10 +66,16 @@ public class IkConstraint: IkConstraintBase { return IkConstraint(fromPointer: result!) } + /// Adjusts the bone rotation so the tip is as close to the target position as possible. The + /// target is specified in the world coordinate system. public static func apply(_ skeleton: Skeleton, _ bone: BonePose, _ targetX: Float, _ targetY: Float, _ compress: Bool, _ stretch: Bool, _ uniform: Bool, _ mix: Float) { spine_ik_constraint_apply_1(skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self), bone._ptr.assumingMemoryBound(to: spine_bone_pose_wrapper.self), targetX, targetY, compress, stretch, uniform, mix) } + /// Adjusts the parent and child bone rotations so the tip of the child is as close to the + /// target position as possible. The target is specified in the world coordinate system. + /// + /// - Parameter child: A direct descendant of the parent bone. public static func apply2(_ skeleton: Skeleton, _ parent: BonePose, _ child: BonePose, _ targetX: Float, _ targetY: Float, _ bendDirection: Int32, _ stretch: Bool, _ uniform: Bool, _ softness: Float, _ mix: Float) { spine_ik_constraint_apply_2(skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self), parent._ptr.assumingMemoryBound(to: spine_bone_pose_wrapper.self), child._ptr.assumingMemoryBound(to: spine_bone_pose_wrapper.self), targetX, targetY, bendDirection, stretch, uniform, softness, mix) } diff --git a/spine-ios/Sources/SpineSwift/Generated/ik_constraint_base.swift b/spine-ios/Sources/SpineSwift/Generated/ik_constraint_base.swift index 76afc9889..75ebf0894 100644 --- a/spine-ios/Sources/SpineSwift/Generated/ik_constraint_base.swift +++ b/spine-ios/Sources/SpineSwift/Generated/ik_constraint_base.swift @@ -32,7 +32,7 @@ import Foundation import SpineC -/// IkConstraintBase wrapper +/// Non-exported base class that inherits from the template @objc(SpineIkConstraintBase) @objcMembers open class IkConstraintBase: PosedActive, Posed, Constraint { @@ -83,6 +83,7 @@ open class IkConstraintBase: PosedActive, Posed, Constraint { spine_ik_constraint_base_sort(_ptr.assumingMemoryBound(to: spine_ik_constraint_base_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self)) } + /// Inherited from Update public func update(_ skeleton: Skeleton, _ physics: Physics) { spine_ik_constraint_base_update(_ptr.assumingMemoryBound(to: spine_ik_constraint_base_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self), spine_physics(rawValue: UInt32(physics.rawValue))) } diff --git a/spine-ios/Sources/SpineSwift/Generated/ik_constraint_data.swift b/spine-ios/Sources/SpineSwift/Generated/ik_constraint_data.swift index f2ba08031..e8241a40c 100644 --- a/spine-ios/Sources/SpineSwift/Generated/ik_constraint_data.swift +++ b/spine-ios/Sources/SpineSwift/Generated/ik_constraint_data.swift @@ -51,11 +51,13 @@ public class IkConstraintData: PosedData, ConstraintData { return Rtti(fromPointer: result!) } + /// The bones that are constrained by this IK Constraint. public var bones: ArrayBoneData { let result = spine_ik_constraint_data_get_bones(_ptr.assumingMemoryBound(to: spine_ik_constraint_data_wrapper.self)) return ArrayBoneData(fromPointer: result!) } + /// The bone that is the IK target. public var target: BoneData { get { let result = spine_ik_constraint_data_get_target(_ptr.assumingMemoryBound(to: spine_ik_constraint_data_wrapper.self)) @@ -66,6 +68,8 @@ public class IkConstraintData: PosedData, ConstraintData { } } + /// When true and IkConstraintPose compress or stretch is used, the bone is scaled on both the X + /// and Y axes. public var uniform: Bool { get { let result = spine_ik_constraint_data_get_uniform(_ptr.assumingMemoryBound(to: spine_ik_constraint_data_wrapper.self)) diff --git a/spine-ios/Sources/SpineSwift/Generated/ik_constraint_pose.swift b/spine-ios/Sources/SpineSwift/Generated/ik_constraint_pose.swift index 909bf6ab4..138a9990b 100644 --- a/spine-ios/Sources/SpineSwift/Generated/ik_constraint_pose.swift +++ b/spine-ios/Sources/SpineSwift/Generated/ik_constraint_pose.swift @@ -32,7 +32,7 @@ import Foundation import SpineC -/// IkConstraintPose wrapper +/// Stores the current pose for an IK constraint. @objc(SpineIkConstraintPose) @objcMembers public class IkConstraintPose: NSObject { @@ -48,6 +48,10 @@ public class IkConstraintPose: NSObject { self.init(fromPointer: ptr!) } + /// A percentage (0-1) that controls the mix between the constrained and unconstrained rotation. + /// + /// For two bone IK: if the parent bone has local nonuniform scale, the child bone's local Y + /// translation is set to 0. public var mix: Float { get { let result = spine_ik_constraint_pose_get_mix(_ptr.assumingMemoryBound(to: spine_ik_constraint_pose_wrapper.self)) @@ -58,6 +62,9 @@ public class IkConstraintPose: NSObject { } } + /// For two bone IK, the target bone's distance from the maximum reach of the bones where + /// rotation begins to slow. The bones will not straighten completely until the target is this + /// far out of range. public var softness: Float { get { let result = spine_ik_constraint_pose_get_softness(_ptr.assumingMemoryBound(to: spine_ik_constraint_pose_wrapper.self)) @@ -68,6 +75,7 @@ public class IkConstraintPose: NSObject { } } + /// For two bone IK, controls the bend direction of the IK bones, either 1 or -1. public var bendDirection: Int32 { get { let result = spine_ik_constraint_pose_get_bend_direction(_ptr.assumingMemoryBound(to: spine_ik_constraint_pose_wrapper.self)) @@ -78,6 +86,7 @@ public class IkConstraintPose: NSObject { } } + /// For one bone IK, when true and the target is too close, the bone is scaled to reach it. public var compress: Bool { get { let result = spine_ik_constraint_pose_get_compress(_ptr.assumingMemoryBound(to: spine_ik_constraint_pose_wrapper.self)) @@ -88,6 +97,11 @@ public class IkConstraintPose: NSObject { } } + /// When true and the target is out of range, the parent bone is scaled to reach it. + /// + /// For two bone IK: 1) the child bone's local Y translation is set to 0, 2) stretch is not + /// applied if getSoftness() is > 0, and 3) if the parent bone has local nonuniform scale, + /// stretch is not applied. public var stretch: Bool { get { let result = spine_ik_constraint_pose_get_stretch(_ptr.assumingMemoryBound(to: spine_ik_constraint_pose_wrapper.self)) diff --git a/spine-ios/Sources/SpineSwift/Generated/ik_constraint_timeline.swift b/spine-ios/Sources/SpineSwift/Generated/ik_constraint_timeline.swift index 09e2e8749..893fe13a5 100644 --- a/spine-ios/Sources/SpineSwift/Generated/ik_constraint_timeline.swift +++ b/spine-ios/Sources/SpineSwift/Generated/ik_constraint_timeline.swift @@ -32,7 +32,9 @@ import Foundation import SpineC -/// IkConstraintTimeline wrapper +/// Changes an IK constraint's IkConstraintPose::getMix(), IkConstraintPose::getSoftness(), +/// IkConstraintPose::getBendDirection(), IkConstraintPose::getStretch(), and +/// IkConstraintPose::getCompress(). @objc(SpineIkConstraintTimeline) @objcMembers public class IkConstraintTimeline: CurveTimeline, ConstraintTimeline { @@ -56,6 +58,11 @@ public class IkConstraintTimeline: CurveTimeline, ConstraintTimeline { } } + /// Sets the time, mix, softness, bend direction, compress, and stretch for the specified frame. + /// + /// - Parameter frame: Between 0 and frameCount, inclusive. + /// - Parameter time: The frame time in seconds. + /// - Parameter bendDirection: 1 or -1. public func setFrame(_ frame: Int32, _ time: Float, _ mix: Float, _ softness: Float, _ bendDirection: Int32, _ compress: Bool, _ stretch: Bool) { spine_ik_constraint_timeline_set_frame(_ptr.assumingMemoryBound(to: spine_ik_constraint_timeline_wrapper.self), frame, time, mix, softness, bendDirection, compress, stretch) } diff --git a/spine-ios/Sources/SpineSwift/Generated/inherit_timeline.swift b/spine-ios/Sources/SpineSwift/Generated/inherit_timeline.swift index 241186d27..5a9a8b627 100644 --- a/spine-ios/Sources/SpineSwift/Generated/inherit_timeline.swift +++ b/spine-ios/Sources/SpineSwift/Generated/inherit_timeline.swift @@ -32,7 +32,7 @@ import Foundation import SpineC -/// InheritTimeline wrapper +/// Changes a bone's BoneLocal::getInherit(). @objc(SpineInheritTimeline) @objcMembers public class InheritTimeline: Timeline, BoneTimeline { @@ -56,6 +56,10 @@ public class InheritTimeline: Timeline, BoneTimeline { } } + /// Sets the inherit transform mode for the specified frame. + /// + /// - Parameter frame: Between 0 and frameCount, inclusive. + /// - Parameter time: The frame time in seconds. public func setFrame(_ frame: Int32, _ time: Float, _ inherit: Inherit) { spine_inherit_timeline_set_frame(_ptr.assumingMemoryBound(to: spine_inherit_timeline_wrapper.self), frame, time, spine_inherit(rawValue: UInt32(inherit.rawValue))) } diff --git a/spine-ios/Sources/SpineSwift/Generated/mesh_attachment.swift b/spine-ios/Sources/SpineSwift/Generated/mesh_attachment.swift index 86659b669..085565890 100644 --- a/spine-ios/Sources/SpineSwift/Generated/mesh_attachment.swift +++ b/spine-ios/Sources/SpineSwift/Generated/mesh_attachment.swift @@ -32,7 +32,7 @@ import Foundation import SpineC -/// MeshAttachment wrapper +/// Attachment that displays a texture region using a mesh. @objc(SpineMeshAttachment) @objcMembers public class MeshAttachment: VertexAttachment { @@ -66,6 +66,8 @@ public class MeshAttachment: VertexAttachment { } } + /// The UV pair for each vertex, normalized within the entire texture. See also + /// MeshAttachment::updateRegion public var uVs: ArrayFloat { let result = spine_mesh_attachment_get_u_vs(_ptr.assumingMemoryBound(to: spine_mesh_attachment_wrapper.self)) return ArrayFloat(fromPointer: result!) @@ -126,6 +128,7 @@ public class MeshAttachment: VertexAttachment { } } + /// Nonessential. public var edges: ArrayUnsignedShort { get { let result = spine_mesh_attachment_get_edges(_ptr.assumingMemoryBound(to: spine_mesh_attachment_wrapper.self)) diff --git a/spine-ios/Sources/SpineSwift/Generated/path_attachment.swift b/spine-ios/Sources/SpineSwift/Generated/path_attachment.swift index f6e9f36d5..f59a871f8 100644 --- a/spine-ios/Sources/SpineSwift/Generated/path_attachment.swift +++ b/spine-ios/Sources/SpineSwift/Generated/path_attachment.swift @@ -46,6 +46,7 @@ public class PathAttachment: VertexAttachment { self.init(fromPointer: ptr!) } + /// The length in the setup pose from the start of the path to the end of each curve. public var lengths: ArrayFloat { get { let result = spine_path_attachment_get_lengths(_ptr.assumingMemoryBound(to: spine_path_attachment_wrapper.self)) diff --git a/spine-ios/Sources/SpineSwift/Generated/path_constraint.swift b/spine-ios/Sources/SpineSwift/Generated/path_constraint.swift index b931a5a22..60ed3304f 100644 --- a/spine-ios/Sources/SpineSwift/Generated/path_constraint.swift +++ b/spine-ios/Sources/SpineSwift/Generated/path_constraint.swift @@ -46,11 +46,13 @@ public class PathConstraint: PathConstraintBase { self.init(fromPointer: ptr!) } + /// The bones that will be modified by this path constraint. public var bones: ArrayBonePose { let result = spine_path_constraint_get_bones(_ptr.assumingMemoryBound(to: spine_path_constraint_wrapper.self)) return ArrayBonePose(fromPointer: result!) } + /// The slot whose path attachment will be used to constrained the bones. public var slot: Slot { get { let result = spine_path_constraint_get_slot(_ptr.assumingMemoryBound(to: spine_path_constraint_wrapper.self)) diff --git a/spine-ios/Sources/SpineSwift/Generated/path_constraint_base.swift b/spine-ios/Sources/SpineSwift/Generated/path_constraint_base.swift index c9294e5bc..8e9ee7916 100644 --- a/spine-ios/Sources/SpineSwift/Generated/path_constraint_base.swift +++ b/spine-ios/Sources/SpineSwift/Generated/path_constraint_base.swift @@ -32,7 +32,11 @@ import Foundation import SpineC -/// PathConstraintBase wrapper +/// Stores the current pose for a path constraint. A path constraint adjusts the rotation, +/// translation, and scale of the constrained bones so they follow a PathAttachment. +/// +/// See https://esotericsoftware.com/spine-path-constraints Path constraints in the Spine User +/// Guide. Non-exported base class that inherits from the template @objc(SpinePathConstraintBase) @objcMembers open class PathConstraintBase: PosedActive, Posed, Constraint { @@ -83,6 +87,7 @@ open class PathConstraintBase: PosedActive, Posed, Constraint { spine_path_constraint_base_sort(_ptr.assumingMemoryBound(to: spine_path_constraint_base_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self)) } + /// Inherited from Update public func update(_ skeleton: Skeleton, _ physics: Physics) { spine_path_constraint_base_update(_ptr.assumingMemoryBound(to: spine_path_constraint_base_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self), spine_physics(rawValue: UInt32(physics.rawValue))) } diff --git a/spine-ios/Sources/SpineSwift/Generated/path_constraint_data.swift b/spine-ios/Sources/SpineSwift/Generated/path_constraint_data.swift index 23086406f..13d5b5806 100644 --- a/spine-ios/Sources/SpineSwift/Generated/path_constraint_data.swift +++ b/spine-ios/Sources/SpineSwift/Generated/path_constraint_data.swift @@ -32,7 +32,10 @@ import Foundation import SpineC -/// PathConstraintData wrapper +/// Stores the setup pose for a PathConstraint. +/// +/// See https://esotericsoftware.com/spine-path-constraints Path constraints in the Spine User +/// Guide. @objc(SpinePathConstraintData) @objcMembers public class PathConstraintData: PosedData, ConstraintData { @@ -51,11 +54,13 @@ public class PathConstraintData: PosedData, ConstraintData { return Rtti(fromPointer: result!) } + /// The bones that will be modified by this path constraint. public var bones: ArrayBoneData { let result = spine_path_constraint_data_get_bones(_ptr.assumingMemoryBound(to: spine_path_constraint_data_wrapper.self)) return ArrayBoneData(fromPointer: result!) } + /// The slot whose path attachment will be used to constrained the bones. public var slot: SlotData { get { let result = spine_path_constraint_data_get_slot(_ptr.assumingMemoryBound(to: spine_path_constraint_data_wrapper.self)) @@ -66,6 +71,7 @@ public class PathConstraintData: PosedData, ConstraintData { } } + /// The mode for positioning the first bone on the path. public var positionMode: PositionMode { get { let result = spine_path_constraint_data_get_position_mode(_ptr.assumingMemoryBound(to: spine_path_constraint_data_wrapper.self)) @@ -76,6 +82,7 @@ public class PathConstraintData: PosedData, ConstraintData { } } + /// The mode for positioning the bones after the first bone on the path. public var spacingMode: SpacingMode { get { let result = spine_path_constraint_data_get_spacing_mode(_ptr.assumingMemoryBound(to: spine_path_constraint_data_wrapper.self)) @@ -86,6 +93,7 @@ public class PathConstraintData: PosedData, ConstraintData { } } + /// The mode for adjusting the rotation of the bones. public var rotateMode: RotateMode { get { let result = spine_path_constraint_data_get_rotate_mode(_ptr.assumingMemoryBound(to: spine_path_constraint_data_wrapper.self)) @@ -96,6 +104,7 @@ public class PathConstraintData: PosedData, ConstraintData { } } + /// An offset added to the constrained bone rotation. public var offsetRotation: Float { get { let result = spine_path_constraint_data_get_offset_rotation(_ptr.assumingMemoryBound(to: spine_path_constraint_data_wrapper.self)) diff --git a/spine-ios/Sources/SpineSwift/Generated/path_constraint_mix_timeline.swift b/spine-ios/Sources/SpineSwift/Generated/path_constraint_mix_timeline.swift index b6a7bed79..010c7f33f 100644 --- a/spine-ios/Sources/SpineSwift/Generated/path_constraint_mix_timeline.swift +++ b/spine-ios/Sources/SpineSwift/Generated/path_constraint_mix_timeline.swift @@ -32,7 +32,8 @@ import Foundation import SpineC -/// PathConstraintMixTimeline wrapper +/// Changes a path constraint's PathConstraintPose::getMixRotate(), PathConstraintPose::getMixX(), +/// and PathConstraintPose::getMixY(). @objc(SpinePathConstraintMixTimeline) @objcMembers public class PathConstraintMixTimeline: CurveTimeline, ConstraintTimeline { @@ -56,6 +57,10 @@ public class PathConstraintMixTimeline: CurveTimeline, ConstraintTimeline { } } + /// Sets the time and color for the specified frame. + /// + /// - Parameter frame: Between 0 and frameCount, inclusive. + /// - Parameter time: The frame time in seconds. public func setFrame(_ frame: Int32, _ time: Float, _ mixRotate: Float, _ mixX: Float, _ mixY: Float) { spine_path_constraint_mix_timeline_set_frame(_ptr.assumingMemoryBound(to: spine_path_constraint_mix_timeline_wrapper.self), frame, time, mixRotate, mixX, mixY) } diff --git a/spine-ios/Sources/SpineSwift/Generated/path_constraint_pose.swift b/spine-ios/Sources/SpineSwift/Generated/path_constraint_pose.swift index c4e2cd117..b0e599d3b 100644 --- a/spine-ios/Sources/SpineSwift/Generated/path_constraint_pose.swift +++ b/spine-ios/Sources/SpineSwift/Generated/path_constraint_pose.swift @@ -32,7 +32,7 @@ import Foundation import SpineC -/// PathConstraintPose wrapper +/// Stores a pose for a path constraint. @objc(SpinePathConstraintPose) @objcMembers public class PathConstraintPose: NSObject { @@ -48,6 +48,7 @@ public class PathConstraintPose: NSObject { self.init(fromPointer: ptr!) } + /// The position along the path. public var position: Float { get { let result = spine_path_constraint_pose_get_position(_ptr.assumingMemoryBound(to: spine_path_constraint_pose_wrapper.self)) @@ -58,6 +59,7 @@ public class PathConstraintPose: NSObject { } } + /// The spacing between bones. public var spacing: Float { get { let result = spine_path_constraint_pose_get_spacing(_ptr.assumingMemoryBound(to: spine_path_constraint_pose_wrapper.self)) @@ -68,6 +70,7 @@ public class PathConstraintPose: NSObject { } } + /// A percentage (0-1) that controls the mix between the constrained and unconstrained rotation. public var mixRotate: Float { get { let result = spine_path_constraint_pose_get_mix_rotate(_ptr.assumingMemoryBound(to: spine_path_constraint_pose_wrapper.self)) @@ -78,6 +81,8 @@ public class PathConstraintPose: NSObject { } } + /// A percentage (0-1) that controls the mix between the constrained and unconstrained + /// translation X. public var mixX: Float { get { let result = spine_path_constraint_pose_get_mix_x(_ptr.assumingMemoryBound(to: spine_path_constraint_pose_wrapper.self)) @@ -88,6 +93,8 @@ public class PathConstraintPose: NSObject { } } + /// A percentage (0-1) that controls the mix between the constrained and unconstrained + /// translation Y. public var mixY: Float { get { let result = spine_path_constraint_pose_get_mix_y(_ptr.assumingMemoryBound(to: spine_path_constraint_pose_wrapper.self)) diff --git a/spine-ios/Sources/SpineSwift/Generated/path_constraint_position_timeline.swift b/spine-ios/Sources/SpineSwift/Generated/path_constraint_position_timeline.swift index e73ce7e5b..ddab59d11 100644 --- a/spine-ios/Sources/SpineSwift/Generated/path_constraint_position_timeline.swift +++ b/spine-ios/Sources/SpineSwift/Generated/path_constraint_position_timeline.swift @@ -32,7 +32,7 @@ import Foundation import SpineC -/// PathConstraintPositionTimeline wrapper +/// Changes a path constraint's PathConstraintPose::getPosition(). @objc(SpinePathConstraintPositionTimeline) @objcMembers public class PathConstraintPositionTimeline: ConstraintTimeline1 { diff --git a/spine-ios/Sources/SpineSwift/Generated/path_constraint_spacing_timeline.swift b/spine-ios/Sources/SpineSwift/Generated/path_constraint_spacing_timeline.swift index d09f0b3fc..31d080211 100644 --- a/spine-ios/Sources/SpineSwift/Generated/path_constraint_spacing_timeline.swift +++ b/spine-ios/Sources/SpineSwift/Generated/path_constraint_spacing_timeline.swift @@ -32,7 +32,7 @@ import Foundation import SpineC -/// PathConstraintSpacingTimeline wrapper +/// Changes a path constraint's PathConstraintPose::getSpacing(). @objc(SpinePathConstraintSpacingTimeline) @objcMembers public class PathConstraintSpacingTimeline: ConstraintTimeline1 { diff --git a/spine-ios/Sources/SpineSwift/Generated/physics_constraint.swift b/spine-ios/Sources/SpineSwift/Generated/physics_constraint.swift index fd66bf481..5fda3c4e3 100644 --- a/spine-ios/Sources/SpineSwift/Generated/physics_constraint.swift +++ b/spine-ios/Sources/SpineSwift/Generated/physics_constraint.swift @@ -46,6 +46,7 @@ public class PhysicsConstraint: PhysicsConstraintBase { self.init(fromPointer: ptr!) } + /// The bone constrained by this physics constraint. public var bone: BonePose { get { let result = spine_physics_constraint_get_bone(_ptr.assumingMemoryBound(to: spine_physics_constraint_wrapper.self)) @@ -65,10 +66,14 @@ public class PhysicsConstraint: PhysicsConstraintBase { spine_physics_constraint_reset(_ptr.assumingMemoryBound(to: spine_physics_constraint_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self)) } + /// Translates the physics constraint so next update() forces are applied as if the bone moved + /// an additional amount in world space. public func translate(_ x: Float, _ y: Float) { spine_physics_constraint_translate(_ptr.assumingMemoryBound(to: spine_physics_constraint_wrapper.self), x, y) } + /// Rotates the physics constraint so next update() forces are applied as if the bone rotated + /// around the specified point in world space. public func rotate(_ x: Float, _ y: Float, _ degrees: Float) { spine_physics_constraint_rotate(_ptr.assumingMemoryBound(to: spine_physics_constraint_wrapper.self), x, y, degrees) } diff --git a/spine-ios/Sources/SpineSwift/Generated/physics_constraint_base.swift b/spine-ios/Sources/SpineSwift/Generated/physics_constraint_base.swift index 3f497b3fe..0512d8f97 100644 --- a/spine-ios/Sources/SpineSwift/Generated/physics_constraint_base.swift +++ b/spine-ios/Sources/SpineSwift/Generated/physics_constraint_base.swift @@ -32,7 +32,10 @@ import Foundation import SpineC -/// PhysicsConstraintBase wrapper +/// Stores the current pose for a physics constraint. A physics constraint applies physics to bones. +/// +/// See https://esotericsoftware.com/spine-physics-constraints Physics constraints in the Spine User +/// Guide. Non-exported base class that inherits from the template @objc(SpinePhysicsConstraintBase) @objcMembers open class PhysicsConstraintBase: PosedActive, Posed, Constraint { @@ -83,6 +86,7 @@ open class PhysicsConstraintBase: PosedActive, Posed, Constraint { spine_physics_constraint_base_sort(_ptr.assumingMemoryBound(to: spine_physics_constraint_base_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self)) } + /// Inherited from Update public func update(_ skeleton: Skeleton, _ physics: Physics) { spine_physics_constraint_base_update(_ptr.assumingMemoryBound(to: spine_physics_constraint_base_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self), spine_physics(rawValue: UInt32(physics.rawValue))) } diff --git a/spine-ios/Sources/SpineSwift/Generated/physics_constraint_damping_timeline.swift b/spine-ios/Sources/SpineSwift/Generated/physics_constraint_damping_timeline.swift index 644b6d962..39bf030de 100644 --- a/spine-ios/Sources/SpineSwift/Generated/physics_constraint_damping_timeline.swift +++ b/spine-ios/Sources/SpineSwift/Generated/physics_constraint_damping_timeline.swift @@ -32,7 +32,7 @@ import Foundation import SpineC -/// PhysicsConstraintDampingTimeline wrapper +/// Changes a physics constraint's PhysicsConstraintPose::getDamping(). @objc(SpinePhysicsConstraintDampingTimeline) @objcMembers public class PhysicsConstraintDampingTimeline: PhysicsConstraintTimeline { diff --git a/spine-ios/Sources/SpineSwift/Generated/physics_constraint_data.swift b/spine-ios/Sources/SpineSwift/Generated/physics_constraint_data.swift index 008ccb5b6..6e8f7a73e 100644 --- a/spine-ios/Sources/SpineSwift/Generated/physics_constraint_data.swift +++ b/spine-ios/Sources/SpineSwift/Generated/physics_constraint_data.swift @@ -32,7 +32,10 @@ import Foundation import SpineC -/// PhysicsConstraintData wrapper +/// Stores the setup pose for a PhysicsConstraint. +/// +/// See https://esotericsoftware.com/spine-physics-constraints Physics constraints in the Spine User +/// Guide. @objc(SpinePhysicsConstraintData) @objcMembers public class PhysicsConstraintData: PosedData, ConstraintData { @@ -51,6 +54,7 @@ public class PhysicsConstraintData: PosedData, ConstraintData { return Rtti(fromPointer: result!) } + /// The bone constrained by this physics constraint. public var bone: BoneData { get { let result = spine_physics_constraint_data_get_bone(_ptr.assumingMemoryBound(to: spine_physics_constraint_data_wrapper.self)) diff --git a/spine-ios/Sources/SpineSwift/Generated/physics_constraint_gravity_timeline.swift b/spine-ios/Sources/SpineSwift/Generated/physics_constraint_gravity_timeline.swift index 4f85a8cb1..4c8740aea 100644 --- a/spine-ios/Sources/SpineSwift/Generated/physics_constraint_gravity_timeline.swift +++ b/spine-ios/Sources/SpineSwift/Generated/physics_constraint_gravity_timeline.swift @@ -32,7 +32,7 @@ import Foundation import SpineC -/// PhysicsConstraintGravityTimeline wrapper +/// Changes a physics constraint's PhysicsConstraintPose::getGravity(). @objc(SpinePhysicsConstraintGravityTimeline) @objcMembers public class PhysicsConstraintGravityTimeline: PhysicsConstraintTimeline { diff --git a/spine-ios/Sources/SpineSwift/Generated/physics_constraint_inertia_timeline.swift b/spine-ios/Sources/SpineSwift/Generated/physics_constraint_inertia_timeline.swift index a8a8706e1..180e73af7 100644 --- a/spine-ios/Sources/SpineSwift/Generated/physics_constraint_inertia_timeline.swift +++ b/spine-ios/Sources/SpineSwift/Generated/physics_constraint_inertia_timeline.swift @@ -32,7 +32,7 @@ import Foundation import SpineC -/// PhysicsConstraintInertiaTimeline wrapper +/// Changes a physics constraint's PhysicsConstraintPose::getInertia(). @objc(SpinePhysicsConstraintInertiaTimeline) @objcMembers public class PhysicsConstraintInertiaTimeline: PhysicsConstraintTimeline { diff --git a/spine-ios/Sources/SpineSwift/Generated/physics_constraint_mass_timeline.swift b/spine-ios/Sources/SpineSwift/Generated/physics_constraint_mass_timeline.swift index 11d752aa3..9ccfb3cac 100644 --- a/spine-ios/Sources/SpineSwift/Generated/physics_constraint_mass_timeline.swift +++ b/spine-ios/Sources/SpineSwift/Generated/physics_constraint_mass_timeline.swift @@ -32,7 +32,8 @@ import Foundation import SpineC -/// PhysicsConstraintMassTimeline wrapper +/// Changes a physics constraint's PhysicsConstraintPose::getMassInverse(). The timeline values are +/// not inverted. @objc(SpinePhysicsConstraintMassTimeline) @objcMembers public class PhysicsConstraintMassTimeline: PhysicsConstraintTimeline { diff --git a/spine-ios/Sources/SpineSwift/Generated/physics_constraint_mix_timeline.swift b/spine-ios/Sources/SpineSwift/Generated/physics_constraint_mix_timeline.swift index ba46846a6..5aff3fed2 100644 --- a/spine-ios/Sources/SpineSwift/Generated/physics_constraint_mix_timeline.swift +++ b/spine-ios/Sources/SpineSwift/Generated/physics_constraint_mix_timeline.swift @@ -32,7 +32,7 @@ import Foundation import SpineC -/// PhysicsConstraintMixTimeline wrapper +/// Changes a physics constraint's PhysicsConstraintPose::getMix(). @objc(SpinePhysicsConstraintMixTimeline) @objcMembers public class PhysicsConstraintMixTimeline: PhysicsConstraintTimeline { diff --git a/spine-ios/Sources/SpineSwift/Generated/physics_constraint_pose.swift b/spine-ios/Sources/SpineSwift/Generated/physics_constraint_pose.swift index 5328abec5..8fca2c5e0 100644 --- a/spine-ios/Sources/SpineSwift/Generated/physics_constraint_pose.swift +++ b/spine-ios/Sources/SpineSwift/Generated/physics_constraint_pose.swift @@ -32,7 +32,7 @@ import Foundation import SpineC -/// PhysicsConstraintPose wrapper +/// Stores a pose for a physics constraint. @objc(SpinePhysicsConstraintPose) @objcMembers public class PhysicsConstraintPose: NSObject { @@ -108,6 +108,7 @@ public class PhysicsConstraintPose: NSObject { } } + /// A percentage (0-1) that controls the mix between the constrained and unconstrained poses. public var mix: Float { get { let result = spine_physics_constraint_pose_get_mix(_ptr.assumingMemoryBound(to: spine_physics_constraint_pose_wrapper.self)) diff --git a/spine-ios/Sources/SpineSwift/Generated/physics_constraint_reset_timeline.swift b/spine-ios/Sources/SpineSwift/Generated/physics_constraint_reset_timeline.swift index 48f38a095..e9631feea 100644 --- a/spine-ios/Sources/SpineSwift/Generated/physics_constraint_reset_timeline.swift +++ b/spine-ios/Sources/SpineSwift/Generated/physics_constraint_reset_timeline.swift @@ -32,7 +32,7 @@ import Foundation import SpineC -/// PhysicsConstraintResetTimeline wrapper +/// Resets a physics constraint when specific animation times are reached. @objc(SpinePhysicsConstraintResetTimeline) @objcMembers public class PhysicsConstraintResetTimeline: Timeline, ConstraintTimeline { @@ -41,6 +41,7 @@ public class PhysicsConstraintResetTimeline: Timeline, ConstraintTimeline { super.init(fromPointer: UnsafeMutableRawPointer(ptr).assumingMemoryBound(to: spine_timeline_wrapper.self)) } + /// - Parameter constraintIndex: -1 for all physics constraints in the skeleton. public convenience init(_ frameCount: Int, _ constraintIndex: Int32) { let ptr = spine_physics_constraint_reset_timeline_create(frameCount, constraintIndex) self.init(fromPointer: ptr!) @@ -56,6 +57,7 @@ public class PhysicsConstraintResetTimeline: Timeline, ConstraintTimeline { } } + /// Sets the time for the specified frame. public func setFrame(_ frame: Int32, _ time: Float) { spine_physics_constraint_reset_timeline_set_frame(_ptr.assumingMemoryBound(to: spine_physics_constraint_reset_timeline_wrapper.self), frame, time) } diff --git a/spine-ios/Sources/SpineSwift/Generated/physics_constraint_strength_timeline.swift b/spine-ios/Sources/SpineSwift/Generated/physics_constraint_strength_timeline.swift index e02c176d6..ea487ab11 100644 --- a/spine-ios/Sources/SpineSwift/Generated/physics_constraint_strength_timeline.swift +++ b/spine-ios/Sources/SpineSwift/Generated/physics_constraint_strength_timeline.swift @@ -32,7 +32,7 @@ import Foundation import SpineC -/// PhysicsConstraintStrengthTimeline wrapper +/// Changes a physics constraint's PhysicsConstraintPose::getStrength(). @objc(SpinePhysicsConstraintStrengthTimeline) @objcMembers public class PhysicsConstraintStrengthTimeline: PhysicsConstraintTimeline { diff --git a/spine-ios/Sources/SpineSwift/Generated/physics_constraint_timeline.swift b/spine-ios/Sources/SpineSwift/Generated/physics_constraint_timeline.swift index 01e15d40c..24ba84657 100644 --- a/spine-ios/Sources/SpineSwift/Generated/physics_constraint_timeline.swift +++ b/spine-ios/Sources/SpineSwift/Generated/physics_constraint_timeline.swift @@ -32,7 +32,7 @@ import Foundation import SpineC -/// PhysicsConstraintTimeline wrapper +/// The base class for most PhysicsConstraint timelines. @objc(SpinePhysicsConstraintTimeline) @objcMembers open class PhysicsConstraintTimeline: CurveTimeline1, ConstraintTimeline { diff --git a/spine-ios/Sources/SpineSwift/Generated/physics_constraint_wind_timeline.swift b/spine-ios/Sources/SpineSwift/Generated/physics_constraint_wind_timeline.swift index b32d55b8f..14c10dfd0 100644 --- a/spine-ios/Sources/SpineSwift/Generated/physics_constraint_wind_timeline.swift +++ b/spine-ios/Sources/SpineSwift/Generated/physics_constraint_wind_timeline.swift @@ -32,7 +32,7 @@ import Foundation import SpineC -/// PhysicsConstraintWindTimeline wrapper +/// Changes a physics constraint's PhysicsConstraintPose::getWind(). @objc(SpinePhysicsConstraintWindTimeline) @objcMembers public class PhysicsConstraintWindTimeline: PhysicsConstraintTimeline { diff --git a/spine-ios/Sources/SpineSwift/Generated/point_attachment.swift b/spine-ios/Sources/SpineSwift/Generated/point_attachment.swift index b6efaa9b1..12b51ba67 100644 --- a/spine-ios/Sources/SpineSwift/Generated/point_attachment.swift +++ b/spine-ios/Sources/SpineSwift/Generated/point_attachment.swift @@ -32,7 +32,11 @@ import Foundation import SpineC -/// PointAttachment wrapper +/// An attachment which is a single point and a rotation. This can be used to spawn projectiles, +/// particles, etc. A bone can be used in similar ways, but a PointAttachment is slightly less +/// expensive to compute and can be hidden, shown, and placed in a skin. +/// +/// See https://esotericsoftware.com/spine-points for Point Attachments in the Spine User Guide. @objc(SpinePointAttachment) @objcMembers public class PointAttachment: Attachment { diff --git a/spine-ios/Sources/SpineSwift/Generated/posed_active.swift b/spine-ios/Sources/SpineSwift/Generated/posed_active.swift index 23b611f6d..ddf104547 100644 --- a/spine-ios/Sources/SpineSwift/Generated/posed_active.swift +++ b/spine-ios/Sources/SpineSwift/Generated/posed_active.swift @@ -32,7 +32,7 @@ import Foundation import SpineC -/// PosedActive wrapper +/// Simple mixin class that adds active state tracking @objc(SpinePosedActive) @objcMembers open class PosedActive: NSObject { diff --git a/spine-ios/Sources/SpineSwift/Generated/posed_data.swift b/spine-ios/Sources/SpineSwift/Generated/posed_data.swift index 525148c5e..a419e9938 100644 --- a/spine-ios/Sources/SpineSwift/Generated/posed_data.swift +++ b/spine-ios/Sources/SpineSwift/Generated/posed_data.swift @@ -48,11 +48,17 @@ public class PosedData: NSObject { self.init(fromPointer: ptr!) } + /// The constraint's name, which is unique across all constraints in the skeleton of the same + /// type. public var name: String { let result = spine_posed_data_get_name(_ptr.assumingMemoryBound(to: spine_posed_data_wrapper.self)) return String(cString: result!) } + /// When true, Skeleton::updateWorldTransform(Physics) only updates this constraint if the + /// Skeleton::getSkin() contains this constraint. + /// + /// See Skin::getConstraints(). public var skinRequired: Bool { get { let result = spine_posed_data_get_skin_required(_ptr.assumingMemoryBound(to: spine_posed_data_wrapper.self)) diff --git a/spine-ios/Sources/SpineSwift/Generated/region_attachment.swift b/spine-ios/Sources/SpineSwift/Generated/region_attachment.swift index 71f7444e1..b9eb64857 100644 --- a/spine-ios/Sources/SpineSwift/Generated/region_attachment.swift +++ b/spine-ios/Sources/SpineSwift/Generated/region_attachment.swift @@ -32,7 +32,7 @@ import Foundation import SpineC -/// RegionAttachment wrapper +/// Attachment that displays a texture region. @objc(SpineRegionAttachment) @objcMembers public class RegionAttachment: Attachment { diff --git a/spine-ios/Sources/SpineSwift/Generated/rgb2_timeline.swift b/spine-ios/Sources/SpineSwift/Generated/rgb2_timeline.swift index b588b1bfc..0f2c6fd71 100644 --- a/spine-ios/Sources/SpineSwift/Generated/rgb2_timeline.swift +++ b/spine-ios/Sources/SpineSwift/Generated/rgb2_timeline.swift @@ -32,7 +32,8 @@ import Foundation import SpineC -/// Rgb2Timeline wrapper +/// Changes the RGB for a slot's SlotPose::getColor() and SlotPose::getDarkColor() for two color +/// tinting. @objc(SpineRgb2Timeline) @objcMembers public class Rgb2Timeline: SlotCurveTimeline { @@ -46,6 +47,10 @@ public class Rgb2Timeline: SlotCurveTimeline { self.init(fromPointer: ptr!) } + /// Sets the time, light color, and dark color for the specified frame. + /// + /// - Parameter frame: Between 0 and frameCount, inclusive. + /// - Parameter time: The frame time in seconds. public func setFrame(_ frame: Int32, _ time: Float, _ r: Float, _ g: Float, _ b: Float, _ r2: Float, _ g2: Float, _ b2: Float) { spine_rgb2_timeline_set_frame(_ptr.assumingMemoryBound(to: spine_rgb2_timeline_wrapper.self), frame, time, r, g, b, r2, g2, b2) } diff --git a/spine-ios/Sources/SpineSwift/Generated/rgb_timeline.swift b/spine-ios/Sources/SpineSwift/Generated/rgb_timeline.swift index 36dce83db..46d9cae4d 100644 --- a/spine-ios/Sources/SpineSwift/Generated/rgb_timeline.swift +++ b/spine-ios/Sources/SpineSwift/Generated/rgb_timeline.swift @@ -32,7 +32,7 @@ import Foundation import SpineC -/// RgbTimeline wrapper +/// Changes the RGB for a slot's SlotPose::getColor(). @objc(SpineRgbTimeline) @objcMembers public class RgbTimeline: SlotCurveTimeline { @@ -46,6 +46,10 @@ public class RgbTimeline: SlotCurveTimeline { self.init(fromPointer: ptr!) } + /// Sets the time and color for the specified frame. + /// + /// - Parameter frame: Between 0 and frameCount, inclusive. + /// - Parameter time: The frame time in seconds. public func setFrame(_ frame: Int32, _ time: Float, _ r: Float, _ g: Float, _ b: Float) { spine_rgb_timeline_set_frame(_ptr.assumingMemoryBound(to: spine_rgb_timeline_wrapper.self), frame, time, r, g, b) } diff --git a/spine-ios/Sources/SpineSwift/Generated/rgba2_timeline.swift b/spine-ios/Sources/SpineSwift/Generated/rgba2_timeline.swift index b0dd4f883..26a0c3010 100644 --- a/spine-ios/Sources/SpineSwift/Generated/rgba2_timeline.swift +++ b/spine-ios/Sources/SpineSwift/Generated/rgba2_timeline.swift @@ -32,7 +32,7 @@ import Foundation import SpineC -/// Rgba2Timeline wrapper +/// Changes a slot's SlotPose::getColor() and SlotPose::getDarkColor() for two color tinting. @objc(SpineRgba2Timeline) @objcMembers public class Rgba2Timeline: SlotCurveTimeline { @@ -46,6 +46,10 @@ public class Rgba2Timeline: SlotCurveTimeline { self.init(fromPointer: ptr!) } + /// Sets the time, light color, and dark color for the specified frame. + /// + /// - Parameter frame: Between 0 and frameCount, inclusive. + /// - Parameter time: The frame time in seconds. public func setFrame(_ frame: Int32, _ time: Float, _ r: Float, _ g: Float, _ b: Float, _ a: Float, _ r2: Float, _ g2: Float, _ b2: Float) { spine_rgba2_timeline_set_frame(_ptr.assumingMemoryBound(to: spine_rgba2_timeline_wrapper.self), frame, time, r, g, b, a, r2, g2, b2) } diff --git a/spine-ios/Sources/SpineSwift/Generated/rgba_timeline.swift b/spine-ios/Sources/SpineSwift/Generated/rgba_timeline.swift index b2bc3ef95..5ccf74c86 100644 --- a/spine-ios/Sources/SpineSwift/Generated/rgba_timeline.swift +++ b/spine-ios/Sources/SpineSwift/Generated/rgba_timeline.swift @@ -32,7 +32,7 @@ import Foundation import SpineC -/// RgbaTimeline wrapper +/// Changes a slot's SlotPose::getColor(). @objc(SpineRgbaTimeline) @objcMembers public class RgbaTimeline: SlotCurveTimeline { @@ -46,6 +46,10 @@ public class RgbaTimeline: SlotCurveTimeline { self.init(fromPointer: ptr!) } + /// Sets the time and color for the specified frame. + /// + /// - Parameter frame: Between 0 and frameCount, inclusive. + /// - Parameter time: The frame time in seconds. public func setFrame(_ frame: Int32, _ time: Float, _ r: Float, _ g: Float, _ b: Float, _ a: Float) { spine_rgba_timeline_set_frame(_ptr.assumingMemoryBound(to: spine_rgba_timeline_wrapper.self), frame, time, r, g, b, a) } diff --git a/spine-ios/Sources/SpineSwift/Generated/rotate_timeline.swift b/spine-ios/Sources/SpineSwift/Generated/rotate_timeline.swift index 660e9cff2..1271d7650 100644 --- a/spine-ios/Sources/SpineSwift/Generated/rotate_timeline.swift +++ b/spine-ios/Sources/SpineSwift/Generated/rotate_timeline.swift @@ -32,7 +32,7 @@ import Foundation import SpineC -/// RotateTimeline wrapper +/// Changes a bone's local rotation. @objc(SpineRotateTimeline) @objcMembers public class RotateTimeline: BoneTimeline1 { diff --git a/spine-ios/Sources/SpineSwift/Generated/scale_timeline.swift b/spine-ios/Sources/SpineSwift/Generated/scale_timeline.swift index 5de42fb4c..ec229763b 100644 --- a/spine-ios/Sources/SpineSwift/Generated/scale_timeline.swift +++ b/spine-ios/Sources/SpineSwift/Generated/scale_timeline.swift @@ -32,7 +32,7 @@ import Foundation import SpineC -/// ScaleTimeline wrapper +/// Changes a bone's local BoneLocal::getScaleX() and BoneLocal::getScaleY(). @objc(SpineScaleTimeline) @objcMembers public class ScaleTimeline: BoneTimeline2 { diff --git a/spine-ios/Sources/SpineSwift/Generated/scale_x_timeline.swift b/spine-ios/Sources/SpineSwift/Generated/scale_x_timeline.swift index f823e809a..794cb3b83 100644 --- a/spine-ios/Sources/SpineSwift/Generated/scale_x_timeline.swift +++ b/spine-ios/Sources/SpineSwift/Generated/scale_x_timeline.swift @@ -32,7 +32,7 @@ import Foundation import SpineC -/// ScaleXTimeline wrapper +/// Changes a bone's local BoneLocal::getScaleX(). @objc(SpineScaleXTimeline) @objcMembers public class ScaleXTimeline: BoneTimeline1 { diff --git a/spine-ios/Sources/SpineSwift/Generated/scale_y_timeline.swift b/spine-ios/Sources/SpineSwift/Generated/scale_y_timeline.swift index f3ea817cc..4762a844e 100644 --- a/spine-ios/Sources/SpineSwift/Generated/scale_y_timeline.swift +++ b/spine-ios/Sources/SpineSwift/Generated/scale_y_timeline.swift @@ -32,7 +32,7 @@ import Foundation import SpineC -/// ScaleYTimeline wrapper +/// Changes a bone's local BoneLocal::getScaleY(). @objc(SpineScaleYTimeline) @objcMembers public class ScaleYTimeline: BoneTimeline1 { diff --git a/spine-ios/Sources/SpineSwift/Generated/sequence_timeline.swift b/spine-ios/Sources/SpineSwift/Generated/sequence_timeline.swift index fc692ddeb..0ae4a295b 100644 --- a/spine-ios/Sources/SpineSwift/Generated/sequence_timeline.swift +++ b/spine-ios/Sources/SpineSwift/Generated/sequence_timeline.swift @@ -32,7 +32,7 @@ import Foundation import SpineC -/// SequenceTimeline wrapper +/// Changes a slot's SlotPose::getSequenceIndex() for an attachment's Sequence. @objc(SpineSequenceTimeline) @objcMembers public class SequenceTimeline: Timeline, SlotTimeline { @@ -84,6 +84,10 @@ public class SequenceTimeline: Timeline, SlotTimeline { } } + /// Sets the time, mode, index, and frame time for the specified frame. + /// + /// - Parameter frame: Between 0 and frameCount, inclusive. + /// - Parameter delay: Seconds between frames. public func setFrame(_ frame: Int32, _ time: Float, _ mode: SequenceMode, _ index: Int32, _ delay: Float) { spine_sequence_timeline_set_frame(_ptr.assumingMemoryBound(to: spine_sequence_timeline_wrapper.self), frame, time, spine_sequence_mode(rawValue: UInt32(mode.rawValue)), index, delay) } diff --git a/spine-ios/Sources/SpineSwift/Generated/shear_timeline.swift b/spine-ios/Sources/SpineSwift/Generated/shear_timeline.swift index aaa2e8620..61bc32817 100644 --- a/spine-ios/Sources/SpineSwift/Generated/shear_timeline.swift +++ b/spine-ios/Sources/SpineSwift/Generated/shear_timeline.swift @@ -32,7 +32,7 @@ import Foundation import SpineC -/// ShearTimeline wrapper +/// Changes a bone's local BoneLocal::getShearX() and BoneLocal::getShearY(). @objc(SpineShearTimeline) @objcMembers public class ShearTimeline: BoneTimeline2 { diff --git a/spine-ios/Sources/SpineSwift/Generated/shear_x_timeline.swift b/spine-ios/Sources/SpineSwift/Generated/shear_x_timeline.swift index a14435d68..15a818a96 100644 --- a/spine-ios/Sources/SpineSwift/Generated/shear_x_timeline.swift +++ b/spine-ios/Sources/SpineSwift/Generated/shear_x_timeline.swift @@ -32,7 +32,7 @@ import Foundation import SpineC -/// ShearXTimeline wrapper +/// Changes a bone's local BoneLocal::getShearX(). @objc(SpineShearXTimeline) @objcMembers public class ShearXTimeline: BoneTimeline1 { diff --git a/spine-ios/Sources/SpineSwift/Generated/shear_y_timeline.swift b/spine-ios/Sources/SpineSwift/Generated/shear_y_timeline.swift index 2232c1dd6..7a2e7ead7 100644 --- a/spine-ios/Sources/SpineSwift/Generated/shear_y_timeline.swift +++ b/spine-ios/Sources/SpineSwift/Generated/shear_y_timeline.swift @@ -32,7 +32,7 @@ import Foundation import SpineC -/// ShearYTimeline wrapper +/// Changes a bone's local BoneLocal::getShearY(). @objc(SpineShearYTimeline) @objcMembers public class ShearYTimeline: BoneTimeline1 { diff --git a/spine-ios/Sources/SpineSwift/Generated/skeleton_bounds.swift b/spine-ios/Sources/SpineSwift/Generated/skeleton_bounds.swift index 0a7bead09..7af2f559f 100644 --- a/spine-ios/Sources/SpineSwift/Generated/skeleton_bounds.swift +++ b/spine-ios/Sources/SpineSwift/Generated/skeleton_bounds.swift @@ -32,7 +32,9 @@ import Foundation import SpineC -/// SkeletonBounds wrapper +/// Collects each BoundingBoxAttachment that is visible and computes the world vertices for its +/// polygon. The polygon vertices are provided along with convenience methods for doing hit +/// detection. @objc(SpineSkeletonBounds) @objcMembers public class SkeletonBounds: NSObject { @@ -48,90 +50,118 @@ public class SkeletonBounds: NSObject { self.init(fromPointer: ptr!) } + /// Returns all polygons or an empty array. Requires a call to update() first. public var polygons: ArrayPolygon { let result = spine_skeleton_bounds_get_polygons(_ptr.assumingMemoryBound(to: spine_skeleton_bounds_wrapper.self)) return ArrayPolygon(fromPointer: result!) } + /// Returns all bounding boxes. Requires a call to update() first. public var boundingBoxes: ArrayBoundingBoxAttachment { let result = spine_skeleton_bounds_get_bounding_boxes(_ptr.assumingMemoryBound(to: spine_skeleton_bounds_wrapper.self)) return ArrayBoundingBoxAttachment(fromPointer: result!) } + /// The left edge of the axis aligned bounding box. public var minX: Float { let result = spine_skeleton_bounds_get_min_x(_ptr.assumingMemoryBound(to: spine_skeleton_bounds_wrapper.self)) return result } + /// The bottom edge of the axis aligned bounding box. public var minY: Float { let result = spine_skeleton_bounds_get_min_y(_ptr.assumingMemoryBound(to: spine_skeleton_bounds_wrapper.self)) return result } + /// The right edge of the axis aligned bounding box. public var maxX: Float { let result = spine_skeleton_bounds_get_max_x(_ptr.assumingMemoryBound(to: spine_skeleton_bounds_wrapper.self)) return result } + /// The top edge of the axis aligned bounding box. public var maxY: Float { let result = spine_skeleton_bounds_get_max_y(_ptr.assumingMemoryBound(to: spine_skeleton_bounds_wrapper.self)) return result } + /// The width of the axis aligned bounding box. public var width: Float { let result = spine_skeleton_bounds_get_width(_ptr.assumingMemoryBound(to: spine_skeleton_bounds_wrapper.self)) return result } + /// The height of the axis aligned bounding box. public var height: Float { let result = spine_skeleton_bounds_get_height(_ptr.assumingMemoryBound(to: spine_skeleton_bounds_wrapper.self)) return result } + /// Clears any previous polygons, finds all visible bounding box attachments, and computes the + /// world vertices for each bounding box's polygon. + /// + /// - Parameter skeleton: The skeleton. + /// - Parameter updateAabb: If true, the axis aligned bounding box containing all the polygons is computed. If false, the SkeletonBounds AABB methods will always return true. public func update(_ skeleton: Skeleton, _ updateAabb: Bool) { spine_skeleton_bounds_update(_ptr.assumingMemoryBound(to: spine_skeleton_bounds_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self), updateAabb) } + /// Returns true if the axis aligned bounding box contains the point. public func aabbContainsPoint(_ x: Float, _ y: Float) -> Bool { let result = spine_skeleton_bounds_aabb_contains_point(_ptr.assumingMemoryBound(to: spine_skeleton_bounds_wrapper.self), x, y) return result } + /// Returns true if the axis aligned bounding box intersects the line segment. public func aabbIntersectsSegment(_ x1: Float, _ y1: Float, _ x2: Float, _ y2: Float) -> Bool { let result = spine_skeleton_bounds_aabb_intersects_segment(_ptr.assumingMemoryBound(to: spine_skeleton_bounds_wrapper.self), x1, y1, x2, y2) return result } + /// Returns true if the axis aligned bounding box intersects the axis aligned bounding box of + /// the specified bounds. public func aabbIntersectsSkeleton(_ bounds: SkeletonBounds) -> Bool { let result = spine_skeleton_bounds_aabb_intersects_skeleton(_ptr.assumingMemoryBound(to: spine_skeleton_bounds_wrapper.self), bounds._ptr.assumingMemoryBound(to: spine_skeleton_bounds_wrapper.self)) return result } + /// Returns the polygon for the given bounding box attachment or null if no polygon can be found + /// for the attachment. Requires a call to update() first. public func getPolygon(_ attachment: BoundingBoxAttachment?) -> Polygon? { let result = spine_skeleton_bounds_get_polygon(_ptr.assumingMemoryBound(to: spine_skeleton_bounds_wrapper.self), attachment?._ptr.assumingMemoryBound(to: spine_bounding_box_attachment_wrapper.self)) return result.map { Polygon(fromPointer: $0) } } + /// Returns the bounding box for the given polygon or null. Requires a call to update() first. public func getBoundingBox(_ polygon: Polygon?) -> BoundingBoxAttachment? { let result = spine_skeleton_bounds_get_bounding_box(_ptr.assumingMemoryBound(to: spine_skeleton_bounds_wrapper.self), polygon?._ptr.assumingMemoryBound(to: spine_polygon_wrapper.self)) return result.map { BoundingBoxAttachment(fromPointer: $0) } } + /// Returns true if the polygon contains the point. public func containsPoint(_ polygon: Polygon, _ x: Float, _ y: Float) -> Bool { let result = spine_skeleton_bounds_contains_point_1(_ptr.assumingMemoryBound(to: spine_skeleton_bounds_wrapper.self), polygon._ptr.assumingMemoryBound(to: spine_polygon_wrapper.self), x, y) return result } + /// Returns the first bounding box attachment that contains the point, or null. When doing many + /// checks, it is usually more efficient to only call this method if aabbContainsPoint(float, + /// float) returns true. public func containsPoint2(_ x: Float, _ y: Float) -> BoundingBoxAttachment? { let result = spine_skeleton_bounds_contains_point_2(_ptr.assumingMemoryBound(to: spine_skeleton_bounds_wrapper.self), x, y) return result.map { BoundingBoxAttachment(fromPointer: $0) } } + /// Returns the first bounding box attachment that contains any part of the line segment, or + /// null. When doing many checks, it is usually more efficient to only call this method if + /// aabbIntersectsSegment(float, float, float, float) returns true. public func intersectsSegment(_ x1: Float, _ y1: Float, _ x2: Float, _ y2: Float) -> BoundingBoxAttachment? { let result = spine_skeleton_bounds_intersects_segment_1(_ptr.assumingMemoryBound(to: spine_skeleton_bounds_wrapper.self), x1, y1, x2, y2) return result.map { BoundingBoxAttachment(fromPointer: $0) } } + /// Returns true if the polygon contains any part of the line segment. public func intersectsSegment2(_ polygon: Polygon, _ x1: Float, _ y1: Float, _ x2: Float, _ y2: Float) -> Bool { let result = spine_skeleton_bounds_intersects_segment_2(_ptr.assumingMemoryBound(to: spine_skeleton_bounds_wrapper.self), polygon._ptr.assumingMemoryBound(to: spine_polygon_wrapper.self), x1, y1, x2, y2) return result diff --git a/spine-ios/Sources/SpineSwift/Generated/skeleton_data.swift b/spine-ios/Sources/SpineSwift/Generated/skeleton_data.swift index 10a19dcaa..406e49995 100644 --- a/spine-ios/Sources/SpineSwift/Generated/skeleton_data.swift +++ b/spine-ios/Sources/SpineSwift/Generated/skeleton_data.swift @@ -32,7 +32,9 @@ import Foundation import SpineC -/// SkeletonData wrapper +/// Stores the setup pose and all of the stateless data for a skeleton. +/// +/// See Data objects in the Spine Runtimes Guide. @objc(SpineSkeletonData) @objcMembers public class SkeletonData: NSObject { @@ -48,6 +50,8 @@ public class SkeletonData: NSObject { self.init(fromPointer: ptr!) } + /// The skeleton's name, which by default is the name of the skeleton data file when possible, + /// or null when a name hasn't been set. public var name: String { get { let result = spine_skeleton_data_get_name(_ptr.assumingMemoryBound(to: spine_skeleton_data_wrapper.self)) @@ -58,21 +62,28 @@ public class SkeletonData: NSObject { } } + /// The skeleton's bones, sorted parent first. The root bone is always the first bone. public var bones: ArrayBoneData { let result = spine_skeleton_data_get_bones(_ptr.assumingMemoryBound(to: spine_skeleton_data_wrapper.self)) return ArrayBoneData(fromPointer: result!) } + /// The skeleton's slots in the setup pose draw order. public var slots: ArraySlotData { let result = spine_skeleton_data_get_slots(_ptr.assumingMemoryBound(to: spine_skeleton_data_wrapper.self)) return ArraySlotData(fromPointer: result!) } + /// All skins, including the default skin. public var skins: ArraySkin { let result = spine_skeleton_data_get_skins(_ptr.assumingMemoryBound(to: spine_skeleton_data_wrapper.self)) return ArraySkin(fromPointer: result!) } + /// The skeleton's default skin. By default this skin contains all attachments that were not in + /// a skin in Spine. + /// + /// - Returns: May be NULL. public var defaultSkin: Skin? { get { let result = spine_skeleton_data_get_default_skin(_ptr.assumingMemoryBound(to: spine_skeleton_data_wrapper.self)) @@ -83,21 +94,25 @@ public class SkeletonData: NSObject { } } + /// The skeleton's events. public var events: ArrayEventData { let result = spine_skeleton_data_get_events(_ptr.assumingMemoryBound(to: spine_skeleton_data_wrapper.self)) return ArrayEventData(fromPointer: result!) } + /// The skeleton's animations. public var animations: ArrayAnimation { let result = spine_skeleton_data_get_animations(_ptr.assumingMemoryBound(to: spine_skeleton_data_wrapper.self)) return ArrayAnimation(fromPointer: result!) } + /// The skeleton's constraints. public var constraints: ArrayConstraintData { let result = spine_skeleton_data_get_constraints(_ptr.assumingMemoryBound(to: spine_skeleton_data_wrapper.self)) return ArrayConstraintData(fromPointer: result!) } + /// The X coordinate of the skeleton's axis aligned bounding box in the setup pose. public var x: Float { get { let result = spine_skeleton_data_get_x(_ptr.assumingMemoryBound(to: spine_skeleton_data_wrapper.self)) @@ -108,6 +123,7 @@ public class SkeletonData: NSObject { } } + /// The Y coordinate of the skeleton's axis aligned bounding box in the setup pose. public var y: Float { get { let result = spine_skeleton_data_get_y(_ptr.assumingMemoryBound(to: spine_skeleton_data_wrapper.self)) @@ -118,6 +134,7 @@ public class SkeletonData: NSObject { } } + /// The width of the skeleton's axis aligned bounding box in the setup pose. public var width: Float { get { let result = spine_skeleton_data_get_width(_ptr.assumingMemoryBound(to: spine_skeleton_data_wrapper.self)) @@ -128,6 +145,7 @@ public class SkeletonData: NSObject { } } + /// The height of the skeleton's axis aligned bounding box in the setup pose. public var height: Float { get { let result = spine_skeleton_data_get_height(_ptr.assumingMemoryBound(to: spine_skeleton_data_wrapper.self)) @@ -138,6 +156,8 @@ public class SkeletonData: NSObject { } } + /// Baseline scale factor for applying physics and other effects based on distance to + /// non-scalable properties, such as angle or scale. Default is 100. public var referenceScale: Float { get { let result = spine_skeleton_data_get_reference_scale(_ptr.assumingMemoryBound(to: spine_skeleton_data_wrapper.self)) @@ -148,6 +168,7 @@ public class SkeletonData: NSObject { } } + /// The Spine version used to export this data, or NULL. public var version: String { get { let result = spine_skeleton_data_get_version(_ptr.assumingMemoryBound(to: spine_skeleton_data_wrapper.self)) @@ -158,6 +179,7 @@ public class SkeletonData: NSObject { } } + /// The skeleton data hash. This value will change if any of the skeleton data has changed. public var hashString: String { get { let result = spine_skeleton_data_get_hash(_ptr.assumingMemoryBound(to: spine_skeleton_data_wrapper.self)) @@ -168,6 +190,8 @@ public class SkeletonData: NSObject { } } + /// The path to the images directory as defined in Spine, or null if nonessential data was not + /// exported. public var imagesPath: String { get { let result = spine_skeleton_data_get_images_path(_ptr.assumingMemoryBound(to: spine_skeleton_data_wrapper.self)) @@ -178,6 +202,8 @@ public class SkeletonData: NSObject { } } + /// The path to the audio directory as defined in Spine, or null if nonessential data was not + /// exported. public var audioPath: String { get { let result = spine_skeleton_data_get_audio_path(_ptr.assumingMemoryBound(to: spine_skeleton_data_wrapper.self)) @@ -188,6 +214,7 @@ public class SkeletonData: NSObject { } } + /// The dopesheet FPS in Spine. Available only when nonessential data was exported. public var fps: Float { get { let result = spine_skeleton_data_get_fps(_ptr.assumingMemoryBound(to: spine_skeleton_data_wrapper.self)) @@ -198,26 +225,34 @@ public class SkeletonData: NSObject { } } + /// Finds a bone by comparing each bone's name. It is more efficient to cache the results of + /// this method than to call it multiple times. + /// + /// - Returns: May be NULL. public func findBone(_ boneName: String) -> BoneData? { let result = spine_skeleton_data_find_bone(_ptr.assumingMemoryBound(to: spine_skeleton_data_wrapper.self), boneName) return result.map { BoneData(fromPointer: $0) } } + /// - Returns: May be NULL. public func findSlot(_ slotName: String) -> SlotData? { let result = spine_skeleton_data_find_slot(_ptr.assumingMemoryBound(to: spine_skeleton_data_wrapper.self), slotName) return result.map { SlotData(fromPointer: $0) } } + /// - Returns: May be NULL. public func findSkin(_ skinName: String) -> Skin? { let result = spine_skeleton_data_find_skin(_ptr.assumingMemoryBound(to: spine_skeleton_data_wrapper.self), skinName) return result.map { Skin(fromPointer: $0) } } + /// - Returns: May be NULL. public func findEvent(_ eventDataName: String) -> EventData? { let result = spine_skeleton_data_find_event(_ptr.assumingMemoryBound(to: spine_skeleton_data_wrapper.self), eventDataName) return result.map { EventData(fromPointer: $0) } } + /// - Returns: May be NULL. public func findAnimation(_ animationName: String) -> Animation? { let result = spine_skeleton_data_find_animation(_ptr.assumingMemoryBound(to: spine_skeleton_data_wrapper.self), animationName) return result.map { Animation(fromPointer: $0) } diff --git a/spine-ios/Sources/SpineSwift/Generated/slider_base.swift b/spine-ios/Sources/SpineSwift/Generated/slider_base.swift index ba640892f..19724dca0 100644 --- a/spine-ios/Sources/SpineSwift/Generated/slider_base.swift +++ b/spine-ios/Sources/SpineSwift/Generated/slider_base.swift @@ -32,7 +32,10 @@ import Foundation import SpineC -/// SliderBase wrapper +/// Stores the setup pose for a PhysicsConstraint. +/// +/// See https://esotericsoftware.com/spine-physics-constraints Physics constraints in the Spine User +/// Guide. Non-exported base class that inherits from the template @objc(SpineSliderBase) @objcMembers open class SliderBase: PosedActive, Posed, Constraint { @@ -83,6 +86,7 @@ open class SliderBase: PosedActive, Posed, Constraint { spine_slider_base_sort(_ptr.assumingMemoryBound(to: spine_slider_base_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self)) } + /// Inherited from Update public func update(_ skeleton: Skeleton, _ physics: Physics) { spine_slider_base_update(_ptr.assumingMemoryBound(to: spine_slider_base_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self), spine_physics(rawValue: UInt32(physics.rawValue))) } diff --git a/spine-ios/Sources/SpineSwift/Generated/slider_data.swift b/spine-ios/Sources/SpineSwift/Generated/slider_data.swift index 4ee17f0af..c7d973c26 100644 --- a/spine-ios/Sources/SpineSwift/Generated/slider_data.swift +++ b/spine-ios/Sources/SpineSwift/Generated/slider_data.swift @@ -32,7 +32,7 @@ import Foundation import SpineC -/// SliderData wrapper +/// Stores the setup pose for a Slider @objc(SpineSliderData) @objcMembers public class SliderData: PosedData, ConstraintData { @@ -160,6 +160,7 @@ public class SliderData: PosedData, ConstraintData { return SliderPose(fromPointer: result!) } + /// Creates a slider instance. public func createMethod(_ skeleton: Skeleton) -> Constraint { let result = spine_slider_data_create_method(_ptr.assumingMemoryBound(to: spine_slider_data_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self)) let rtti = spine_constraint_get_rtti(result!) diff --git a/spine-ios/Sources/SpineSwift/Generated/slider_mix_timeline.swift b/spine-ios/Sources/SpineSwift/Generated/slider_mix_timeline.swift index 4df32749f..5bcfedf5f 100644 --- a/spine-ios/Sources/SpineSwift/Generated/slider_mix_timeline.swift +++ b/spine-ios/Sources/SpineSwift/Generated/slider_mix_timeline.swift @@ -32,7 +32,7 @@ import Foundation import SpineC -/// SliderMixTimeline wrapper +/// Changes a slider's SliderPose::getMix(). @objc(SpineSliderMixTimeline) @objcMembers public class SliderMixTimeline: ConstraintTimeline1 { diff --git a/spine-ios/Sources/SpineSwift/Generated/slider_pose.swift b/spine-ios/Sources/SpineSwift/Generated/slider_pose.swift index 63e117468..97d22209f 100644 --- a/spine-ios/Sources/SpineSwift/Generated/slider_pose.swift +++ b/spine-ios/Sources/SpineSwift/Generated/slider_pose.swift @@ -32,7 +32,7 @@ import Foundation import SpineC -/// SliderPose wrapper +/// Stores a pose for a slider. @objc(SpineSliderPose) @objcMembers public class SliderPose: NSObject { diff --git a/spine-ios/Sources/SpineSwift/Generated/slider_timeline.swift b/spine-ios/Sources/SpineSwift/Generated/slider_timeline.swift index 614f77cf8..40feb3437 100644 --- a/spine-ios/Sources/SpineSwift/Generated/slider_timeline.swift +++ b/spine-ios/Sources/SpineSwift/Generated/slider_timeline.swift @@ -32,7 +32,7 @@ import Foundation import SpineC -/// SliderTimeline wrapper +/// Changes a slider's SliderPose::getTime(). @objc(SpineSliderTimeline) @objcMembers public class SliderTimeline: ConstraintTimeline1 { diff --git a/spine-ios/Sources/SpineSwift/Generated/slot_curve_timeline.swift b/spine-ios/Sources/SpineSwift/Generated/slot_curve_timeline.swift index 133c2d807..732101fbb 100644 --- a/spine-ios/Sources/SpineSwift/Generated/slot_curve_timeline.swift +++ b/spine-ios/Sources/SpineSwift/Generated/slot_curve_timeline.swift @@ -32,7 +32,7 @@ import Foundation import SpineC -/// SlotCurveTimeline wrapper +/// Base class for slot timelines that use curves. @objc(SpineSlotCurveTimeline) @objcMembers open class SlotCurveTimeline: CurveTimeline, SlotTimeline { diff --git a/spine-ios/Sources/SpineSwift/Generated/slot_data.swift b/spine-ios/Sources/SpineSwift/Generated/slot_data.swift index 55213ba7a..09f532081 100644 --- a/spine-ios/Sources/SpineSwift/Generated/slot_data.swift +++ b/spine-ios/Sources/SpineSwift/Generated/slot_data.swift @@ -32,7 +32,7 @@ import Foundation import SpineC -/// SlotData wrapper +/// Stores the setup pose for a Slot. @objc(SpineSlotData) @objcMembers public class SlotData: PosedData { @@ -46,16 +46,20 @@ public class SlotData: PosedData { self.init(fromPointer: ptr!) } + /// The index of the slot in Skeleton::getSlots(). public var index: Int32 { let result = spine_slot_data_get_index(_ptr.assumingMemoryBound(to: spine_slot_data_wrapper.self)) return result } + /// The bone this slot belongs to. public var boneData: BoneData { let result = spine_slot_data_get_bone_data(_ptr.assumingMemoryBound(to: spine_slot_data_wrapper.self)) return BoneData(fromPointer: result!) } + /// The name of the attachment that is visible for this slot in the setup pose, or empty if no + /// attachment is visible. public var attachmentName: String { get { let result = spine_slot_data_get_attachment_name(_ptr.assumingMemoryBound(to: spine_slot_data_wrapper.self)) @@ -66,6 +70,7 @@ public class SlotData: PosedData { } } + /// The blend mode for drawing the slot's attachment. public var blendMode: BlendMode { get { let result = spine_slot_data_get_blend_mode(_ptr.assumingMemoryBound(to: spine_slot_data_wrapper.self)) @@ -76,6 +81,8 @@ public class SlotData: PosedData { } } + /// False if the slot was hidden in Spine and nonessential data was exported. Does not affect + /// runtime rendering. public var visible: Bool { get { let result = spine_slot_data_get_visible(_ptr.assumingMemoryBound(to: spine_slot_data_wrapper.self)) diff --git a/spine-ios/Sources/SpineSwift/Generated/slot_pose.swift b/spine-ios/Sources/SpineSwift/Generated/slot_pose.swift index 530cb6572..31f994fe1 100644 --- a/spine-ios/Sources/SpineSwift/Generated/slot_pose.swift +++ b/spine-ios/Sources/SpineSwift/Generated/slot_pose.swift @@ -48,16 +48,21 @@ public class SlotPose: NSObject { self.init(fromPointer: ptr!) } + /// The color used to tint the slot's attachment. If getDarkColor() is set, this is used as the + /// light color for two color tinting. public var color: Color { let result = spine_slot_pose_get_color(_ptr.assumingMemoryBound(to: spine_slot_pose_wrapper.self)) return Color(fromPointer: result!) } + /// The dark color used to tint the slot's attachment for two color tinting. The dark color's + /// alpha is not used. public var darkColor: Color { let result = spine_slot_pose_get_dark_color(_ptr.assumingMemoryBound(to: spine_slot_pose_wrapper.self)) return Color(fromPointer: result!) } + /// Returns true if this slot has a dark color. public var hasDarkColor: Bool { get { let result = spine_slot_pose_has_dark_color(_ptr.assumingMemoryBound(to: spine_slot_pose_wrapper.self)) @@ -68,6 +73,7 @@ public class SlotPose: NSObject { } } + /// The current attachment for the slot, or null if the slot has no attachment. public var attachment: Attachment? { get { let result = spine_slot_pose_get_attachment(_ptr.assumingMemoryBound(to: spine_slot_pose_wrapper.self)) @@ -102,6 +108,8 @@ public class SlotPose: NSObject { } } + /// The index of the texture region to display when the slot's attachment has a Sequence. -1 + /// represents the Sequence::getSetupIndex(). public var sequenceIndex: Int32 { get { let result = spine_slot_pose_get_sequence_index(_ptr.assumingMemoryBound(to: spine_slot_pose_wrapper.self)) @@ -112,6 +120,11 @@ public class SlotPose: NSObject { } } + /// Values to deform the slot's attachment. For an unweighted mesh, the entries are local + /// positions for each vertex. For a weighted mesh, the entries are an offset for each vertex + /// which will be added to the mesh's local vertex positions. + /// + /// See VertexAttachment::computeWorldVertices() and DeformTimeline. public var deform: ArrayFloat { let result = spine_slot_pose_get_deform(_ptr.assumingMemoryBound(to: spine_slot_pose_wrapper.self)) return ArrayFloat(fromPointer: result!) diff --git a/spine-ios/Sources/SpineSwift/Generated/slot_timeline.swift b/spine-ios/Sources/SpineSwift/Generated/slot_timeline.swift index a083f86b2..8d8e50d5e 100644 --- a/spine-ios/Sources/SpineSwift/Generated/slot_timeline.swift +++ b/spine-ios/Sources/SpineSwift/Generated/slot_timeline.swift @@ -32,7 +32,7 @@ import Foundation import SpineC -/// SlotTimeline wrapper +/// An interface for timelines which change the property of a slot. public protocol SlotTimeline { var _ptr: UnsafeMutableRawPointer { get } var rtti: Rtti { get } diff --git a/spine-ios/Sources/SpineSwift/Generated/to_property.swift b/spine-ios/Sources/SpineSwift/Generated/to_property.swift index fba7277b7..92c6fde84 100644 --- a/spine-ios/Sources/SpineSwift/Generated/to_property.swift +++ b/spine-ios/Sources/SpineSwift/Generated/to_property.swift @@ -32,7 +32,7 @@ import Foundation import SpineC -/// ToProperty wrapper +/// Constrained property for a TransformConstraint. @objc(SpineToProperty) @objcMembers open class ToProperty: NSObject { @@ -78,11 +78,13 @@ open class ToProperty: NSObject { } } + /// Reads the mix for this property from the specified pose. public func mix(_ pose: TransformConstraintPose) -> Float { let result = spine_to_property_mix(_ptr.assumingMemoryBound(to: spine_to_property_wrapper.self), pose._ptr.assumingMemoryBound(to: spine_transform_constraint_pose_wrapper.self)) return result } + /// Applies the value to this property. public func apply(_ skeleton: Skeleton, _ pose: TransformConstraintPose, _ bone: BonePose, _ value: Float, _ local: Bool, _ additive: Bool) { spine_to_property_apply(_ptr.assumingMemoryBound(to: spine_to_property_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self), pose._ptr.assumingMemoryBound(to: spine_transform_constraint_pose_wrapper.self), bone._ptr.assumingMemoryBound(to: spine_bone_pose_wrapper.self), value, local, additive) } diff --git a/spine-ios/Sources/SpineSwift/Generated/track_entry.swift b/spine-ios/Sources/SpineSwift/Generated/track_entry.swift index 57705112c..c8dcbb882 100644 --- a/spine-ios/Sources/SpineSwift/Generated/track_entry.swift +++ b/spine-ios/Sources/SpineSwift/Generated/track_entry.swift @@ -32,7 +32,7 @@ import Foundation import SpineC -/// TrackEntry wrapper +/// State for the playback of an animation @objc(SpineTrackEntry) @objcMembers public class TrackEntry: NSObject { @@ -48,11 +48,13 @@ public class TrackEntry: NSObject { self.init(fromPointer: ptr!) } + /// The index of the track where this entry is either current or queued. public var trackIndex: Int32 { let result = spine_track_entry_get_track_index(_ptr.assumingMemoryBound(to: spine_track_entry_wrapper.self)) return result } + /// The animation to apply for this track entry. public var animation: Animation { get { let result = spine_track_entry_get_animation(_ptr.assumingMemoryBound(to: spine_track_entry_wrapper.self)) @@ -68,6 +70,8 @@ public class TrackEntry: NSObject { return result.map { TrackEntry(fromPointer: $0) } } + /// If true, the animation will repeat. If false, it will not, instead its last frame is applied + /// if played beyond its duration. public var loop: Bool { get { let result = spine_track_entry_get_loop(_ptr.assumingMemoryBound(to: spine_track_entry_wrapper.self)) @@ -78,6 +82,18 @@ public class TrackEntry: NSObject { } } + /// If true, when mixing from the previous animation to this animation, the previous animation + /// is applied as normal instead of being mixed out. + /// + /// When mixing between animations that key the same property, if a lower track also keys that + /// property then the value will briefly dip toward the lower track value during the mix. This + /// happens because the first animation mixes from 100% to 0% while the second animation mixes + /// from 0% to 100%. Setting holdPrevious to true applies the first animation at 100% during the + /// mix so the lower track value is overwritten. Such dipping does not occur on the lowest track + /// which keys the property, only when a higher track also keys the property. +/// + /// Snapping will occur if holdPrevious is true and this animation does not key all the same + /// properties as the previous animation. public var holdPrevious: Bool { get { let result = spine_track_entry_get_hold_previous(_ptr.assumingMemoryBound(to: spine_track_entry_wrapper.self)) @@ -108,6 +124,17 @@ public class TrackEntry: NSObject { } } + /// Seconds to postpone playing the animation. Must be >= 0. When this track entry is the + /// current track entry, delay postpones incrementing the getTrackTime(). When this track entry + /// is queued, delay is the time from the start of the previous animation to when this track + /// entry will become the current track entry (ie when the previous track entry getTrackTime() + /// >= this track entry's delay). + /// + /// getTimeScale() affects the delay. +/// + /// When passing delay < = 0 to AnimationState::addAnimation(int, Animation, bool, float) this + /// delay is set using a mix duration from AnimationStateData. To change the getMixDuration() + /// afterward, use setMixDuration(float, float) so this delay is adjusted. public var delay: Float { get { let result = spine_track_entry_get_delay(_ptr.assumingMemoryBound(to: spine_track_entry_wrapper.self)) @@ -118,6 +145,9 @@ public class TrackEntry: NSObject { } } + /// Current time in seconds this track entry has been the current track entry. The track time + /// determines getAnimationTime(). The track time can be set to start the animation at a time + /// other than 0, without affecting looping. public var trackTime: Float { get { let result = spine_track_entry_get_track_time(_ptr.assumingMemoryBound(to: spine_track_entry_wrapper.self)) @@ -128,6 +158,15 @@ public class TrackEntry: NSObject { } } + /// The track time in seconds when this animation will be removed from the track. Defaults to + /// the highest possible float value, meaning the animation will be applied until a new + /// animation is set or the track is cleared. If the track end time is reached, no other + /// animations are queued for playback, and mixing from any previous animations is complete, + /// then the properties keyed by the animation are set to the setup pose and the track is + /// cleared. + /// + /// It may be desired to use AnimationState::addEmptyAnimation(int, float, float) rather than + /// have the animation abruptly cease being applied. public var trackEnd: Float { get { let result = spine_track_entry_get_track_end(_ptr.assumingMemoryBound(to: spine_track_entry_wrapper.self)) @@ -138,6 +177,10 @@ public class TrackEntry: NSObject { } } + /// Seconds when this animation starts, both initially and after looping. Defaults to 0. + /// + /// When changing the animation start time, it often makes sense to set TrackEntry.AnimationLast + /// to the same value to prevent timeline keys before the start time from triggering. public var animationStart: Float { get { let result = spine_track_entry_get_animation_start(_ptr.assumingMemoryBound(to: spine_track_entry_wrapper.self)) @@ -148,6 +191,9 @@ public class TrackEntry: NSObject { } } + /// Seconds for the last frame of this animation. Non-looping animations won't play past this + /// time. Looping animations will loop back to TrackEntry.AnimationStart at this time. Defaults + /// to the animation duration. public var animationEnd: Float { get { let result = spine_track_entry_get_animation_end(_ptr.assumingMemoryBound(to: spine_track_entry_wrapper.self)) @@ -158,6 +204,10 @@ public class TrackEntry: NSObject { } } + /// The time in seconds this animation was last applied. Some timelines use this for one-time + /// triggers. Eg, when this animation is applied, event timelines will fire all events between + /// the animation last time (exclusive) and animation time (inclusive). Defaults to -1 to ensure + /// triggers on frame 0 happen the first time this animation is applied. public var animationLast: Float { get { let result = spine_track_entry_get_animation_last(_ptr.assumingMemoryBound(to: spine_track_entry_wrapper.self)) @@ -168,11 +218,30 @@ public class TrackEntry: NSObject { } } + /// Uses getTrackTime() to compute the animationTime. When the trackTime is 0, the animationTime + /// is equal to the animationStart time. + /// + /// The animationTime is between getAnimationStart() and getAnimationEnd(), except if this track + /// entry is non-looping and getAnimationEnd() is >= to the animation duration, then + /// animationTime continues to increase past getAnimationEnd(). public var animationTime: Float { let result = spine_track_entry_get_animation_time(_ptr.assumingMemoryBound(to: spine_track_entry_wrapper.self)) return result } + /// Multiplier for the delta time when this track entry is updated, causing time for this + /// animation to pass slower or faster. Defaults to 1. + /// + /// Values < 0 are not supported. To play an animation in reverse, use getReverse(). +/// + /// getMixTime() is not affected by track entry time scale, so getMixDuration() may need to be + /// adjusted to match the animation speed. +/// + /// When using AnimationState::addAnimation(int, Animation, bool, float) with a delay < = 0, the + /// getDelay() is set using the mix duration from the AnimationStateData, assuming time scale to + /// be 1. If the time scale is not 1, the delay may need to be adjusted. +/// + /// See AnimationState getTimeScale() for affecting all animations. public var timeScale: Float { get { let result = spine_track_entry_get_time_scale(_ptr.assumingMemoryBound(to: spine_track_entry_wrapper.self)) @@ -183,6 +252,12 @@ public class TrackEntry: NSObject { } } + /// Values less than 1 mix this animation with the last skeleton pose. Defaults to 1, which + /// overwrites the last skeleton pose with this animation. + /// + /// Typically track 0 is used to completely pose the skeleton, then alpha can be used on higher + /// tracks. It doesn't make sense to use alpha on track 0 if the skeleton pose is from the last + /// frame render. public var alpha: Float { get { let result = spine_track_entry_get_alpha(_ptr.assumingMemoryBound(to: spine_track_entry_wrapper.self)) @@ -193,6 +268,9 @@ public class TrackEntry: NSObject { } } + /// When the mix percentage (mix time / mix duration) is less than the event threshold, event + /// timelines for the animation being mixed out will be applied. Defaults to 0, so event + /// timelines are not applied for an animation being mixed out. public var eventThreshold: Float { get { let result = spine_track_entry_get_event_threshold(_ptr.assumingMemoryBound(to: spine_track_entry_wrapper.self)) @@ -203,6 +281,9 @@ public class TrackEntry: NSObject { } } + /// When the mix percentage (mix time / mix duration) is less than the attachment threshold, + /// attachment timelines for the animation being mixed out will be applied. Defaults to 0, so + /// attachment timelines are not applied for an animation being mixed out. public var mixAttachmentThreshold: Float { get { let result = spine_track_entry_get_mix_attachment_threshold(_ptr.assumingMemoryBound(to: spine_track_entry_wrapper.self)) @@ -213,6 +294,8 @@ public class TrackEntry: NSObject { } } + /// When getAlpha() is greater than alphaAttachmentThreshold, attachment timelines are applied. + /// Defaults to 0, so attachment timelines are always applied. public var alphaAttachmentThreshold: Float { get { let result = spine_track_entry_get_alpha_attachment_threshold(_ptr.assumingMemoryBound(to: spine_track_entry_wrapper.self)) @@ -223,6 +306,9 @@ public class TrackEntry: NSObject { } } + /// When the mix percentage (mix time / mix duration) is less than the draw order threshold, + /// draw order timelines for the animation being mixed out will be applied. Defaults to 0, so + /// draw order timelines are not applied for an animation being mixed out. public var mixDrawOrderThreshold: Float { get { let result = spine_track_entry_get_mix_draw_order_threshold(_ptr.assumingMemoryBound(to: spine_track_entry_wrapper.self)) @@ -233,16 +319,20 @@ public class TrackEntry: NSObject { } } + /// The animation queued to start after this animation, or NULL. public var next: TrackEntry? { let result = spine_track_entry_get_next(_ptr.assumingMemoryBound(to: spine_track_entry_wrapper.self)) return result.map { TrackEntry(fromPointer: $0) } } + /// Returns true if at least one loop has been completed. public var isComplete: Bool { let result = spine_track_entry_is_complete(_ptr.assumingMemoryBound(to: spine_track_entry_wrapper.self)) return result } + /// Seconds from 0 to the mix duration when mixing from the previous animation to this + /// animation. May be slightly more than TrackEntry.MixDuration when the mix is complete. public var mixTime: Float { get { let result = spine_track_entry_get_mix_time(_ptr.assumingMemoryBound(to: spine_track_entry_wrapper.self)) @@ -253,6 +343,15 @@ public class TrackEntry: NSObject { } } + /// Seconds for mixing from the previous animation to this animation. Defaults to the value + /// provided by AnimationStateData based on the animation before this animation (if any). + /// + /// The mix duration can be set manually rather than use the value from + /// AnimationStateData.GetMix. In that case, the mixDuration must be set before + /// AnimationState.update(float) is next called. +/// + /// When using AnimationState::addAnimation(int, Animation, bool, float) with a delay less than + /// or equal to 0, note the Delay is set using the mix duration from the AnimationStateData public var mixDuration: Float { let result = spine_track_entry_get_mix_duration(_ptr.assumingMemoryBound(to: spine_track_entry_wrapper.self)) return result @@ -268,11 +367,17 @@ public class TrackEntry: NSObject { } } + /// The track entry for the previous animation when mixing from the previous animation to this + /// animation, or NULL if no mixing is currently occuring. When mixing from multiple animations, + /// MixingFrom makes up a double linked list with MixingTo. public var mixingFrom: TrackEntry? { let result = spine_track_entry_get_mixing_from(_ptr.assumingMemoryBound(to: spine_track_entry_wrapper.self)) return result.map { TrackEntry(fromPointer: $0) } } + /// The track entry for the next animation when mixing from this animation, or NULL if no mixing + /// is currently occuring. When mixing from multiple animations, MixingTo makes up a double + /// linked list with MixingFrom. public var mixingTo: TrackEntry? { let result = spine_track_entry_get_mixing_to(_ptr.assumingMemoryBound(to: spine_track_entry_wrapper.self)) return result.map { TrackEntry(fromPointer: $0) } @@ -283,21 +388,29 @@ public class TrackEntry: NSObject { return result } + /// Returns true if this entry is for the empty animation. public var isEmptyAnimation: Bool { let result = spine_track_entry_is_empty_animation(_ptr.assumingMemoryBound(to: spine_track_entry_wrapper.self)) return result } + /// Returns true if this track entry has been applied at least once. + /// + /// See AnimationState::apply(Skeleton). public var wasApplied: Bool { let result = spine_track_entry_was_applied(_ptr.assumingMemoryBound(to: spine_track_entry_wrapper.self)) return result } + /// Returns true if there is a getNext() track entry that is ready to become the current track + /// entry during the next AnimationState::update(float)} public var isNextReady: Bool { let result = spine_track_entry_is_next_ready(_ptr.assumingMemoryBound(to: spine_track_entry_wrapper.self)) return result } + /// The AnimationState this track entry belongs to. May be NULL if TrackEntry is directly + /// instantiated. public var animationState: AnimationState? { get { let result = spine_track_entry_get_animation_state(_ptr.assumingMemoryBound(to: spine_track_entry_wrapper.self)) @@ -320,10 +433,22 @@ public class TrackEntry: NSObject { } } + /// Resets the rotation directions for mixing this entry's rotate timelines. This can be useful + /// to avoid bones rotating the long way around when using alpha and starting animations on + /// other tracks. + /// + /// Mixing involves finding a rotation between two others, which has two possible solutions: the + /// short way or the long way around. The two rotations likely change over time, so which + /// direction is the short or long way also changes. If the short way was always chosen, bones + /// would flip to the other side when that direction became the long way. TrackEntry chooses the + /// short way the first time it is applied and remembers that direction. public func resetRotationDirections() { spine_track_entry_reset_rotation_directions(_ptr.assumingMemoryBound(to: spine_track_entry_wrapper.self)) } + /// Sets both getMixDuration() and getDelay(). + /// + /// - Parameter delay: If > 0, sets TrackEntry::getDelay(). If < = 0, the delay set is the duration of the previous track entry minus the specified mix duration plus the specified delay (ie the mix ends at (delay = 0) or before (delay < 0) the previous track entry duration). If the previous entry is looping, its next loop completion is used instead of its duration. public func setMixDuration2(_ mixDuration: Float, _ delay: Float) { spine_track_entry_set_mix_duration_2(_ptr.assumingMemoryBound(to: spine_track_entry_wrapper.self), mixDuration, delay) } diff --git a/spine-ios/Sources/SpineSwift/Generated/transform_constraint.swift b/spine-ios/Sources/SpineSwift/Generated/transform_constraint.swift index 5995fb8ff..c0d914736 100644 --- a/spine-ios/Sources/SpineSwift/Generated/transform_constraint.swift +++ b/spine-ios/Sources/SpineSwift/Generated/transform_constraint.swift @@ -46,11 +46,13 @@ public class TransformConstraint: TransformConstraintBase { self.init(fromPointer: ptr!) } + /// The bones that will be modified by this transform constraint. public var bones: ArrayBonePose { let result = spine_transform_constraint_get_bones(_ptr.assumingMemoryBound(to: spine_transform_constraint_wrapper.self)) return ArrayBonePose(fromPointer: result!) } + /// The bone whose world transform will be copied to the constrained bones. public var source: Bone { get { let result = spine_transform_constraint_get_source(_ptr.assumingMemoryBound(to: spine_transform_constraint_wrapper.self)) diff --git a/spine-ios/Sources/SpineSwift/Generated/transform_constraint_base.swift b/spine-ios/Sources/SpineSwift/Generated/transform_constraint_base.swift index 3516cd894..4ab26237f 100644 --- a/spine-ios/Sources/SpineSwift/Generated/transform_constraint_base.swift +++ b/spine-ios/Sources/SpineSwift/Generated/transform_constraint_base.swift @@ -32,7 +32,7 @@ import Foundation import SpineC -/// TransformConstraintBase wrapper +/// Non-exported base class that inherits from the template @objc(SpineTransformConstraintBase) @objcMembers open class TransformConstraintBase: PosedActive, Posed, Constraint { @@ -83,6 +83,7 @@ open class TransformConstraintBase: PosedActive, Posed, Constraint { spine_transform_constraint_base_sort(_ptr.assumingMemoryBound(to: spine_transform_constraint_base_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self)) } + /// Inherited from Update public func update(_ skeleton: Skeleton, _ physics: Physics) { spine_transform_constraint_base_update(_ptr.assumingMemoryBound(to: spine_transform_constraint_base_wrapper.self), skeleton._ptr.assumingMemoryBound(to: spine_skeleton_wrapper.self), spine_physics(rawValue: UInt32(physics.rawValue))) } diff --git a/spine-ios/Sources/SpineSwift/Generated/transform_constraint_data.swift b/spine-ios/Sources/SpineSwift/Generated/transform_constraint_data.swift index 5b1fa7a63..0b958e8ae 100644 --- a/spine-ios/Sources/SpineSwift/Generated/transform_constraint_data.swift +++ b/spine-ios/Sources/SpineSwift/Generated/transform_constraint_data.swift @@ -32,7 +32,10 @@ import Foundation import SpineC -/// TransformConstraintData wrapper +/// Stores the setup pose for a TransformConstraint. +/// +/// See https://esotericsoftware.com/spine-transform-constraints Transform constraints in the Spine +/// User Guide. @objc(SpineTransformConstraintData) @objcMembers public class TransformConstraintData: PosedData, ConstraintData { @@ -51,11 +54,13 @@ public class TransformConstraintData: PosedData, ConstraintData { return Rtti(fromPointer: result!) } + /// The bones that will be modified by this transform constraint. public var bones: ArrayBoneData { let result = spine_transform_constraint_data_get_bones(_ptr.assumingMemoryBound(to: spine_transform_constraint_data_wrapper.self)) return ArrayBoneData(fromPointer: result!) } + /// The bone whose world transform will be copied to the constrained bones. public var source: BoneData { get { let result = spine_transform_constraint_data_get_source(_ptr.assumingMemoryBound(to: spine_transform_constraint_data_wrapper.self)) @@ -66,6 +71,7 @@ public class TransformConstraintData: PosedData, ConstraintData { } } + /// An offset added to the constrained bone rotation. public var offsetRotation: Float { get { let result = spine_transform_constraint_data_get_offset_rotation(_ptr.assumingMemoryBound(to: spine_transform_constraint_data_wrapper.self)) @@ -76,6 +82,7 @@ public class TransformConstraintData: PosedData, ConstraintData { } } + /// An offset added to the constrained bone X translation. public var offsetX: Float { get { let result = spine_transform_constraint_data_get_offset_x(_ptr.assumingMemoryBound(to: spine_transform_constraint_data_wrapper.self)) @@ -86,6 +93,7 @@ public class TransformConstraintData: PosedData, ConstraintData { } } + /// An offset added to the constrained bone Y translation. public var offsetY: Float { get { let result = spine_transform_constraint_data_get_offset_y(_ptr.assumingMemoryBound(to: spine_transform_constraint_data_wrapper.self)) @@ -96,6 +104,7 @@ public class TransformConstraintData: PosedData, ConstraintData { } } + /// An offset added to the constrained bone scaleX. public var offsetScaleX: Float { get { let result = spine_transform_constraint_data_get_offset_scale_x(_ptr.assumingMemoryBound(to: spine_transform_constraint_data_wrapper.self)) @@ -106,6 +115,7 @@ public class TransformConstraintData: PosedData, ConstraintData { } } + /// An offset added to the constrained bone scaleY. public var offsetScaleY: Float { get { let result = spine_transform_constraint_data_get_offset_scale_y(_ptr.assumingMemoryBound(to: spine_transform_constraint_data_wrapper.self)) @@ -116,6 +126,7 @@ public class TransformConstraintData: PosedData, ConstraintData { } } + /// An offset added to the constrained bone shearY. public var offsetShearY: Float { get { let result = spine_transform_constraint_data_get_offset_shear_y(_ptr.assumingMemoryBound(to: spine_transform_constraint_data_wrapper.self)) @@ -126,6 +137,7 @@ public class TransformConstraintData: PosedData, ConstraintData { } } + /// Reads the source bone's local transform instead of its world transform. public var localSource: Bool { get { let result = spine_transform_constraint_data_get_local_source(_ptr.assumingMemoryBound(to: spine_transform_constraint_data_wrapper.self)) @@ -136,6 +148,7 @@ public class TransformConstraintData: PosedData, ConstraintData { } } + /// Sets the constrained bones' local transforms instead of their world transforms. public var localTarget: Bool { get { let result = spine_transform_constraint_data_get_local_target(_ptr.assumingMemoryBound(to: spine_transform_constraint_data_wrapper.self)) @@ -146,6 +159,7 @@ public class TransformConstraintData: PosedData, ConstraintData { } } + /// Adds the source bone transform to the constrained bones instead of setting it absolutely. public var additive: Bool { get { let result = spine_transform_constraint_data_get_additive(_ptr.assumingMemoryBound(to: spine_transform_constraint_data_wrapper.self)) @@ -156,6 +170,7 @@ public class TransformConstraintData: PosedData, ConstraintData { } } + /// Prevents constrained bones from exceeding the ranged defined by offset and max. public var clamp: Bool { get { let result = spine_transform_constraint_data_get_clamp(_ptr.assumingMemoryBound(to: spine_transform_constraint_data_wrapper.self)) @@ -166,6 +181,7 @@ public class TransformConstraintData: PosedData, ConstraintData { } } + /// The mapping of transform properties to other transform properties. public var properties: ArrayFromProperty { let result = spine_transform_constraint_data_get_properties(_ptr.assumingMemoryBound(to: spine_transform_constraint_data_wrapper.self)) return ArrayFromProperty(fromPointer: result!) diff --git a/spine-ios/Sources/SpineSwift/Generated/transform_constraint_pose.swift b/spine-ios/Sources/SpineSwift/Generated/transform_constraint_pose.swift index 9b0b8b9a2..cdc0d0a49 100644 --- a/spine-ios/Sources/SpineSwift/Generated/transform_constraint_pose.swift +++ b/spine-ios/Sources/SpineSwift/Generated/transform_constraint_pose.swift @@ -32,7 +32,7 @@ import Foundation import SpineC -/// TransformConstraintPose wrapper +/// Stores a pose for a transform constraint. @objc(SpineTransformConstraintPose) @objcMembers public class TransformConstraintPose: NSObject { @@ -48,6 +48,7 @@ public class TransformConstraintPose: NSObject { self.init(fromPointer: ptr!) } + /// A percentage (0-1) that controls the mix between the constrained and unconstrained rotation. public var mixRotate: Float { get { let result = spine_transform_constraint_pose_get_mix_rotate(_ptr.assumingMemoryBound(to: spine_transform_constraint_pose_wrapper.self)) @@ -58,6 +59,8 @@ public class TransformConstraintPose: NSObject { } } + /// A percentage (0-1) that controls the mix between the constrained and unconstrained + /// translation X. public var mixX: Float { get { let result = spine_transform_constraint_pose_get_mix_x(_ptr.assumingMemoryBound(to: spine_transform_constraint_pose_wrapper.self)) @@ -68,6 +71,8 @@ public class TransformConstraintPose: NSObject { } } + /// A percentage (0-1) that controls the mix between the constrained and unconstrained + /// translation Y. public var mixY: Float { get { let result = spine_transform_constraint_pose_get_mix_y(_ptr.assumingMemoryBound(to: spine_transform_constraint_pose_wrapper.self)) @@ -78,6 +83,7 @@ public class TransformConstraintPose: NSObject { } } + /// A percentage (0-1) that controls the mix between the constrained and unconstrained scale X. public var mixScaleX: Float { get { let result = spine_transform_constraint_pose_get_mix_scale_x(_ptr.assumingMemoryBound(to: spine_transform_constraint_pose_wrapper.self)) @@ -88,6 +94,7 @@ public class TransformConstraintPose: NSObject { } } + /// A percentage (0-1) that controls the mix between the constrained and unconstrained scale Y. public var mixScaleY: Float { get { let result = spine_transform_constraint_pose_get_mix_scale_y(_ptr.assumingMemoryBound(to: spine_transform_constraint_pose_wrapper.self)) @@ -98,6 +105,7 @@ public class TransformConstraintPose: NSObject { } } + /// A percentage (0-1) that controls the mix between the constrained and unconstrained shear Y. public var mixShearY: Float { get { let result = spine_transform_constraint_pose_get_mix_shear_y(_ptr.assumingMemoryBound(to: spine_transform_constraint_pose_wrapper.self)) diff --git a/spine-ios/Sources/SpineSwift/Generated/transform_constraint_timeline.swift b/spine-ios/Sources/SpineSwift/Generated/transform_constraint_timeline.swift index 0cf7048e1..6a8a710c1 100644 --- a/spine-ios/Sources/SpineSwift/Generated/transform_constraint_timeline.swift +++ b/spine-ios/Sources/SpineSwift/Generated/transform_constraint_timeline.swift @@ -32,7 +32,10 @@ import Foundation import SpineC -/// TransformConstraintTimeline wrapper +/// Changes a transform constraint's TransformConstraintPose::getMixRotate(), +/// TransformConstraintPose::getMixX(), TransformConstraintPose::getMixY(), +/// TransformConstraintPose::getMixScaleX(), TransformConstraintPose::getMixScaleY(), and +/// TransformConstraintPose::getMixShearY(). @objc(SpineTransformConstraintTimeline) @objcMembers public class TransformConstraintTimeline: CurveTimeline, ConstraintTimeline { @@ -56,6 +59,10 @@ public class TransformConstraintTimeline: CurveTimeline, ConstraintTimeline { } } + /// Sets the time, rotate mix, translate mix, scale mix, and shear mix for the specified frame. + /// + /// - Parameter frame: Between 0 and frameCount, inclusive. + /// - Parameter time: The frame time in seconds. public func setFrame(_ frame: Int32, _ time: Float, _ mixRotate: Float, _ mixX: Float, _ mixY: Float, _ mixScaleX: Float, _ mixScaleY: Float, _ mixShearY: Float) { spine_transform_constraint_timeline_set_frame(_ptr.assumingMemoryBound(to: spine_transform_constraint_timeline_wrapper.self), frame, time, mixRotate, mixX, mixY, mixScaleX, mixScaleY, mixShearY) } diff --git a/spine-ios/Sources/SpineSwift/Generated/translate_timeline.swift b/spine-ios/Sources/SpineSwift/Generated/translate_timeline.swift index e773a5236..e34694544 100644 --- a/spine-ios/Sources/SpineSwift/Generated/translate_timeline.swift +++ b/spine-ios/Sources/SpineSwift/Generated/translate_timeline.swift @@ -32,7 +32,7 @@ import Foundation import SpineC -/// TranslateTimeline wrapper +/// Changes a bone's local X and Y translation. @objc(SpineTranslateTimeline) @objcMembers public class TranslateTimeline: BoneTimeline2 { diff --git a/spine-ios/Sources/SpineSwift/Generated/translate_x_timeline.swift b/spine-ios/Sources/SpineSwift/Generated/translate_x_timeline.swift index 23945908d..806f2791f 100644 --- a/spine-ios/Sources/SpineSwift/Generated/translate_x_timeline.swift +++ b/spine-ios/Sources/SpineSwift/Generated/translate_x_timeline.swift @@ -32,7 +32,7 @@ import Foundation import SpineC -/// TranslateXTimeline wrapper +/// Changes a bone's local X translation. @objc(SpineTranslateXTimeline) @objcMembers public class TranslateXTimeline: BoneTimeline1 { diff --git a/spine-ios/Sources/SpineSwift/Generated/translate_y_timeline.swift b/spine-ios/Sources/SpineSwift/Generated/translate_y_timeline.swift index 4b4cc619b..dc51b4b06 100644 --- a/spine-ios/Sources/SpineSwift/Generated/translate_y_timeline.swift +++ b/spine-ios/Sources/SpineSwift/Generated/translate_y_timeline.swift @@ -32,7 +32,7 @@ import Foundation import SpineC -/// TranslateYTimeline wrapper +/// Changes a bone's local Y translation. @objc(SpineTranslateYTimeline) @objcMembers public class TranslateYTimeline: BoneTimeline1 { diff --git a/spine-ios/Sources/SpineSwift/Generated/vertex_attachment.swift b/spine-ios/Sources/SpineSwift/Generated/vertex_attachment.swift index 1c6c189d8..86be0063b 100644 --- a/spine-ios/Sources/SpineSwift/Generated/vertex_attachment.swift +++ b/spine-ios/Sources/SpineSwift/Generated/vertex_attachment.swift @@ -32,7 +32,8 @@ import Foundation import SpineC -/// VertexAttachment wrapper +/// An attachment with vertices that are transformed by one or more bones and can be deformed by a +/// slot's SlotPose::getDeform(). @objc(SpineVertexAttachment) @objcMembers open class VertexAttachment: Attachment { @@ -41,6 +42,7 @@ open class VertexAttachment: Attachment { super.init(fromPointer: UnsafeMutableRawPointer(ptr).assumingMemoryBound(to: spine_attachment_wrapper.self)) } + /// Gets a unique ID for this attachment. public var id: Int32 { let result = spine_vertex_attachment_get_id(_ptr.assumingMemoryBound(to: spine_vertex_attachment_wrapper.self)) return result diff --git a/spine-ios/codegen/src/index.js b/spine-ios/codegen/src/index.js new file mode 100644 index 000000000..0ebf0ad7e --- /dev/null +++ b/spine-ios/codegen/src/index.js @@ -0,0 +1,22 @@ +#!/usr/bin/env node +import * as path from 'node:path'; +import { fileURLToPath } from 'node:url'; +import { generate } from '../../../spine-c/codegen/src/index.js'; +import { SwiftWriter } from './swift-writer.js'; +const __dirname = path.dirname(fileURLToPath(import.meta.url)); +async function main() { + console.log('Generating Swift bindings from spine-c...'); + // Get the C intermediate representation from spine-c-codegen + const { cTypes, cEnums, cArrayTypes, inheritance, supertypes, subtypes, isInterface } = await generate(); + // Prepare output directory + const outputDir = path.join(__dirname, '..', '..', 'Sources', 'SpineSwift', 'Generated'); + // Create the Swift writer with output directory + const writer = new SwiftWriter(outputDir); + // Generate Swift code using the writeAll method + await writer.writeAll(cTypes, cEnums, cArrayTypes, inheritance, isInterface, supertypes, subtypes); + console.log('Swift bindings generation complete!'); +} +main().catch(error => { + console.error('Error:', error); + process.exit(1); +}); diff --git a/spine-ios/codegen/src/swift-writer.js b/spine-ios/codegen/src/swift-writer.js new file mode 100644 index 000000000..eb1042eef --- /dev/null +++ b/spine-ios/codegen/src/swift-writer.js @@ -0,0 +1,1539 @@ +import * as fs from 'node:fs'; +import * as path from 'node:path'; +import { fileURLToPath } from 'node:url'; +import { toSnakeCase } from '../../../spine-c/codegen/src/types.js'; +const __dirname = path.dirname(fileURLToPath(import.meta.url)); +// Get license header from spine-cpp source +const LICENSE_HEADER = fs.readFileSync(path.join(__dirname, '../../../spine-cpp/src/spine/Skeleton.cpp'), 'utf8') + .split('\n') + .slice(0, 28) + .map((line, index, array) => { + // Convert C++ block comment format to Swift line comment format + if (index === 0 && line.startsWith('/****')) { + return `//${line.substring(4).replace(/\*+/g, '')}`; + } + else if (index === array.length - 1 && (line.startsWith(' ****') || line.trim() === '*/')) { + return `//${line.substring(line.indexOf('*') + 1).replace(/\*+/g, '').replace(/\//g, '')}`; + } + else if (line.startsWith(' ****') || line.trim() === '*/') { + return `// ${line.substring(4)}`; + } + else if (line.startsWith(' * ')) { + return `// ${line.substring(3)}`; + } + else if (line.startsWith(' *')) { + return `//${line.substring(2)}`; + } + else { + return line; + } +}) + .join('\n'); +export class SwiftWriter { + outputDir; + enumNames = new Set(); + classMap = new Map(); // name -> class + inheritance = {}; + isInterface = {}; + supertypes = {}; // for RTTI switching + subtypes = {}; + constructor(outputDir) { + this.outputDir = outputDir; + this.cleanOutputDirectory(); + } + cleanOutputDirectory() { + if (fs.existsSync(this.outputDir)) { + fs.rmSync(this.outputDir, { recursive: true, force: true }); + } + fs.mkdirSync(this.outputDir, { recursive: true }); + } + // Step 1: Transform C types to clean Swift model + transformToSwiftModel(cTypes, cEnums, inheritance, isInterface, supertypes) { + // Store data for reference + this.inheritance = inheritance; + this.isInterface = isInterface; + this.supertypes = supertypes; + for (const cType of cTypes) { + this.classMap.set(cType.name, cType); + } + for (const cEnum of cEnums) { + this.enumNames.add(cEnum.name); + } + const swiftClasses = []; + const swiftEnums = []; + // Transform enums + for (const cEnum of cEnums) { + swiftEnums.push(this.transformEnum(cEnum)); + } + // Transform classes in dependency order + const sortedTypes = this.sortByInheritance(cTypes); + for (const cType of sortedTypes) { + swiftClasses.push(this.transformClass(cType)); + } + return { classes: swiftClasses, enums: swiftEnums }; + } + // Step 2: Generate Swift code from clean model + generateSwiftCode(swiftClass) { + const lines = []; + // Header + lines.push(this.generateHeader()); + // Imports + lines.push(...this.generateImports(swiftClass.imports, swiftClass.hasRtti)); + // Class/Protocol declaration + lines.push(this.generateClassDeclaration(swiftClass)); + // Class body + if (swiftClass.type === 'protocol') { + lines.push(...this.generateProtocolBody(swiftClass)); + } + else { + lines.push(...this.generateClassBody(swiftClass)); + } + lines.push('}'); + return lines.join('\n'); + } + // Step 3: Write files + async writeAll(cTypes, cEnums, cArrayTypes, inheritance = {}, isInterface = {}, supertypes = {}, subtypes = {}) { + this.subtypes = subtypes; + // Step 1: Transform to clean model + const { classes, enums } = this.transformToSwiftModel(cTypes, cEnums, inheritance, isInterface, supertypes); + // Step 2 & 3: Generate and write files + for (const swiftEnum of enums) { + const content = this.generateEnumCode(swiftEnum); + const fileName = `${toSnakeCase(swiftEnum.name)}.swift`; + const filePath = path.join(this.outputDir, fileName); + fs.writeFileSync(filePath, content); + } + for (const swiftClass of classes) { + const content = this.generateSwiftCode(swiftClass); + const fileName = `${toSnakeCase(swiftClass.name)}.swift`; + const filePath = path.join(this.outputDir, fileName); + fs.writeFileSync(filePath, content); + } + // Generate arrays.swift + await this.writeArraysFile(cArrayTypes); + // Write main export file + await this.writeExportFile(classes, enums); + } + // Class type resolution + determineClassType(cType) { + if (this.isInterface[cType.name]) + return 'protocol'; + if (cType.cppType.isAbstract) + return 'abstract'; + return 'concrete'; + } + // Inheritance resolution + resolveInheritance(cType) { + const inheritanceInfo = this.inheritance[cType.name]; + return { + extends: inheritanceInfo?.extends ? this.toSwiftTypeName(inheritanceInfo.extends) : undefined, + implements: (inheritanceInfo?.mixins || []).map(mixin => this.toSwiftTypeName(mixin)) + }; + } + transformEnum(cEnum) { + const swiftEnum = { + name: this.toSwiftTypeName(cEnum.name), + values: cEnum.values.map((value, index) => { + let parsedValue; + if (value.value !== undefined) { + // Handle bit shift expressions like "1 << 0" + const bitShiftMatch = value.value.match(/^(\d+)\s*<<\s*(\d+)$/); + if (bitShiftMatch) { + const base = parseInt(bitShiftMatch[1]); + const shift = parseInt(bitShiftMatch[2]); + parsedValue = base << shift; + } + else { + // Try to parse as regular number + parsedValue = Number.parseInt(value.value); + if (isNaN(parsedValue)) { + console.warn(`Warning: Could not parse enum value ${value.name} = ${value.value}, using index ${index}`); + parsedValue = index; + } + } + } + else { + parsedValue = index; + } + return { + name: this.toSwiftEnumValueName(value.name, cEnum.name), + value: parsedValue + }; + }) + }; + return swiftEnum; + } + transformClass(cType) { + const swiftName = this.toSwiftTypeName(cType.name); + const classType = this.determineClassType(cType); + const inheritance = this.resolveInheritance(cType); + return { + name: swiftName, + type: classType, + inheritance, + imports: this.collectImports(cType), + members: this.processMembers(cType, classType), + hasRtti: this.hasRttiMethod(cType), + }; + } + // Unified Method Processing + processMembers(cType, classType) { + const members = []; + // Add constructors for concrete classes only + if (classType === 'concrete') { + for (const constr of cType.constructors) { + members.push(this.createConstructor(constr, cType)); + } + } + // Add destructor as deinit for concrete classes + if (classType === 'concrete' && cType.destructor) { + members.push(this.createDisposeMethod(cType.destructor, cType)); + } + // Process methods with unified logic + const validMethods = cType.methods.filter(method => { + if (this.hasRawPointerParameters(method)) { + return false; + } + if (this.isMethodInherited(method, cType)) { + return false; + } + return true; + }); + const renumberedMethods = this.renumberMethods(validMethods, cType.name); + // Group getter/setter pairs to avoid duplicate property declarations + const propertyMap = new Map(); + const regularMethods = []; + const overloadedSetters = this.findOverloadedSetters(renumberedMethods); + for (const methodInfo of renumberedMethods) { + const { method, renamedMethod } = methodInfo; + if (this.isGetter(method)) { + const propName = renamedMethod || this.extractPropertyName(method.name, cType.name); + const prop = propertyMap.get(propName) || {}; + prop.getter = { method, renamedMethod }; + propertyMap.set(propName, prop); + } + else if (this.isSetter(method, overloadedSetters)) { + const propName = renamedMethod || this.extractPropertyName(method.name, cType.name); + const prop = propertyMap.get(propName) || {}; + prop.setter = { method, renamedMethod }; + propertyMap.set(propName, prop); + } + else { + regularMethods.push({ method, renamedMethod }); + } + } + // Create combined property members + for (const [propName, { getter, setter }] of propertyMap) { + if (getter && setter) { + // Combined getter/setter property + members.push(this.createCombinedProperty(getter.method, setter.method, cType, classType, propName)); + } + else if (getter) { + // Read-only property + members.push(this.createGetter(getter.method, cType, classType, getter.renamedMethod)); + } + else if (setter) { + // Write-only property (rare) + members.push(this.createSetter(setter.method, cType, classType, setter.renamedMethod)); + } + } + // Add regular methods + for (const { method, renamedMethod } of regularMethods) { + members.push(this.createMethod(method, cType, classType, renamedMethod)); + } + return members; + } + createCombinedProperty(getter, setter, cType, classType, propName) { + const swiftReturnType = this.toSwiftReturnType(getter.returnType, getter.returnTypeNullable); + // For protocols, we just need the declaration + if (classType === 'protocol') { + return { + type: 'getter', // Will be rendered as a property with get/set + name: propName, + swiftReturnType, + parameters: [], + isOverride: false, + implementation: '', // No implementation for protocols + cMethodName: getter.name, + hasSetter: true, // Mark that this property has a setter + documentation: getter.documentation || setter.documentation // Use getter's doc if available, otherwise setter's + }; + } + // For concrete/abstract classes, create implementation + const cTypeName = this.toCTypeName(this.toSwiftTypeName(cType.name)); + const getterImpl = `let result = ${getter.name}(_ptr.assumingMemoryBound(to: ${cTypeName}_wrapper.self)) + ${this.generateReturnConversion(getter.returnType, 'result', getter.returnTypeNullable)}`; + const setterParam = setter.parameters[1]; // First param is self + const setterImpl = `${setter.name}(_ptr.assumingMemoryBound(to: ${cTypeName}_wrapper.self), ${this.convertSwiftToC('newValue', setterParam)})`; + const isOverride = this.isMethodOverride(getter, cType) || this.isMethodOverride(setter, cType); + return { + type: 'getter', // Combined property + name: propName, + swiftReturnType, + parameters: [], + isOverride, + implementation: getterImpl, + setterImplementation: setterImpl, + cMethodName: getter.name, + hasSetter: true, + documentation: getter.documentation || setter.documentation // Use getter's doc if available, otherwise setter's + }; + } + processMethod(method, cType, classType, renamedMethod, overloadedSetters) { + if (this.isGetter(method)) { + return this.createGetter(method, cType, classType, renamedMethod); + } + else if (this.isSetter(method, overloadedSetters)) { + return this.createSetter(method, cType, classType, renamedMethod); + } + else { + return this.createMethod(method, cType, classType, renamedMethod); + } + } + // Unified getter detection for ALL classes + isGetter(method) { + return (method.name.includes('_get_') && method.parameters.length === 1) || + (method.returnType === 'bool' && method.parameters.length === 1 && + (method.name.includes('_has_') || method.name.includes('_is_') || method.name.includes('_was_'))); + } + isSetter(method, overloadedSetters) { + const isBasicSetter = method.returnType === 'void' && + method.parameters.length === 2 && + method.name.includes('_set_'); + if (!isBasicSetter) + return false; + // If this setter has overloads, don't generate it as a setter + if (overloadedSetters?.has(method.name)) { + return false; + } + return true; + } + findOverloadedSetters(renumberedMethods) { + const setterBasenames = new Map(); + // Group setter methods by their base name + for (const methodInfo of renumberedMethods) { + const method = methodInfo.method; + if (method.returnType === 'void' && + method.parameters.length === 2 && + method.name.includes('_set_')) { + // Extract base name by removing numbered suffix + const match = method.name.match(/^(.+?)_(\d+)$/); + const baseName = match ? match[1] : method.name; + if (!setterBasenames.has(baseName)) { + setterBasenames.set(baseName, []); + } + setterBasenames.get(baseName)?.push(method.name); + } + } + // Find setters that have multiple methods with the same base name + const overloadedSetters = new Set(); + for (const [_baseName, methodNames] of setterBasenames) { + if (methodNames.length > 1) { + // Multiple setters with same base name - mark all as overloaded + for (const methodName of methodNames) { + overloadedSetters.add(methodName); + } + } + } + return overloadedSetters; + } + createDisposeMethod(destructor, cType) { + // In Swift, we don't expose dispose() method, it's handled in deinit + // This is just a marker for the code generator + const cTypeName = this.toCTypeName(this.toSwiftTypeName(cType.name)); + return { + type: 'method', + name: '__dispose__', // Special marker + swiftReturnType: 'Void', + parameters: [], + isOverride: false, + implementation: `${destructor.name}(_ptr.assumingMemoryBound(to: ${cTypeName}_wrapper.self))`, + cMethodName: destructor.name, + documentation: destructor.documentation + }; + } + createConstructor(constr, cType) { + const swiftClassName = this.toSwiftTypeName(cType.name); + const params = constr.parameters.map(p => ({ + name: p.name, + swiftType: this.toSwiftParameterType(p), + cType: p.cType + })); + const args = constr.parameters.map(p => this.convertSwiftToC(p.name, p)).join(', '); + const implementation = `let ptr = ${constr.name}(${args}) + return ${swiftClassName}(fromPointer: ptr!)`; + return { + type: 'constructor', + name: this.getConstructorName(constr, cType), + swiftReturnType: swiftClassName, + parameters: params, + isOverride: false, + implementation, + cMethodName: constr.name, + documentation: constr.documentation + }; + } + createGetter(method, cType, classType, renamedMethod) { + const propertyName = renamedMethod || this.extractPropertyName(method.name, cType.name); + let swiftReturnType = this.toSwiftReturnType(method.returnType, method.returnTypeNullable); + // Special handling for protocol conformance with covariant return types + // If this is a concrete class implementing a protocol, and the property is 'data', + // we need to return the protocol type instead of the concrete type + if (classType !== 'protocol' && propertyName === 'data' && + this.inheritance[cType.name]?.mixins?.includes('spine_constraint')) { + // Check if the return type is any kind of constraint data + // (could be spine_ik_constraint_data, spine_slider_data, etc.) + const returnClass = this.classMap.get(method.returnType); + if (returnClass && this.inheritance[method.returnType]?.mixins?.includes('spine_constraint_data')) { + // Return the protocol type for proper conformance + swiftReturnType = swiftReturnType.endsWith('?') ? 'ConstraintData?' : 'ConstraintData'; + } + } + // Protocol methods have no implementation + let implementation = ''; + if (classType !== 'protocol') { + const cTypeName = this.toCTypeName(this.toSwiftTypeName(cType.name)); + implementation = `let result = ${method.name}(_ptr.assumingMemoryBound(to: ${cTypeName}_wrapper.self)) + ${this.generateReturnConversion(method.returnType, 'result', method.returnTypeNullable)}`; + } + // Check if this is an override + const isOverride = this.isMethodOverride(method, cType); + return { + type: 'getter', + name: propertyName, + swiftReturnType, + parameters: [], + isOverride, + implementation, + cMethodName: method.name, + documentation: method.documentation + }; + } + createSetter(method, cType, classType, renamedMethod) { + let propertyName = renamedMethod || this.extractPropertyName(method.name, cType.name); + const param = method.parameters[1]; // First param is self + const swiftParam = { + name: 'value', + swiftType: this.toSwiftParameterType(param), + cType: param.cType + }; + // Handle numeric suffixes in setter names + if (!renamedMethod) { + const match = propertyName.match(/^(\w+)_(\d+)$/); + if (match) { + propertyName = `${match[1]}${match[2]}`; + } + else if (/^\d+$/.test(propertyName)) { + propertyName = `set${propertyName}`; + } + } + // Protocol methods have no implementation + let implementation = ''; + if (classType !== 'protocol') { + const cTypeName = this.toCTypeName(this.toSwiftTypeName(cType.name)); + implementation = `${method.name}(_ptr.assumingMemoryBound(to: ${cTypeName}_wrapper.self), ${this.convertSwiftToC('newValue', param)})`; + } + const isOverride = this.isMethodOverride(method, cType); + return { + type: 'setter', + name: propertyName, + swiftReturnType: 'Void', + parameters: [swiftParam], + isOverride, + implementation, + cMethodName: method.name, + documentation: method.documentation + }; + } + createMethod(method, cType, classType, renamedMethod) { + let methodName = renamedMethod || this.toSwiftMethodName(method.name, cType.name); + const swiftReturnType = this.toSwiftReturnType(method.returnType, method.returnTypeNullable); + // Check if this is a static method + const isStatic = method.parameters.length === 0 || + (method.parameters[0].name !== 'self' && + !method.parameters[0].cType.startsWith(cType.name)); + // Rename static rtti method to avoid conflict with getter + if (isStatic && methodName === 'rtti') { + methodName = 'rttiStatic'; + } + // Handle Objective-C conflicts - rename problematic methods + if (methodName === 'copy') { + methodName = 'copyAttachment'; // Or another appropriate name based on context + } + // Parameters (skip 'self' parameter for instance methods) + const paramStartIndex = isStatic ? 0 : 1; + const params = method.parameters.slice(paramStartIndex).map(p => ({ + name: p.name, + swiftType: this.toSwiftParameterType(p), + cType: p.cType + })); + // Protocol methods have no implementation (except rttiStatic) + let implementation = ''; + if (classType !== 'protocol' || methodName === 'rttiStatic') { + const cTypeName = this.toCTypeName(this.toSwiftTypeName(cType.name)); + const args = method.parameters.map((p, i) => { + if (!isStatic && i === 0) + return `_ptr.assumingMemoryBound(to: ${cTypeName}_wrapper.self)`; // self parameter + return this.convertSwiftToC(p.name, p); + }).join(', '); + if (method.returnType === 'void') { + implementation = `${method.name}(${args})`; + } + else { + implementation = `let result = ${method.name}(${args}) + ${this.generateReturnConversion(method.returnType, 'result', method.returnTypeNullable)}`; + } + } + const isOverride = this.isMethodOverride(method, cType); + return { + type: isStatic ? 'static_method' : 'method', + name: methodName, + swiftReturnType, + parameters: params, + isOverride, + implementation, + cMethodName: method.name, + documentation: method.documentation + }; + } + // Code generation methods + generateHeader() { + return `${LICENSE_HEADER} + +// AUTO GENERATED FILE, DO NOT EDIT.`; + } + generateImports(imports, hasRtti) { + const lines = []; + lines.push(''); + lines.push('import Foundation'); + lines.push('import SpineC'); + // In Swift, all types are in the same module, no need for individual imports + // RTTI is a type, not a module + return lines; + } + // Class declaration generation + generateClassDeclaration(swiftClass) { + let declaration = ''; + if (swiftClass.type === 'protocol') { + declaration = `public protocol ${swiftClass.name}`; + } + else { + // Add @objc annotations for Objective-C compatibility + const objcAnnotations = `@objc(Spine${swiftClass.name})\n@objcMembers\n`; + if (swiftClass.type === 'abstract') { + declaration = `${objcAnnotations}open class ${swiftClass.name}`; + } + else { + // Check if any abstract class extends from this class + // If so, this class needs to be open as well + let needsOpen = false; + // Find the C type name for this Swift class + const cTypeName = this.fromSwiftTypeName(swiftClass.name); + for (const [childName, inheritanceInfo] of Object.entries(this.inheritance)) { + if (inheritanceInfo.extends === cTypeName) { + const childClass = this.classMap.get(childName); + if (childClass && this.isAbstract(childClass)) { + needsOpen = true; + break; + } + } + } + if (needsOpen) { + declaration = `${objcAnnotations}open class ${swiftClass.name}`; + } + else { + declaration = `${objcAnnotations}public class ${swiftClass.name}`; + } + } + } + // Inheritance + const inheritanceParts = []; + if (swiftClass.inheritance.extends) { + inheritanceParts.push(swiftClass.inheritance.extends); + } + else if (swiftClass.type !== 'protocol') { + // Root classes inherit from NSObject for Objective-C compatibility + inheritanceParts.push('NSObject'); + } + // Add protocols + inheritanceParts.push(...swiftClass.inheritance.implements); + if (inheritanceParts.length > 0) { + declaration += `: ${inheritanceParts.join(', ')}`; + } + return ` +/// ${swiftClass.name} wrapper +${declaration} {`; + } + generateProtocolBody(swiftClass) { + const lines = []; + // Protocols need to declare _ptr so conforming types can be used polymorphically + lines.push(' var _ptr: UnsafeMutableRawPointer { get }'); + // Generate abstract method signatures for protocols + for (const member of swiftClass.members) { + lines.push(this.generateProtocolMember(member)); + } + return lines; + } + // Class body generation + generateClassBody(swiftClass) { + const lines = []; + // Only root classes declare _ptr field (as UnsafeMutableRawPointer) + // Public readonly so users can cast as needed + if (!swiftClass.inheritance.extends) { + lines.push(' public let _ptr: UnsafeMutableRawPointer'); + lines.push(''); + } + // Constructor + lines.push(this.generatePointerConstructor(swiftClass)); + lines.push(''); + // No computed properties - subclasses just use inherited _ptr + // Members + let hasDispose = false; + for (const member of swiftClass.members) { + if (member.name === '__dispose__') { + hasDispose = true; + continue; // Skip the dispose marker + } + lines.push(this.generateMember(member, swiftClass)); + lines.push(''); + } + // Add dispose() method instead of deinit + if (hasDispose) { + const disposeMethod = swiftClass.members.find(m => m.name === '__dispose__'); + if (disposeMethod) { + // Only add override if a parent class has a destructor that we generated dispose() for + // Abstract classes don't get dispose() generated, only concrete classes do + let override = ''; + if (swiftClass.inheritance.extends) { + // Find the C++ name for this Swift class + let cppName = ''; + for (const [cName, cClass] of this.classMap.entries()) { + if (this.toSwiftTypeName(cName) === swiftClass.name) { + cppName = cName; + break; + } + } + if (cppName) { + // Check all parents in the hierarchy to see if any has a destructor AND is concrete + let parentCName = this.inheritance[cppName]?.extends; + while (parentCName) { + const parentClass = this.classMap.get(parentCName); + // Only concrete classes get dispose() generated + if (parentClass && parentClass.destructor && !this.isAbstract(parentClass)) { + override = 'override '; + break; + } + // Check next parent in hierarchy + parentCName = this.inheritance[parentCName]?.extends; + } + } + } + lines.push(` public ${override}func dispose() {`); + lines.push(` ${disposeMethod.implementation}`); + lines.push(' }'); + } + } + return lines; + } + generatePointerConstructor(swiftClass) { + const cTypeName = this.toCTypeName(swiftClass.name); + if (swiftClass.inheritance.extends) { + const parentTypeName = this.toCTypeName(swiftClass.inheritance.extends); + // Subclass - NO ptr field, pass typed pointer cast to parent type + // Use @nonobjc to prevent Objective-C selector conflicts + return ` @nonobjc + public init(fromPointer ptr: ${cTypeName}) { + super.init(fromPointer: UnsafeMutableRawPointer(ptr).assumingMemoryBound(to: ${parentTypeName}_wrapper.self)) + }`; + } + else { + // Root class - HAS _ptr field, store as UnsafeMutableRawPointer + // Must call super.init() since we inherit from NSObject + return ` public init(fromPointer ptr: ${cTypeName}) { + self._ptr = UnsafeMutableRawPointer(ptr) + super.init() + }`; + } + } + generateProtocolMember(member) { + const params = member.parameters.map(p => `_ ${p.name}: ${p.swiftType}`).join(', '); + switch (member.type) { + case 'getter': + // Check if this is a combined getter/setter property + if (member.hasSetter) { + return ` var ${member.name}: ${member.swiftReturnType} { get set }`; + } + else { + return ` var ${member.name}: ${member.swiftReturnType} { get }`; + } + case 'setter': + return ` var ${member.name}: ${member.parameters[0].swiftType} { get set }`; + case 'method': + if (member.swiftReturnType === 'Void') { + return ` func ${member.name}(${params})`; + } + else { + return ` func ${member.name}(${params}) -> ${member.swiftReturnType}`; + } + case 'static_method': + // Protocols can't have method implementations in Swift + if (member.swiftReturnType === 'Void') { + return ` static func ${member.name}(${params})`; + } + else { + return ` static func ${member.name}(${params}) -> ${member.swiftReturnType}`; + } + default: + return ''; + } + } + // Member generation + generateMember(member, swiftClass) { + const override = member.isOverride ? 'override ' : ''; + const docComment = this.formatSwiftDocumentation(member.documentation, member); + switch (member.type) { + case 'constructor': + return this.generateConstructorMember(member); + case 'getter': + // Check if this is a combined getter/setter property + if (member.hasSetter && member.setterImplementation) { + return `${docComment} ${override}public var ${member.name}: ${member.swiftReturnType} { + get { + ${member.implementation} + } + set { + ${member.setterImplementation} + } + }`; + } + else { + return `${docComment} ${override}public var ${member.name}: ${member.swiftReturnType} { + ${member.implementation} + }`; + } + case 'setter': { + const param = member.parameters[0]; + return `${docComment} ${override}public var ${member.name}: ${param.swiftType} { + get { fatalError("Setter-only property") } + set(newValue) { + ${member.implementation} + } + }`; + } + case 'method': + case 'static_method': { + const params = member.parameters.map(p => `_ ${p.name}: ${p.swiftType}`).join(', '); + const static_ = member.type === 'static_method' ? 'static ' : ''; + const returnClause = member.swiftReturnType !== 'Void' ? ` -> ${member.swiftReturnType}` : ''; + return `${docComment} ${override}public ${static_}func ${member.name}(${params})${returnClause} { + ${member.implementation} + }`; + } + default: + return ''; + } + } + generateConstructorMember(member) { + const params = member.parameters.map(p => `_ ${p.name}: ${p.swiftType}`).join(', '); + const factoryName = member.name === member.swiftReturnType ? 'convenience init' : `static func ${member.name}`; + const docComment = this.formatSwiftDocumentation(member.documentation, member); + if (member.name === member.swiftReturnType) { + // Convenience initializer + // Only root classes (not subclasses) need override for no-arg init + // Check if this is a root class by looking at swiftClass + const swiftClass = this.classMap.get(this.fromSwiftTypeName(member.swiftReturnType)); + const isRootClass = swiftClass && !this.inheritance[swiftClass.name]?.extends; + const override = (params === '' && isRootClass) ? 'override ' : ''; + return `${docComment} public ${override}convenience init(${params}) { + ${member.implementation.replace(`return ${member.swiftReturnType}(fromPointer: ptr!)`, 'self.init(fromPointer: ptr!)')} + }`; + } + else { + // Static factory method + return `${docComment} public static func ${member.name}(${params}) -> ${member.swiftReturnType} { + ${member.implementation} + }`; + } + } + formatSwiftDocumentation(doc, member) { + if (!doc) + return ''; + const lines = []; + // Add summary + if (doc.summary) { + this.wrapDocText(doc.summary, lines, ' /// '); + } + // Add details if present + if (doc.details) { + if (doc.summary) { + lines.push(' ///'); + } + this.wrapDocText(doc.details, lines, ' /// '); + } + // Add parameter documentation (skip 'self' and 'value' for setters) + if (doc.params && Object.keys(doc.params).length > 0) { + const hasContent = doc.summary || doc.details; + if (hasContent) + lines.push(' ///'); + for (const [paramName, paramDesc] of Object.entries(doc.params)) { + // Skip 'self' parameter documentation as it's implicit + if (paramName === 'self' || paramName === 'this') + continue; + // For setters, map the parameter documentation to 'newValue' + if (member.type === 'setter' && member.parameters[0]) { + lines.push(` /// - Parameter newValue: ${paramDesc}`); + } + else { + // Check if this parameter exists in the member + const paramExists = member.parameters.some(p => p.name === paramName); + if (paramExists) { + lines.push(` /// - Parameter ${paramName}: ${paramDesc}`); + } + } + } + } + // Add return documentation (not for setters or constructors) + if (doc.returns && member.type !== 'setter' && member.type !== 'constructor') { + if (lines.length > 0) + lines.push(' ///'); + lines.push(` /// - Returns: ${doc.returns}`); + } + // Add deprecation notice + if (doc.deprecated) { + if (lines.length > 0) + lines.push(' ///'); + lines.push(` /// - Warning: Deprecated - ${doc.deprecated}`); + } + if (lines.length > 0) { + return lines.join('\n') + '\n'; + } + return ''; + } + wrapDocText(text, lines, prefix) { + const maxLineLength = 100; + const maxTextLength = maxLineLength - prefix.length; + // Split text into paragraphs + const paragraphs = text.split('\n\n'); + for (let i = 0; i < paragraphs.length; i++) { + if (i > 0) { + lines.push(prefix.trim()); + } + const paragraph = paragraphs[i].replace(/\n/g, ' '); + const words = paragraph.split(' '); + let currentLine = ''; + for (const word of words) { + if (currentLine.length === 0) { + currentLine = word; + } + else if (currentLine.length + word.length + 1 <= maxTextLength) { + currentLine += ' ' + word; + } + else { + lines.push(prefix + currentLine); + currentLine = word; + } + } + if (currentLine.length > 0) { + lines.push(prefix + currentLine); + } + } + } + generateEnumCode(swiftEnum) { + const lines = []; + lines.push(this.generateHeader()); + lines.push(''); + lines.push('import Foundation'); + lines.push(''); + lines.push(`/// ${swiftEnum.name} enum`); + lines.push(`public enum ${swiftEnum.name}: Int32, CaseIterable {`); + // Write enum values + for (const value of swiftEnum.values) { + lines.push(` case ${value.name} = ${value.value}`); + } + lines.push(''); + lines.push(` public static func fromValue(_ value: Int32) -> ${swiftEnum.name}? {`); + lines.push(` return ${swiftEnum.name}(rawValue: value)`); + lines.push(' }'); + lines.push('}'); + return lines.join('\n'); + } + // Generate arrays.swift file + async writeArraysFile(cArrayTypes) { + const lines = []; + lines.push(this.generateHeader()); + lines.push(''); + lines.push('import Foundation'); + lines.push('import SpineC'); + // Collect all imports needed for all array types + const imports = new Set(); + for (const arrayType of cArrayTypes) { + const elementType = this.extractArrayElementType(arrayType.name); + if (!this.isPrimitiveArrayType(elementType)) { + // Import the element type + const swiftElementType = this.toSwiftTypeName(`spine_${toSnakeCase(elementType)}`); + // We don't need separate imports in Swift, they're all in the same module + } + } + // Generate all array classes + for (const arrayType of cArrayTypes) { + lines.push(''); + lines.push(...this.generateArrayClassLines(arrayType)); + } + const filePath = path.join(this.outputDir, 'arrays.swift'); + fs.writeFileSync(filePath, lines.join('\n')); + } + // Array generation + generateArrayClassLines(arrayType) { + const lines = []; + const swiftClassName = this.toSwiftTypeName(arrayType.name); + const elementType = this.extractArrayElementType(arrayType.name); + const cTypeName = this.toCTypeName(swiftClassName); + lines.push(`/// ${swiftClassName} wrapper`); + lines.push(`@objc(Spine${swiftClassName})`); + lines.push(`@objcMembers`); + lines.push(`public class ${swiftClassName}: NSObject {`); + lines.push(' public let _ptr: UnsafeMutableRawPointer'); + lines.push(' private let _ownsMemory: Bool'); + lines.push(''); + // Constructor + lines.push(` public init(fromPointer ptr: ${cTypeName}, ownsMemory: Bool = false) {`); + lines.push(' self._ptr = UnsafeMutableRawPointer(ptr)'); + lines.push(' self._ownsMemory = ownsMemory'); + lines.push(' super.init()'); + lines.push(' }'); + lines.push(''); + // No computed property - cast _ptr inline when needed + lines.push(''); + // Find create methods for constructors + const createMethod = arrayType.constructors?.find(m => m.name === `${arrayType.name}_create`); + const createWithCapacityMethod = arrayType.constructors?.find(m => m.name === `${arrayType.name}_create_with_capacity`); + // Add default constructor + if (createMethod) { + lines.push(' /// Create a new empty array'); + lines.push(' public override convenience init() {'); + lines.push(` let ptr = ${createMethod.name}()!`); + lines.push(' self.init(fromPointer: ptr, ownsMemory: true)'); + lines.push(' }'); + lines.push(''); + } + // Add constructor with initial capacity + if (createWithCapacityMethod) { + lines.push(' /// Create a new array with the specified initial capacity'); + lines.push(' public convenience init(capacity: Int) {'); + lines.push(` let ptr = ${createWithCapacityMethod.name}(capacity)!`); + lines.push(' self.init(fromPointer: ptr, ownsMemory: true)'); + lines.push(' }'); + lines.push(''); + } + // Find size and buffer methods + const sizeMethod = arrayType.methods.find(m => m.name.endsWith('_size') && !m.name.endsWith('_set_size')); + const bufferMethod = arrayType.methods.find(m => m.name.endsWith('_buffer')); + const setMethod = arrayType.methods.find(m => m.name.endsWith('_set') && m.parameters.length === 3); + const setSizeMethod = arrayType.methods.find(m => m.name.endsWith('_set_size')); + const addMethod = arrayType.methods.find(m => m.name.endsWith('_add') && !m.name.endsWith('_add_all')); + const clearMethod = arrayType.methods.find(m => m.name.endsWith('_clear') && !m.name.endsWith('_clear_and_add_all')); + const removeAtMethod = arrayType.methods.find(m => m.name.endsWith('_remove_at')); + const ensureCapacityMethod = arrayType.methods.find(m => m.name.endsWith('_ensure_capacity')); + if (sizeMethod) { + lines.push(' public var count: Int {'); + lines.push(` return Int(${sizeMethod.name}(_ptr.assumingMemoryBound(to: ${cTypeName}_wrapper.self)))`); + lines.push(' }'); + lines.push(''); + } + if (bufferMethod) { + const swiftElementType = this.toSwiftArrayElementType(elementType); + lines.push(` public subscript(index: Int) -> ${swiftElementType} {`); + lines.push(' get {'); + lines.push(' precondition(index >= 0 && index < count, "Index out of bounds")'); + lines.push(` let buffer = ${bufferMethod.name}(_ptr.assumingMemoryBound(to: ${cTypeName}_wrapper.self))!`); + // Handle different element types + if (elementType === 'int') { + lines.push(' return buffer[Int(index)]'); + } + else if (elementType === 'float') { + lines.push(' return buffer[Int(index)]'); + } + else if (elementType === 'bool') { + lines.push(' return buffer[Int(index)] != 0'); + } + else if (elementType === 'unsigned_short') { + lines.push(' return buffer[Int(index)]'); + } + else if (elementType === 'property_id') { + lines.push(' return buffer[Int(index)]'); + } + else { + // For object types + const swiftType = this.toSwiftTypeName(`spine_${toSnakeCase(elementType)}`); + const cElementType = `spine_${toSnakeCase(elementType)}`; + const cClass = this.classMap.get(cElementType); + const elementCType = this.getArrayElementCType(arrayType.name); + lines.push(` let elementPtr = buffer[Int(index)]`); + if (cClass && this.isAbstract(cClass)) { + // Use RTTI to determine concrete type + lines.push(' guard let ptr = elementPtr else { return nil }'); + const rttiCode = this.generateRttiBasedInstantiation(swiftType, 'ptr', cClass); + lines.push(` ${rttiCode}`); + } + else { + lines.push(` return elementPtr.map { ${swiftType}(fromPointer: $0) }`); + } + } + lines.push(' }'); + // Setter if available + if (setMethod) { + lines.push(' set {'); + lines.push(' precondition(index >= 0 && index < count, "Index out of bounds")'); + const param = setMethod.parameters[2]; // The value parameter + const nullableParam = { ...param, isNullable: !this.isPrimitiveArrayType(elementType) }; + const convertedValue = this.convertSwiftToC('newValue', nullableParam); + lines.push(` ${setMethod.name}(_ptr.assumingMemoryBound(to: ${cTypeName}_wrapper.self), index, ${convertedValue})`); + lines.push(' }'); + } + lines.push(' }'); + lines.push(''); + } + // Add method if available + if (addMethod) { + const swiftElementType = this.toSwiftArrayElementType(elementType); + lines.push(' /// Adds a value to the end of this array'); + lines.push(` public func add(_ value: ${swiftElementType}) {`); + const param = addMethod.parameters[1]; + const nullableParam = { ...param, isNullable: !this.isPrimitiveArrayType(elementType) }; + const convertedValue = this.convertSwiftToC('value', nullableParam); + lines.push(` ${addMethod.name}(_ptr.assumingMemoryBound(to: ${cTypeName}_wrapper.self), ${convertedValue})`); + lines.push(' }'); + lines.push(''); + } + // Clear method if available + if (clearMethod) { + lines.push(' /// Removes all elements from this array'); + lines.push(' public func clear() {'); + lines.push(` ${clearMethod.name}(_ptr.assumingMemoryBound(to: ${cTypeName}_wrapper.self))`); + lines.push(' }'); + lines.push(''); + } + // RemoveAt method if available + if (removeAtMethod) { + const swiftElementType = this.toSwiftArrayElementType(elementType); + lines.push(' /// Removes the element at the given index'); + lines.push(` @discardableResult`); + lines.push(` public func removeAt(_ index: Int) -> ${swiftElementType} {`); + lines.push(' precondition(index >= 0 && index < count, "Index out of bounds")'); + lines.push(' let value = self[index]'); + lines.push(` ${removeAtMethod.name}(_ptr.assumingMemoryBound(to: ${cTypeName}_wrapper.self), index)`); + lines.push(' return value'); + lines.push(' }'); + lines.push(''); + } + // Set size method + if (setSizeMethod) { + lines.push(' /// Sets the size of this array'); + lines.push(' public var length: Int {'); + lines.push(' get { count }'); + lines.push(' set {'); + if (this.isPrimitiveArrayType(elementType)) { + let defaultValue = '0'; + if (elementType === 'float') + defaultValue = '0.0'; + else if (elementType === 'bool') + defaultValue = 'false'; + lines.push(` ${setSizeMethod.name}(_ptr.assumingMemoryBound(to: ${cTypeName}_wrapper.self), newValue, ${defaultValue})`); + } + else { + lines.push(` ${setSizeMethod.name}(_ptr.assumingMemoryBound(to: ${cTypeName}_wrapper.self), newValue, nil)`); + } + lines.push(' }'); + lines.push(' }'); + lines.push(''); + } + // EnsureCapacity method if available + if (ensureCapacityMethod) { + lines.push(' /// Ensures this array has at least the given capacity'); + lines.push(' public func ensureCapacity(_ capacity: Int) {'); + lines.push(` ${ensureCapacityMethod.name}(_ptr.assumingMemoryBound(to: ${cTypeName}_wrapper.self), capacity)`); + lines.push(' }'); + lines.push(''); + } + // Deinit + if (arrayType.destructor) { + lines.push(' deinit {'); + lines.push(' if _ownsMemory {'); + lines.push(` ${arrayType.destructor.name}(_ptr.assumingMemoryBound(to: ${cTypeName}_wrapper.self))`); + lines.push(' }'); + lines.push(' }'); + } + lines.push('}'); + return lines; + } + extractArrayElementType(arrayTypeName) { + const match = arrayTypeName.match(/spine_array_(.+)/); + if (match) { + return match[1]; + } + return 'Any'; + } + getArrayElementCType(arrayTypeName) { + const elementType = this.extractArrayElementType(arrayTypeName); + if (this.isPrimitiveArrayType(elementType)) { + if (elementType === 'int') + return 'Int32'; + if (elementType === 'float') + return 'Float'; + if (elementType === 'unsigned_short') + return 'UInt16'; + if (elementType === 'property_id') + return 'Int64'; + return elementType; + } + // For object types, return the C type name + return `spine_${elementType}`; + } + toSwiftArrayElementType(elementType) { + if (this.isPrimitiveArrayType(elementType)) { + if (elementType === 'int') + return 'Int32'; + if (elementType === 'float') + return 'Float'; + if (elementType === 'bool') + return 'Bool'; + if (elementType === 'unsigned_short') + return 'UInt16'; + if (elementType === 'property_id') + return 'Int64'; + } + // For object types, make them optional since arrays can contain nulls + const swiftType = this.toSwiftTypeName(`spine_${toSnakeCase(elementType)}`); + return swiftType + '?'; + } + isPrimitiveArrayType(elementType) { + return ['int', 'float', 'bool', 'unsigned_short', 'property_id'].includes(elementType.toLowerCase()); + } + // Helper methods + sortByInheritance(cTypes) { + const sorted = []; + const processed = new Set(); + const processClass = (cType) => { + if (processed.has(cType.name)) { + return; + } + // Process concrete parent first (skip interfaces) + const inheritanceInfo = this.inheritance[cType.name]; + if (inheritanceInfo?.extends) { + const parent = this.classMap.get(inheritanceInfo.extends); + if (parent) { + processClass(parent); + } + } + // Process interface dependencies + for (const interfaceName of inheritanceInfo?.mixins || []) { + const interfaceClass = this.classMap.get(interfaceName); + if (interfaceClass) { + processClass(interfaceClass); + } + } + sorted.push(cType); + processed.add(cType.name); + }; + for (const cType of cTypes) { + processClass(cType); + } + return sorted; + } + hasRttiMethod(cType) { + return cType.methods.some(m => m.name === `${cType.name}_rtti` && m.parameters.length === 0); + } + collectImports(cType) { + const imports = new Set(); + // In Swift, we don't need to import individual files within the same module + // All generated types are in the same module + return Array.from(imports).sort(); + } + isMethodOverride(method, cType) { + // Static methods cannot be overridden + const isStatic = method.parameters.length === 0 || + (method.parameters[0].name !== 'self' && + !method.parameters[0].cType.startsWith(cType.name)); + if (isStatic) { + return false; + } + // In Swift, we only use 'override' when overriding a superclass method, + // NOT when implementing a protocol requirement + // Check if this method exists in parent CLASS (not protocol/interface) + const parentName = this.inheritance[cType.name]?.extends; + if (parentName) { + const parent = this.classMap.get(parentName); + if (parent) { + const methodSuffix = this.getMethodSuffix(method.name, cType.name); + const parentMethodName = `${parentName}_${methodSuffix}`; + if (parent.methods.some(m => m.name === parentMethodName)) { + return true; + } + } + } + // DO NOT check interfaces/protocols - implementing protocol requirements doesn't use 'override' + // Protocol conformance is handled without the override keyword in Swift + return false; + } + // Utility methods + toSwiftTypeName(cTypeName) { + if (cTypeName.startsWith('spine_')) { + const name = cTypeName.slice(6); + return this.toPascalCase(name); + } + return this.toPascalCase(cTypeName); + } + toCTypeName(swiftTypeName) { + return `spine_${toSnakeCase(swiftTypeName)}`; + } + toSwiftMethodName(cMethodName, cTypeName) { + const prefix = `${cTypeName}_`; + if (cMethodName.startsWith(prefix)) { + return this.toCamelCase(cMethodName.slice(prefix.length)); + } + return this.toCamelCase(cMethodName); + } + toSwiftEnumValueName(cValueName, cEnumName) { + const enumNameUpper = cEnumName.toUpperCase(); + const prefixes = [ + `SPINE_${enumNameUpper}_`, + `${enumNameUpper}_`, + 'SPINE_' + ]; + let name = cValueName; + for (const prefix of prefixes) { + if (name.startsWith(prefix)) { + name = name.slice(prefix.length); + break; + } + } + const enumValue = this.toCamelCase(name.toLowerCase()); + // Handle Swift reserved words + const swiftReservedWords = ['in', 'out', 'repeat', 'return', 'throw', 'continue', 'break', 'case', 'default', 'where', 'while', 'for', 'if', 'else', 'switch']; + if (swiftReservedWords.includes(enumValue)) { + return `\`${enumValue}\``; + } + return enumValue; + } + toSwiftReturnType(cType, nullable) { + let baseType; + if (cType === 'void') + return 'Void'; + if (cType === 'char*' || cType === 'char *' || cType === 'const char*' || cType === 'const char *') + baseType = 'String'; + else if (cType === 'float' || cType === 'double') + baseType = 'Float'; + else if (cType === 'size_t') + baseType = 'Int'; + else if (cType === 'int' || cType === 'int32_t' || cType === 'uint32_t') + baseType = 'Int32'; + else if (cType === 'bool') + baseType = 'Bool'; + // Handle primitive pointer types + else if (cType === 'void*' || cType === 'void *') + baseType = 'UnsafeMutableRawPointer'; + else if (cType === 'float*' || cType === 'float *') + baseType = 'UnsafeMutablePointer'; + else if (cType === 'uint32_t*' || cType === 'uint32_t *') + baseType = 'UnsafeMutablePointer'; + else if (cType === 'uint16_t*' || cType === 'uint16_t *') + baseType = 'UnsafeMutablePointer'; + else if (cType === 'int*' || cType === 'int *') + baseType = 'UnsafeMutablePointer'; + else + baseType = this.toSwiftTypeName(cType); + return nullable ? `${baseType}?` : baseType; + } + toSwiftParameterType(param) { + if (param.cType === 'char*' || param.cType === 'char *' || param.cType === 'const char*' || param.cType === 'const char *') { + return 'String'; + } + // Handle void* parameters + if (param.cType === 'void*' || param.cType === 'void *') { + return 'UnsafeMutableRawPointer'; + } + return this.toSwiftReturnType(param.cType, param.isNullable); + } + convertSwiftToC(swiftValue, param) { + if (param.cType === 'char*' || param.cType === 'char *' || param.cType === 'const char*' || param.cType === 'const char *') { + return swiftValue; + } + if (this.enumNames.has(param.cType)) { + // Convert Swift enum to C enum + // C enums in Swift are their own types with rawValue + if (param.isNullable) { + return `${param.cType}(rawValue: UInt32(${swiftValue}?.rawValue ?? 0))`; + } + return `${param.cType}(rawValue: UInt32(${swiftValue}.rawValue))`; + } + if (param.cType.startsWith('spine_')) { + // Cast the raw pointer to the expected type + const cTypeName = this.toCTypeName(this.toSwiftTypeName(param.cType)); + if (param.isNullable) { + return `${swiftValue}?._ptr.assumingMemoryBound(to: ${cTypeName}_wrapper.self)`; + } + return `${swiftValue}._ptr.assumingMemoryBound(to: ${cTypeName}_wrapper.self)`; + } + // size_t parameters are already Int in Swift, no conversion needed + if (param.cType === 'size_t') { + return swiftValue; + } + // Keep int32_t and int as-is since Swift Int32 maps to these + if (param.cType === 'int' || param.cType === 'int32_t') { + return swiftValue; + } + return swiftValue; + } + generateReturnConversion(cReturnType, resultVar, nullable) { + if (cReturnType === 'char*' || cReturnType === 'char *' || cReturnType === 'const char*' || cReturnType === 'const char *') { + if (nullable) { + return `return ${resultVar}.map { String(cString: $0) }`; + } + return `return String(cString: ${resultVar}!)`; + } + if (this.enumNames.has(cReturnType)) { + const swiftType = this.toSwiftTypeName(cReturnType); + // C enums in Swift are their own types with .rawValue property + if (nullable) { + return `return ${resultVar}.map { ${swiftType}(rawValue: Int32($0.rawValue)) }`; + } + return `return ${swiftType}(rawValue: Int32(${resultVar}.rawValue))!`; + } + if (cReturnType.startsWith('spine_array_')) { + const swiftType = this.toSwiftTypeName(cReturnType); + if (nullable) { + return `return ${resultVar}.map { ${swiftType}(fromPointer: $0) }`; + } + return `return ${swiftType}(fromPointer: ${resultVar}!)`; + } + if (cReturnType.startsWith('spine_')) { + const swiftType = this.toSwiftTypeName(cReturnType); + const cClass = this.classMap.get(cReturnType); + if (nullable) { + if (cClass && this.isAbstract(cClass)) { + return `guard let ptr = ${resultVar} else { return nil } + ${this.generateRttiBasedInstantiation(swiftType, 'ptr', cClass)}`; + } + return `return ${resultVar}.map { ${swiftType}(fromPointer: $0) }`; + } + else { + if (cClass && this.isAbstract(cClass)) { + return this.generateRttiBasedInstantiation(swiftType, `${resultVar}!`, cClass); + } + return `return ${swiftType}(fromPointer: ${resultVar}!)`; + } + } + return `return ${resultVar}`; + } + generateRttiBasedInstantiation(abstractType, resultVar, abstractClass) { + const lines = []; + const concreteSubclasses = this.getConcreteSubclasses(abstractClass.name); + if (concreteSubclasses.length === 0) { + return `fatalError("Cannot instantiate abstract class ${abstractType} from pointer - no concrete subclasses found")`; + } + lines.push(`let rtti = ${abstractClass.name}_get_rtti(${resultVar})`); + lines.push(`let rttiClassName = String(cString: spine_rtti_get_class_name(rtti)!)`); + lines.push(`switch rttiClassName {`); + for (const subclass of concreteSubclasses) { + const swiftSubclass = this.toSwiftTypeName(subclass); + // RTTI returns the C++ class name in PascalCase (e.g., "TransformConstraint") + // We need to convert spine_transform_constraint -> TransformConstraint + const cppClassName = this.toPascalCase(subclass.replace('spine_', '')); + lines.push(`case "${cppClassName}":`); + // Use C cast function to handle pointer adjustment + const toType = subclass.replace('spine_', ''); + const castFunctionName = `${abstractClass.name}_cast_to_${toType}`; + lines.push(` let castedPtr = ${castFunctionName}(${resultVar})`); + lines.push(` return ${swiftSubclass}(fromPointer: castedPtr!)`); + } + lines.push(`default:`); + lines.push(` fatalError("Unknown concrete type: \\(rttiClassName) for abstract class ${abstractType}")`); + lines.push(`}`); + return lines.join('\n '); + } + getConcreteSubclasses(abstractClassName) { + const concreteSubclasses = []; + for (const [childName, supertypeList] of Object.entries(this.supertypes || {})) { + if (supertypeList.includes(abstractClassName)) { + const childClass = this.classMap.get(childName); + if (childClass && !this.isAbstract(childClass)) { + concreteSubclasses.push(childName); + } + } + } + return concreteSubclasses; + } + isAbstract(cType) { + return cType.cppType.isAbstract === true; + } + getConstructorName(constr, cType) { + const swiftClassName = this.toSwiftTypeName(cType.name); + const cTypeName = this.toCTypeName(swiftClassName); + let constructorName = constr.name.replace(`${cTypeName}_create`, ''); + if (constructorName) { + if (/^\d+$/.test(constructorName)) { + if (cType.name === 'spine_color' && constr.name === 'spine_color_create2') { + constructorName = 'fromRGBA'; + } + else if (constr.parameters.length > 0) { + const firstParamType = constr.parameters[0].cType.replace('*', '').trim(); + if (firstParamType === cType.name) { + constructorName = 'from'; + } + else { + constructorName = `variant${constructorName}`; + } + } + else { + constructorName = `variant${constructorName}`; + } + } + else if (constructorName.startsWith('_')) { + constructorName = this.toCamelCase(constructorName.slice(1)); + } + } + return constructorName || swiftClassName; + } + extractPropertyName(methodName, typeName) { + const prefix = `${typeName}_`; + let name = methodName.startsWith(prefix) ? methodName.slice(prefix.length) : methodName; + if (name.startsWith('get_')) { + name = name.slice(4); + } + else if (name.startsWith('set_')) { + name = name.slice(4); + } + if (name === 'update_cache') { + return 'updateCacheList'; + } + const typeNames = ['int', 'float', 'double', 'bool', 'string']; + if (typeNames.includes(name.toLowerCase())) { + return `${this.toCamelCase(name)}Value`; + } + let propertyName = this.toCamelCase(name); + // Rename properties that conflict with NSObject + if (propertyName === 'className') { + return 'rttiClassName'; + } + if (propertyName === 'hash') { + return 'hashString'; + } + return propertyName; + } + hasRawPointerParameters(method) { + for (const param of method.parameters) { + if (this.isRawPointer(param.cType)) { + return true; + } + } + return false; + } + isRawPointer(cType) { + if (cType === 'char*' || cType === 'char *' || cType === 'const char*' || cType === 'const char *') { + return false; + } + if (cType.includes('*')) { + const cleanType = cType.replace('*', '').trim(); + if (!cleanType.startsWith('spine_')) { + return true; + } + } + return false; + } + isMethodInherited(method, cType) { + const parentName = this.inheritance[cType.name]?.extends; + if (!parentName) { + return false; + } + const parent = this.classMap.get(parentName); + if (!parent) { + return false; + } + const methodSuffix = this.getMethodSuffix(method.name, cType.name); + // Don't consider dispose methods as inherited - they're type-specific + if (methodSuffix === 'dispose') { + return false; + } + const parentMethodName = `${parentName}_${methodSuffix}`; + const hasInParent = parent.methods.some(m => m.name === parentMethodName); + if (hasInParent) { + return true; + } + return this.isMethodInherited(method, parent); + } + getMethodSuffix(methodName, typeName) { + const prefix = `${typeName}_`; + if (methodName.startsWith(prefix)) { + return methodName.slice(prefix.length); + } + return methodName; + } + renumberMethods(methods, typeName) { + const result = []; + const methodGroups = new Map(); + for (const method of methods) { + const match = method.name.match(/^(.+?)_(\d+)$/); + if (match) { + const baseName = match[1]; + if (!methodGroups.has(baseName)) { + methodGroups.set(baseName, []); + } + methodGroups.get(baseName).push(method); + } + else { + result.push({ method }); + } + } + for (const [baseName, groupedMethods] of methodGroups) { + if (groupedMethods.length === 1) { + const method = groupedMethods[0]; + const swiftMethodName = this.toSwiftMethodName(baseName, typeName); + result.push({ method, renamedMethod: swiftMethodName }); + } + else { + groupedMethods.sort((a, b) => { + const aNum = parseInt(a.name.match(/_(\d+)$/)[1]); + const bNum = parseInt(b.name.match(/_(\d+)$/)[1]); + return aNum - bNum; + }); + for (let i = 0; i < groupedMethods.length; i++) { + const method = groupedMethods[i]; + const newNumber = i + 1; + const currentNumber = parseInt(method.name.match(/_(\d+)$/)[1]); + const baseSwiftName = this.toSwiftMethodName(baseName, typeName); + if (i === 0) { + // First method in the group - remove the number + result.push({ method, renamedMethod: baseSwiftName }); + } + else if (newNumber !== currentNumber) { + // Need to renumber + result.push({ method, renamedMethod: `${baseSwiftName}${newNumber}` }); + } + else { + // Number is correct, no renamed method needed + result.push({ method }); + } + } + } + } + return result; + } + async writeExportFile(classes, enums) { + // Swift doesn't need an export file like Dart does + // All public types are automatically available within the module + return; + } + fromSwiftTypeName(swiftTypeName) { + // Convert Swift class name back to C type name + return `spine_${toSnakeCase(swiftTypeName)}`; + } + toPascalCase(str) { + return str.split('_') + .map(word => word.charAt(0).toUpperCase() + word.slice(1)) + .join(''); + } + toCamelCase(str) { + const pascal = this.toPascalCase(str); + return pascal.charAt(0).toLowerCase() + pascal.slice(1); + } +} diff --git a/spine-ios/codegen/src/swift-writer.ts b/spine-ios/codegen/src/swift-writer.ts index 7d8323f1e..5b61a6264 100644 --- a/spine-ios/codegen/src/swift-writer.ts +++ b/spine-ios/codegen/src/swift-writer.ts @@ -2,6 +2,7 @@ import * as fs from 'node:fs'; import * as path from 'node:path'; import { fileURLToPath } from 'node:url'; import type { CClassOrStruct, CEnum, CMethod, CParameter } from '../../../spine-c/codegen/src/c-types.js'; +import type { DocumentationComment } from '../../../spine-c/codegen/src/types.js'; import { toSnakeCase } from '../../../spine-c/codegen/src/types.js'; const __dirname = path.dirname(fileURLToPath(import.meta.url)); @@ -39,6 +40,7 @@ interface SwiftClass { imports: string[]; // All required imports members: SwiftMember[]; // All class members hasRtti: boolean; // Whether this class needs RTTI switching + documentation?: DocumentationComment; // Class-level documentation from C++ source } interface SwiftMember { @@ -51,6 +53,7 @@ interface SwiftMember { cMethodName?: string; // Original C method name (for reference) hasSetter?: boolean; // For getters, indicates if there's also a setter setterImplementation?: string; // Implementation for the setter part + documentation?: DocumentationComment; // Documentation from C++ source } interface SwiftParameter { @@ -249,6 +252,7 @@ export class SwiftWriter { imports: this.collectImports(cType), members: this.processMembers(cType, classType), hasRtti: this.hasRttiMethod(cType), + documentation: cType.cppType?.documentation }; } @@ -339,7 +343,8 @@ export class SwiftWriter { isOverride: false, implementation: '', // No implementation for protocols cMethodName: getter.name, - hasSetter: true // Mark that this property has a setter + hasSetter: true, // Mark that this property has a setter + documentation: getter.documentation || setter.documentation // Use getter's doc if available, otherwise setter's }; } @@ -362,7 +367,8 @@ export class SwiftWriter { implementation: getterImpl, setterImplementation: setterImpl, cMethodName: getter.name, - hasSetter: true + hasSetter: true, + documentation: getter.documentation || setter.documentation // Use getter's doc if available, otherwise setter's }; } @@ -444,7 +450,8 @@ export class SwiftWriter { parameters: [], isOverride: false, implementation: `${destructor.name}(_ptr.assumingMemoryBound(to: ${cTypeName}_wrapper.self))`, - cMethodName: destructor.name + cMethodName: destructor.name, + documentation: destructor.documentation }; } @@ -467,7 +474,8 @@ export class SwiftWriter { parameters: params, isOverride: false, implementation, - cMethodName: constr.name + cMethodName: constr.name, + documentation: constr.documentation }; } @@ -507,7 +515,8 @@ export class SwiftWriter { parameters: [], isOverride, implementation, - cMethodName: method.name + cMethodName: method.name, + documentation: method.documentation }; } @@ -546,7 +555,8 @@ export class SwiftWriter { parameters: [swiftParam], isOverride, implementation, - cMethodName: method.name + cMethodName: method.name, + documentation: method.documentation }; } @@ -603,7 +613,8 @@ export class SwiftWriter { parameters: params, isOverride, implementation, - cMethodName: method.name + cMethodName: method.name, + documentation: method.documentation }; } @@ -681,8 +692,11 @@ export class SwiftWriter { declaration += `: ${inheritanceParts.join(', ')}`; } + // Generate class documentation + const docComment = this.formatClassDocumentation(swiftClass.documentation, swiftClass.name); + return ` -/// ${swiftClass.name} wrapper +${docComment} ${declaration} {`; } @@ -824,6 +838,7 @@ ${declaration} {`; // Member generation private generateMember(member: SwiftMember, swiftClass: SwiftClass): string { const override = member.isOverride ? 'override ' : ''; + const docComment = this.formatSwiftDocumentation(member.documentation, member); switch (member.type) { case 'constructor': @@ -831,7 +846,7 @@ ${declaration} {`; case 'getter': // Check if this is a combined getter/setter property if (member.hasSetter && member.setterImplementation) { - return ` ${override}public var ${member.name}: ${member.swiftReturnType} { + return `${docComment} ${override}public var ${member.name}: ${member.swiftReturnType} { get { ${member.implementation} } @@ -840,13 +855,13 @@ ${declaration} {`; } }`; } else { - return ` ${override}public var ${member.name}: ${member.swiftReturnType} { + return `${docComment} ${override}public var ${member.name}: ${member.swiftReturnType} { ${member.implementation} }`; } case 'setter': { const param = member.parameters[0]; - return ` ${override}public var ${member.name}: ${param.swiftType} { + return `${docComment} ${override}public var ${member.name}: ${param.swiftType} { get { fatalError("Setter-only property") } set(newValue) { ${member.implementation} @@ -858,7 +873,7 @@ ${declaration} {`; const params = member.parameters.map(p => `_ ${p.name}: ${p.swiftType}`).join(', '); const static_ = member.type === 'static_method' ? 'static ' : ''; const returnClause = member.swiftReturnType !== 'Void' ? ` -> ${member.swiftReturnType}` : ''; - return ` ${override}public ${static_}func ${member.name}(${params})${returnClause} { + return `${docComment} ${override}public ${static_}func ${member.name}(${params})${returnClause} { ${member.implementation} }`; } @@ -870,6 +885,7 @@ ${declaration} {`; private generateConstructorMember(member: SwiftMember): string { const params = member.parameters.map(p => `_ ${p.name}: ${p.swiftType}`).join(', '); const factoryName = member.name === member.swiftReturnType ? 'convenience init' : `static func ${member.name}`; + const docComment = this.formatSwiftDocumentation(member.documentation, member); if (member.name === member.swiftReturnType) { // Convenience initializer @@ -878,17 +894,156 @@ ${declaration} {`; const swiftClass = this.classMap.get(this.fromSwiftTypeName(member.swiftReturnType)); const isRootClass = swiftClass && !this.inheritance[swiftClass.name]?.extends; const override = (params === '' && isRootClass) ? 'override ' : ''; - return ` public ${override}convenience init(${params}) { + return `${docComment} public ${override}convenience init(${params}) { ${member.implementation.replace(`return ${member.swiftReturnType}(fromPointer: ptr!)`, 'self.init(fromPointer: ptr!)')} }`; } else { // Static factory method - return ` public static func ${member.name}(${params}) -> ${member.swiftReturnType} { + return `${docComment} public static func ${member.name}(${params}) -> ${member.swiftReturnType} { ${member.implementation} }`; } } + private formatClassDocumentation(doc: DocumentationComment | undefined, className: string): string { + if (!doc) { + // Default documentation if none exists + return `/// ${className} wrapper`; + } + + const lines: string[] = []; + + // Add summary + if (doc.summary) { + this.wrapDocText(doc.summary, lines, '/// '); + } else { + // Fallback to default if no summary + lines.push(`/// ${className} wrapper`); + } + + // Add details if present + if (doc.details) { + lines.push('///'); + this.wrapDocText(doc.details, lines, '/// '); + } + + // Add deprecation notice + if (doc.deprecated) { + if (lines.length > 0) lines.push('///'); + lines.push(`/// - Warning: Deprecated - ${doc.deprecated}`); + } + + // Add since version + if (doc.since) { + if (lines.length > 0) lines.push('///'); + lines.push(`/// - Since: ${doc.since}`); + } + + // Add see also references + if (doc.see && doc.see.length > 0) { + if (lines.length > 0) lines.push('///'); + lines.push('/// - SeeAlso:'); + for (const ref of doc.see) { + lines.push(`/// - ${ref}`); + } + } + + if (lines.length > 0) { + return lines.join('\n'); + } + return `/// ${className} wrapper`; + } + + private formatSwiftDocumentation(doc: DocumentationComment | undefined, member: SwiftMember): string { + if (!doc) return ''; + + const lines: string[] = []; + + // Add summary + if (doc.summary) { + this.wrapDocText(doc.summary, lines, ' /// '); + } + + // Add details if present + if (doc.details) { + if (doc.summary) { + lines.push(' ///'); + } + this.wrapDocText(doc.details, lines, ' /// '); + } + + // Add parameter documentation (skip 'self' and 'value' for setters) + if (doc.params && Object.keys(doc.params).length > 0) { + const hasContent = doc.summary || doc.details; + if (hasContent) lines.push(' ///'); + + for (const [paramName, paramDesc] of Object.entries(doc.params)) { + // Skip 'self' parameter documentation as it's implicit + if (paramName === 'self' || paramName === 'this') continue; + // For setters, map the parameter documentation to 'newValue' + if (member.type === 'setter' && member.parameters[0]) { + lines.push(` /// - Parameter newValue: ${paramDesc}`); + } else { + // Check if this parameter exists in the member + const paramExists = member.parameters.some(p => p.name === paramName); + if (paramExists) { + lines.push(` /// - Parameter ${paramName}: ${paramDesc}`); + } + } + } + } + + // Add return documentation (not for setters or constructors) + if (doc.returns && member.type !== 'setter' && member.type !== 'constructor') { + if (lines.length > 0) lines.push(' ///'); + lines.push(` /// - Returns: ${doc.returns}`); + } + + // Add deprecation notice + if (doc.deprecated) { + if (lines.length > 0) lines.push(' ///'); + lines.push(` /// - Warning: Deprecated - ${doc.deprecated}`); + } + + if (lines.length > 0) { + return lines.join('\n') + '\n'; + } + return ''; + } + + private wrapDocText(text: string, lines: string[], prefix: string): void { + const maxLineLength = 100; + const maxTextLength = maxLineLength - prefix.length; + + // Split text into paragraphs + const paragraphs = text.split('\n\n'); + + for (let i = 0; i < paragraphs.length; i++) { + if (i > 0) { + lines.push(prefix.trim()); + } + + const paragraph = paragraphs[i].replace(/\n/g, ' '); + const words = paragraph.split(' '); + let currentLine = ''; + + for (const word of words) { + if (currentLine.length === 0) { + currentLine = word; + } else if (currentLine.length + word.length + 1 <= maxTextLength) { + currentLine += ' ' + word; + } else { + lines.push(prefix + currentLine); + currentLine = word; + } + } + + if (currentLine.length > 0) { + lines.push(prefix + currentLine); + } + } + } + private generateEnumCode(swiftEnum: SwiftEnum): string { const lines: string[] = [];