mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
[c][ios][flutter] More documentation related codegen
This commit is contained in:
parent
522101f569
commit
d62b2682bb
@ -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"
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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.
|
||||
*/
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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[] = [];
|
||||
|
||||
|
||||
Binary file not shown.
@ -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<spine_animation_wrapper> _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<Utf8>().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;
|
||||
|
||||
@ -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<Char>(), 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<Char>(), 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);
|
||||
|
||||
@ -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<spine_animation_state_data_wrapper> _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<Char>(), toName.toNativeUtf8().cast<Char>(), 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);
|
||||
|
||||
@ -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<Char>());
|
||||
return result.address == 0 ? null : AtlasRegion.fromPointer(result);
|
||||
|
||||
@ -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<spine_atlas_attachment_loader_wrapper> _ptr;
|
||||
|
||||
|
||||
@ -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<Char>());
|
||||
|
||||
@ -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<spine_bone_wrapper> _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);
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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<spine_bone_local_wrapper> _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);
|
||||
|
||||
@ -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<spine_bone_pose_wrapper> _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);
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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<spine_bone_timeline1_wrapper> _ptr;
|
||||
|
||||
|
||||
@ -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<spine_bone_timeline2_wrapper> _ptr;
|
||||
|
||||
|
||||
@ -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<spine_bounding_box_attachment_wrapper> _ptr;
|
||||
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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<spine_constraint_timeline1_wrapper> _ptr;
|
||||
|
||||
|
||||
@ -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<spine_curve_timeline_wrapper> _ptr;
|
||||
|
||||
|
||||
@ -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<spine_curve_timeline1_wrapper> _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;
|
||||
|
||||
@ -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<spine_deform_timeline_wrapper> _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);
|
||||
|
||||
@ -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<spine_draw_order_timeline_wrapper> _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));
|
||||
|
||||
@ -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<spine_event_wrapper> _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;
|
||||
|
||||
@ -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<spine_event_data_wrapper> _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<Utf8>().toDartString();
|
||||
|
||||
@ -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<spine_event_timeline_wrapper> _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());
|
||||
}
|
||||
|
||||
@ -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<spine_from_property_wrapper> _ptr;
|
||||
|
||||
|
||||
@ -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(),
|
||||
|
||||
@ -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<spine_ik_constraint_base_wrapper> _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);
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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<spine_ik_constraint_pose_wrapper> _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;
|
||||
|
||||
@ -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<spine_ik_constraint_timeline_wrapper> _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);
|
||||
|
||||
@ -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<spine_inherit_timeline_wrapper> _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);
|
||||
}
|
||||
|
||||
@ -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<spine_mesh_attachment_wrapper> _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);
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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<spine_path_constraint_base_wrapper> _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);
|
||||
|
||||
@ -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<spine_path_constraint_data_wrapper> _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;
|
||||
|
||||
@ -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<spine_path_constraint_mix_timeline_wrapper> _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);
|
||||
}
|
||||
|
||||
@ -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<spine_path_constraint_pose_wrapper> _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;
|
||||
|
||||
@ -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<spine_path_constraint_position_timeline_wrapper> _ptr;
|
||||
|
||||
|
||||
@ -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<spine_path_constraint_spacing_timeline_wrapper> _ptr;
|
||||
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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<spine_physics_constraint_base_wrapper> _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);
|
||||
|
||||
@ -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<spine_physics_constraint_damping_timeline_wrapper> _ptr;
|
||||
|
||||
|
||||
@ -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<spine_physics_constraint_data_wrapper> _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);
|
||||
|
||||
@ -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<spine_physics_constraint_gravity_timeline_wrapper> _ptr;
|
||||
|
||||
|
||||
@ -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<spine_physics_constraint_inertia_timeline_wrapper> _ptr;
|
||||
|
||||
|
||||
@ -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<spine_physics_constraint_mass_timeline_wrapper> _ptr;
|
||||
|
||||
|
||||
@ -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<spine_physics_constraint_mix_timeline_wrapper> _ptr;
|
||||
|
||||
|
||||
@ -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<spine_physics_constraint_pose_wrapper> _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;
|
||||
|
||||
@ -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<spine_physics_constraint_reset_timeline_wrapper> _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);
|
||||
}
|
||||
|
||||
@ -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<spine_physics_constraint_strength_timeline_wrapper> _ptr;
|
||||
|
||||
|
||||
@ -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<spine_physics_constraint_timeline_wrapper> _ptr;
|
||||
|
||||
|
||||
@ -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<spine_physics_constraint_wind_timeline_wrapper> _ptr;
|
||||
|
||||
|
||||
@ -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<spine_point_attachment_wrapper> _ptr;
|
||||
|
||||
|
||||
@ -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<spine_posed_active_wrapper> _ptr;
|
||||
|
||||
|
||||
@ -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<Utf8>().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;
|
||||
|
||||
@ -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<spine_region_attachment_wrapper> _ptr;
|
||||
|
||||
|
||||
@ -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<spine_rgb2_timeline_wrapper> _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);
|
||||
}
|
||||
|
||||
@ -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<spine_rgb_timeline_wrapper> _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);
|
||||
}
|
||||
|
||||
@ -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<spine_rgba2_timeline_wrapper> _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);
|
||||
}
|
||||
|
||||
@ -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<spine_rgba_timeline_wrapper> _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);
|
||||
}
|
||||
|
||||
@ -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<spine_rotate_timeline_wrapper> _ptr;
|
||||
|
||||
|
||||
@ -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<spine_scale_timeline_wrapper> _ptr;
|
||||
|
||||
|
||||
@ -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<spine_scale_x_timeline_wrapper> _ptr;
|
||||
|
||||
|
||||
@ -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<spine_scale_y_timeline_wrapper> _ptr;
|
||||
|
||||
|
||||
@ -70,6 +70,7 @@ class Sequence {
|
||||
return result.cast<Utf8>().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;
|
||||
|
||||
@ -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<spine_sequence_timeline_wrapper> _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);
|
||||
}
|
||||
|
||||
@ -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<spine_shear_timeline_wrapper> _ptr;
|
||||
|
||||
|
||||
@ -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<spine_shear_x_timeline_wrapper> _ptr;
|
||||
|
||||
|
||||
@ -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<spine_shear_y_timeline_wrapper> _ptr;
|
||||
|
||||
|
||||
@ -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<Char>());
|
||||
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<Char>());
|
||||
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<Char>(), attachmentName.toNativeUtf8().cast<Char>());
|
||||
@ -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<Char>());
|
||||
}
|
||||
|
||||
/// 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<Char>(), attachmentName.toNativeUtf8().cast<Char>());
|
||||
@ -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<Char>());
|
||||
|
||||
@ -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<spine_skeleton_bounds_wrapper> _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);
|
||||
|
||||
@ -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<spine_skeleton_data_wrapper> _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<Char>());
|
||||
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<Char>());
|
||||
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<Char>());
|
||||
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<Char>());
|
||||
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<Char>());
|
||||
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<Utf8>().toDartString();
|
||||
@ -94,21 +106,29 @@ class SkeletonData {
|
||||
SpineBindings.bindings.spine_skeleton_data_set_name(_ptr, value.toNativeUtf8().cast<Char>());
|
||||
}
|
||||
|
||||
/// 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<Utf8>().toDartString();
|
||||
@ -188,6 +221,8 @@ class SkeletonData {
|
||||
SpineBindings.bindings.spine_skeleton_data_set_version(_ptr, value.toNativeUtf8().cast<Char>());
|
||||
}
|
||||
|
||||
/// 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<Utf8>().toDartString();
|
||||
@ -197,6 +232,8 @@ class SkeletonData {
|
||||
SpineBindings.bindings.spine_skeleton_data_set_hash(_ptr, value.toNativeUtf8().cast<Char>());
|
||||
}
|
||||
|
||||
/// 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<Utf8>().toDartString();
|
||||
@ -206,6 +243,8 @@ class SkeletonData {
|
||||
SpineBindings.bindings.spine_skeleton_data_set_images_path(_ptr, value.toNativeUtf8().cast<Char>());
|
||||
}
|
||||
|
||||
/// 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<Utf8>().toDartString();
|
||||
@ -215,6 +254,8 @@ class SkeletonData {
|
||||
SpineBindings.bindings.spine_skeleton_data_set_audio_path(_ptr, value.toNativeUtf8().cast<Char>());
|
||||
}
|
||||
|
||||
/// 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;
|
||||
|
||||
@ -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<spine_skin_wrapper> _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<Char>(), 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<Char>());
|
||||
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<Char>());
|
||||
}
|
||||
|
||||
/// 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<Utf8>().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());
|
||||
}
|
||||
|
||||
@ -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<spine_slider_base_wrapper> _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);
|
||||
|
||||
@ -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<spine_slider_data_wrapper> _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());
|
||||
|
||||
@ -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<spine_slider_mix_timeline_wrapper> _ptr;
|
||||
|
||||
|
||||
@ -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<spine_slider_pose_wrapper> _ptr;
|
||||
|
||||
|
||||
@ -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<spine_slider_timeline_wrapper> _ptr;
|
||||
|
||||
|
||||
@ -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<spine_slot_wrapper> _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);
|
||||
|
||||
@ -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<spine_slot_curve_timeline_wrapper> _ptr;
|
||||
|
||||
|
||||
@ -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<spine_slot_data_wrapper> _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<Char>());
|
||||
}
|
||||
|
||||
/// 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<Utf8>().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;
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -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,
|
||||
|
||||
@ -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<spine_to_property_wrapper> _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);
|
||||
|
||||
@ -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<spine_track_entry_wrapper> _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);
|
||||
}
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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<spine_transform_constraint_base_wrapper> _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);
|
||||
|
||||
@ -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<spine_transform_constraint_data_wrapper> _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);
|
||||
|
||||
@ -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<spine_transform_constraint_pose_wrapper> _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;
|
||||
|
||||
@ -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<spine_transform_constraint_timeline_wrapper> _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(
|
||||
|
||||
@ -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<spine_translate_timeline_wrapper> _ptr;
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user