mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-04 14:24:53 +08:00
[flutter] codegen now uses nullability info from spine-c ir-generator to make return and parameter types optional if necessary.
This commit is contained in:
parent
7534416489
commit
03757139cd
@ -3,7 +3,8 @@
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"format": "npx -y typescript-formatter -r **/*.ts",
|
||||
"generate": "npx tsx src/index.ts"
|
||||
"generate": "npx tsx src/index.ts",
|
||||
"check": "npx biome check src && npx tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"spine-c-codegen": "file:../../spine-c/codegen"
|
||||
|
||||
@ -383,13 +383,13 @@ export class DartWriter {
|
||||
|
||||
private createGetter (method: CMethod, cType: CClassOrStruct, classType: 'concrete' | 'abstract' | 'interface', renamedMethod?: string): DartMember {
|
||||
const propertyName = renamedMethod || this.extractPropertyName(method.name, cType.name);
|
||||
const dartReturnType = this.toDartReturnType(method.returnType);
|
||||
const dartReturnType = this.toDartReturnType(method.returnType, method.returnTypeNullable);
|
||||
|
||||
// Interface methods have no implementation (from spec)
|
||||
let implementation = '';
|
||||
if (classType !== 'interface') {
|
||||
implementation = `final result = SpineBindings.bindings.${method.name}(_ptr);
|
||||
${this.generateReturnConversion(method.returnType, 'result')}`;
|
||||
${this.generateReturnConversion(method.returnType, 'result', method.returnTypeNullable)}`;
|
||||
}
|
||||
|
||||
// Check if this is an override
|
||||
@ -446,7 +446,7 @@ export class DartWriter {
|
||||
|
||||
private createMethod (method: CMethod, cType: CClassOrStruct, classType: 'concrete' | 'abstract' | 'interface', renamedMethod?: string): DartMember {
|
||||
let methodName = renamedMethod || this.toDartMethodName(method.name, cType.name);
|
||||
const dartReturnType = this.toDartReturnType(method.returnType);
|
||||
const dartReturnType = this.toDartReturnType(method.returnType, method.returnTypeNullable);
|
||||
|
||||
// Check if this is a static method
|
||||
const isStatic = method.parameters.length === 0 ||
|
||||
@ -479,7 +479,7 @@ export class DartWriter {
|
||||
implementation = `SpineBindings.bindings.${method.name}(${args});`;
|
||||
} else {
|
||||
implementation = `final result = SpineBindings.bindings.${method.name}(${args});
|
||||
${this.generateReturnConversion(method.returnType, 'result')}`;
|
||||
${this.generateReturnConversion(method.returnType, 'result', method.returnTypeNullable)}`;
|
||||
}
|
||||
}
|
||||
|
||||
@ -824,11 +824,13 @@ ${declaration} {`;
|
||||
const cClass = this.classMap.get(cElementType);
|
||||
|
||||
if (cClass && this.isAbstract(cClass)) {
|
||||
// Use RTTI to determine concrete type for abstract classes
|
||||
// Use RTTI to determine concrete type for abstract classes - handle null case
|
||||
lines.push(` if (buffer[index].address == 0) return null;`);
|
||||
const rttiCode = this.generateRttiBasedInstantiation(dartElementType, 'buffer[index]', cClass);
|
||||
lines.push(` ${rttiCode}`);
|
||||
} else {
|
||||
lines.push(` return ${dartElementType}.fromPointer(buffer[index]);`);
|
||||
// For array elements, check if the pointer is null
|
||||
lines.push(` return buffer[index].address == 0 ? null : ${dartElementType}.fromPointer(buffer[index]);`);
|
||||
}
|
||||
}
|
||||
|
||||
@ -846,7 +848,9 @@ ${declaration} {`;
|
||||
|
||||
// Convert value to C type
|
||||
const param = setMethod.parameters[2]; // The value parameter
|
||||
const convertedValue = this.convertDartToC('value', param);
|
||||
// Create a copy of the parameter with nullable flag for proper conversion
|
||||
const nullableParam = { ...param, isNullable: !this.isPrimitiveArrayType(elementType) };
|
||||
const convertedValue = this.convertDartToC('value', nullableParam);
|
||||
lines.push(` SpineBindings.bindings.${setMethod.name}(nativePtr.cast(), index, ${convertedValue});`);
|
||||
lines.push(' }');
|
||||
}
|
||||
@ -876,7 +880,7 @@ ${declaration} {`;
|
||||
// Handle pointer types
|
||||
if (elementType.endsWith('*')) {
|
||||
const baseType = elementType.slice(0, -1).trim();
|
||||
return this.toDartTypeName(`spine_${toSnakeCase(baseType)}`);
|
||||
return `${this.toDartTypeName(`spine_${toSnakeCase(baseType)}`)}?`;
|
||||
}
|
||||
|
||||
// For primitive types, return the Dart type directly
|
||||
@ -896,8 +900,8 @@ ${declaration} {`;
|
||||
return 'bool';
|
||||
}
|
||||
|
||||
// For object types, convert to PascalCase
|
||||
return this.toPascalCase(elementType);
|
||||
// For object types, convert to PascalCase and make nullable since arrays can contain null pointers
|
||||
return `${this.toPascalCase(elementType)}?`;
|
||||
}
|
||||
|
||||
private isPrimitiveArrayType (elementType: string): boolean {
|
||||
@ -1120,19 +1124,22 @@ ${declaration} {`;
|
||||
return enumValue;
|
||||
}
|
||||
|
||||
private toDartReturnType (cType: string): string {
|
||||
private toDartReturnType (cType: string, nullable?: boolean): string {
|
||||
let baseType: string;
|
||||
if (cType === 'void') return 'void';
|
||||
if (cType === 'char*' || cType === 'char *' || cType === 'const char*' || cType === 'const char *') return 'String';
|
||||
if (cType === 'float' || cType === 'double') return 'double';
|
||||
if (cType === 'int' || cType === 'size_t' || cType === 'int32_t' || cType === 'uint32_t') return 'int';
|
||||
if (cType === 'bool') return 'bool';
|
||||
if (cType === 'char*' || cType === 'char *' || cType === 'const char*' || cType === 'const char *') baseType = 'String';
|
||||
else if (cType === 'float' || cType === 'double') baseType = 'double';
|
||||
else if (cType === 'int' || cType === 'size_t' || cType === 'int32_t' || cType === 'uint32_t') baseType = 'int';
|
||||
else if (cType === 'bool') baseType = 'bool';
|
||||
// Handle primitive pointer types
|
||||
if (cType === 'void*' || cType === 'void *') return 'Pointer<Void>';
|
||||
if (cType === 'float*' || cType === 'float *') return 'Pointer<Float>';
|
||||
if (cType === 'uint32_t*' || cType === 'uint32_t *') return 'Pointer<Uint32>';
|
||||
if (cType === 'uint16_t*' || cType === 'uint16_t *') return 'Pointer<Uint16>';
|
||||
if (cType === 'int*' || cType === 'int *') return 'Pointer<Int32>';
|
||||
return this.toDartTypeName(cType);
|
||||
else if (cType === 'void*' || cType === 'void *') baseType = 'Pointer<Void>';
|
||||
else if (cType === 'float*' || cType === 'float *') baseType = 'Pointer<Float>';
|
||||
else if (cType === 'uint32_t*' || cType === 'uint32_t *') baseType = 'Pointer<Uint32>';
|
||||
else if (cType === 'uint16_t*' || cType === 'uint16_t *') baseType = 'Pointer<Uint16>';
|
||||
else if (cType === 'int*' || cType === 'int *') baseType = 'Pointer<Int32>';
|
||||
else baseType = this.toDartTypeName(cType);
|
||||
|
||||
return nullable ? `${baseType}?` : baseType;
|
||||
}
|
||||
|
||||
private toDartParameterType (param: CParameter): string {
|
||||
@ -1143,7 +1150,7 @@ ${declaration} {`;
|
||||
if (param.cType === 'void*' || param.cType === 'void *') {
|
||||
return 'Pointer<Void>';
|
||||
}
|
||||
return this.toDartReturnType(param.cType);
|
||||
return this.toDartReturnType(param.cType, param.isNullable);
|
||||
}
|
||||
|
||||
private convertDartToC (dartValue: string, param: CParameter): string {
|
||||
@ -1152,38 +1159,62 @@ ${declaration} {`;
|
||||
}
|
||||
|
||||
if (this.enumNames.has(param.cType)) {
|
||||
if (param.isNullable) {
|
||||
return `${dartValue}?.value ?? 0`;
|
||||
}
|
||||
return `${dartValue}.value`;
|
||||
}
|
||||
|
||||
if (param.cType.startsWith('spine_')) {
|
||||
if (param.isNullable) {
|
||||
return `${dartValue}?.nativePtr.cast() ?? Pointer.fromAddress(0)`;
|
||||
}
|
||||
return `${dartValue}.nativePtr.cast()`;
|
||||
}
|
||||
|
||||
return dartValue;
|
||||
}
|
||||
|
||||
private generateReturnConversion (cReturnType: string, resultVar: string): string {
|
||||
private generateReturnConversion (cReturnType: string, resultVar: string, nullable?: boolean): string {
|
||||
if (cReturnType === 'char*' || cReturnType === 'char *' || cReturnType === 'const char*' || cReturnType === 'const char *') {
|
||||
if (nullable) {
|
||||
return `return ${resultVar}.address == 0 ? null : ${resultVar}.cast<Utf8>().toDartString();`;
|
||||
}
|
||||
return `return ${resultVar}.cast<Utf8>().toDartString();`;
|
||||
}
|
||||
|
||||
if (this.enumNames.has(cReturnType)) {
|
||||
const dartType = this.toDartTypeName(cReturnType);
|
||||
if (nullable) {
|
||||
return `return ${resultVar} == 0 ? null : ${dartType}.fromValue(${resultVar});`;
|
||||
}
|
||||
return `return ${dartType}.fromValue(${resultVar});`;
|
||||
}
|
||||
|
||||
if (cReturnType.startsWith('spine_array_')) {
|
||||
const dartType = this.toDartTypeName(cReturnType);
|
||||
if (nullable) {
|
||||
return `return ${resultVar}.address == 0 ? null : ${dartType}.fromPointer(${resultVar});`;
|
||||
}
|
||||
return `return ${dartType}.fromPointer(${resultVar});`;
|
||||
}
|
||||
|
||||
if (cReturnType.startsWith('spine_')) {
|
||||
const dartType = this.toDartTypeName(cReturnType);
|
||||
const cClass = this.classMap.get(cReturnType);
|
||||
if (cClass && this.isAbstract(cClass)) {
|
||||
return this.generateRttiBasedInstantiation(dartType, resultVar, cClass);
|
||||
|
||||
if (nullable) {
|
||||
if (cClass && this.isAbstract(cClass)) {
|
||||
return `if (${resultVar}.address == 0) return null;
|
||||
${this.generateRttiBasedInstantiation(dartType, resultVar, cClass)}`;
|
||||
}
|
||||
return `return ${resultVar}.address == 0 ? null : ${dartType}.fromPointer(${resultVar});`;
|
||||
} else {
|
||||
if (cClass && this.isAbstract(cClass)) {
|
||||
return this.generateRttiBasedInstantiation(dartType, resultVar, cClass);
|
||||
}
|
||||
return `return ${dartType}.fromPointer(${resultVar});`;
|
||||
}
|
||||
return `return ${dartType}.fromPointer(${resultVar});`;
|
||||
}
|
||||
|
||||
return `return ${resultVar};`;
|
||||
|
||||
@ -80,10 +80,10 @@ class Animation {
|
||||
SpineBindings.bindings.spine_animation_set_duration(_ptr, value);
|
||||
}
|
||||
|
||||
void apply(Skeleton skeleton, double lastTime, double time, bool loop, ArrayEvent pEvents, double alpha,
|
||||
void apply(Skeleton skeleton, double lastTime, double time, bool loop, ArrayEvent? pEvents, double alpha,
|
||||
MixBlend blend, MixDirection direction, bool appliedPose) {
|
||||
SpineBindings.bindings.spine_animation_apply(_ptr, skeleton.nativePtr.cast(), lastTime, time, loop,
|
||||
pEvents.nativePtr.cast(), alpha, blend.value, direction.value, appliedPose);
|
||||
pEvents?.nativePtr.cast() ?? Pointer.fromAddress(0), alpha, blend.value, direction.value, appliedPose);
|
||||
}
|
||||
|
||||
String get name {
|
||||
|
||||
@ -89,9 +89,9 @@ class AnimationState {
|
||||
SpineBindings.bindings.spine_animation_state_set_empty_animations(_ptr, value);
|
||||
}
|
||||
|
||||
TrackEntry getCurrent(int trackIndex) {
|
||||
TrackEntry? getCurrent(int trackIndex) {
|
||||
final result = SpineBindings.bindings.spine_animation_state_get_current(_ptr, trackIndex);
|
||||
return TrackEntry.fromPointer(result);
|
||||
return result.address == 0 ? null : TrackEntry.fromPointer(result);
|
||||
}
|
||||
|
||||
AnimationStateData get data {
|
||||
@ -130,11 +130,12 @@ class AnimationState {
|
||||
return result;
|
||||
}
|
||||
|
||||
void disposeTrackEntry(TrackEntry entry) {
|
||||
SpineBindings.bindings.spine_animation_state_dispose_track_entry(_ptr, entry.nativePtr.cast());
|
||||
void disposeTrackEntry(TrackEntry? entry) {
|
||||
SpineBindings.bindings
|
||||
.spine_animation_state_dispose_track_entry(_ptr, entry?.nativePtr.cast() ?? Pointer.fromAddress(0));
|
||||
}
|
||||
|
||||
Pointer<Void> get rendererObject {
|
||||
Pointer<Void>? get rendererObject {
|
||||
final result = SpineBindings.bindings.spine_animation_state_get_renderer_object(_ptr);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -198,7 +198,7 @@ class ArrayPropertyId extends NativeArray<int> {
|
||||
}
|
||||
|
||||
/// ArrayAnimation wrapper
|
||||
class ArrayAnimation extends NativeArray<Animation> {
|
||||
class ArrayAnimation extends NativeArray<Animation?> {
|
||||
ArrayAnimation.fromPointer(Pointer<spine_array_animation_wrapper> super.ptr);
|
||||
|
||||
@override
|
||||
@ -207,17 +207,17 @@ class ArrayAnimation extends NativeArray<Animation> {
|
||||
}
|
||||
|
||||
@override
|
||||
Animation operator [](int index) {
|
||||
Animation? operator [](int index) {
|
||||
if (index < 0 || index >= length) {
|
||||
throw RangeError.index(index, this, 'index');
|
||||
}
|
||||
final buffer = SpineBindings.bindings.spine_array_animation_buffer(nativePtr.cast());
|
||||
return Animation.fromPointer(buffer[index]);
|
||||
return buffer[index].address == 0 ? null : Animation.fromPointer(buffer[index]);
|
||||
}
|
||||
}
|
||||
|
||||
/// ArrayAtlasPage wrapper
|
||||
class ArrayAtlasPage extends NativeArray<AtlasPage> {
|
||||
class ArrayAtlasPage extends NativeArray<AtlasPage?> {
|
||||
ArrayAtlasPage.fromPointer(Pointer<spine_array_atlas_page_wrapper> super.ptr);
|
||||
|
||||
@override
|
||||
@ -226,17 +226,17 @@ class ArrayAtlasPage extends NativeArray<AtlasPage> {
|
||||
}
|
||||
|
||||
@override
|
||||
AtlasPage operator [](int index) {
|
||||
AtlasPage? operator [](int index) {
|
||||
if (index < 0 || index >= length) {
|
||||
throw RangeError.index(index, this, 'index');
|
||||
}
|
||||
final buffer = SpineBindings.bindings.spine_array_atlas_page_buffer(nativePtr.cast());
|
||||
return AtlasPage.fromPointer(buffer[index]);
|
||||
return buffer[index].address == 0 ? null : AtlasPage.fromPointer(buffer[index]);
|
||||
}
|
||||
}
|
||||
|
||||
/// ArrayAtlasRegion wrapper
|
||||
class ArrayAtlasRegion extends NativeArray<AtlasRegion> {
|
||||
class ArrayAtlasRegion extends NativeArray<AtlasRegion?> {
|
||||
ArrayAtlasRegion.fromPointer(Pointer<spine_array_atlas_region_wrapper> super.ptr);
|
||||
|
||||
@override
|
||||
@ -245,17 +245,17 @@ class ArrayAtlasRegion extends NativeArray<AtlasRegion> {
|
||||
}
|
||||
|
||||
@override
|
||||
AtlasRegion operator [](int index) {
|
||||
AtlasRegion? operator [](int index) {
|
||||
if (index < 0 || index >= length) {
|
||||
throw RangeError.index(index, this, 'index');
|
||||
}
|
||||
final buffer = SpineBindings.bindings.spine_array_atlas_region_buffer(nativePtr.cast());
|
||||
return AtlasRegion.fromPointer(buffer[index]);
|
||||
return buffer[index].address == 0 ? null : AtlasRegion.fromPointer(buffer[index]);
|
||||
}
|
||||
}
|
||||
|
||||
/// ArrayAttachment wrapper
|
||||
class ArrayAttachment extends NativeArray<Attachment> {
|
||||
class ArrayAttachment extends NativeArray<Attachment?> {
|
||||
ArrayAttachment.fromPointer(Pointer<spine_array_attachment_wrapper> super.ptr);
|
||||
|
||||
@override
|
||||
@ -264,11 +264,12 @@ class ArrayAttachment extends NativeArray<Attachment> {
|
||||
}
|
||||
|
||||
@override
|
||||
Attachment operator [](int index) {
|
||||
Attachment? operator [](int index) {
|
||||
if (index < 0 || index >= length) {
|
||||
throw RangeError.index(index, this, 'index');
|
||||
}
|
||||
final buffer = SpineBindings.bindings.spine_array_attachment_buffer(nativePtr.cast());
|
||||
if (buffer[index].address == 0) return null;
|
||||
final rtti = SpineBindings.bindings.spine_attachment_get_rtti(buffer[index]);
|
||||
final className = SpineBindings.bindings.spine_rtti_get_class_name(rtti).cast<Utf8>().toDartString();
|
||||
switch (className) {
|
||||
@ -291,7 +292,7 @@ class ArrayAttachment extends NativeArray<Attachment> {
|
||||
}
|
||||
|
||||
/// ArrayBone wrapper
|
||||
class ArrayBone extends NativeArray<Bone> {
|
||||
class ArrayBone extends NativeArray<Bone?> {
|
||||
ArrayBone.fromPointer(Pointer<spine_array_bone_wrapper> super.ptr);
|
||||
|
||||
@override
|
||||
@ -300,17 +301,17 @@ class ArrayBone extends NativeArray<Bone> {
|
||||
}
|
||||
|
||||
@override
|
||||
Bone operator [](int index) {
|
||||
Bone? operator [](int index) {
|
||||
if (index < 0 || index >= length) {
|
||||
throw RangeError.index(index, this, 'index');
|
||||
}
|
||||
final buffer = SpineBindings.bindings.spine_array_bone_buffer(nativePtr.cast());
|
||||
return Bone.fromPointer(buffer[index]);
|
||||
return buffer[index].address == 0 ? null : Bone.fromPointer(buffer[index]);
|
||||
}
|
||||
}
|
||||
|
||||
/// ArrayBoneData wrapper
|
||||
class ArrayBoneData extends NativeArray<BoneData> {
|
||||
class ArrayBoneData extends NativeArray<BoneData?> {
|
||||
ArrayBoneData.fromPointer(Pointer<spine_array_bone_data_wrapper> super.ptr);
|
||||
|
||||
@override
|
||||
@ -319,17 +320,17 @@ class ArrayBoneData extends NativeArray<BoneData> {
|
||||
}
|
||||
|
||||
@override
|
||||
BoneData operator [](int index) {
|
||||
BoneData? operator [](int index) {
|
||||
if (index < 0 || index >= length) {
|
||||
throw RangeError.index(index, this, 'index');
|
||||
}
|
||||
final buffer = SpineBindings.bindings.spine_array_bone_data_buffer(nativePtr.cast());
|
||||
return BoneData.fromPointer(buffer[index]);
|
||||
return buffer[index].address == 0 ? null : BoneData.fromPointer(buffer[index]);
|
||||
}
|
||||
}
|
||||
|
||||
/// ArrayBonePose wrapper
|
||||
class ArrayBonePose extends NativeArray<BonePose> {
|
||||
class ArrayBonePose extends NativeArray<BonePose?> {
|
||||
ArrayBonePose.fromPointer(Pointer<spine_array_bone_pose_wrapper> super.ptr);
|
||||
|
||||
@override
|
||||
@ -338,17 +339,17 @@ class ArrayBonePose extends NativeArray<BonePose> {
|
||||
}
|
||||
|
||||
@override
|
||||
BonePose operator [](int index) {
|
||||
BonePose? operator [](int index) {
|
||||
if (index < 0 || index >= length) {
|
||||
throw RangeError.index(index, this, 'index');
|
||||
}
|
||||
final buffer = SpineBindings.bindings.spine_array_bone_pose_buffer(nativePtr.cast());
|
||||
return BonePose.fromPointer(buffer[index]);
|
||||
return buffer[index].address == 0 ? null : BonePose.fromPointer(buffer[index]);
|
||||
}
|
||||
}
|
||||
|
||||
/// ArrayBoundingBoxAttachment wrapper
|
||||
class ArrayBoundingBoxAttachment extends NativeArray<BoundingBoxAttachment> {
|
||||
class ArrayBoundingBoxAttachment extends NativeArray<BoundingBoxAttachment?> {
|
||||
ArrayBoundingBoxAttachment.fromPointer(Pointer<spine_array_bounding_box_attachment_wrapper> super.ptr);
|
||||
|
||||
@override
|
||||
@ -357,17 +358,17 @@ class ArrayBoundingBoxAttachment extends NativeArray<BoundingBoxAttachment> {
|
||||
}
|
||||
|
||||
@override
|
||||
BoundingBoxAttachment operator [](int index) {
|
||||
BoundingBoxAttachment? operator [](int index) {
|
||||
if (index < 0 || index >= length) {
|
||||
throw RangeError.index(index, this, 'index');
|
||||
}
|
||||
final buffer = SpineBindings.bindings.spine_array_bounding_box_attachment_buffer(nativePtr.cast());
|
||||
return BoundingBoxAttachment.fromPointer(buffer[index]);
|
||||
return buffer[index].address == 0 ? null : BoundingBoxAttachment.fromPointer(buffer[index]);
|
||||
}
|
||||
}
|
||||
|
||||
/// ArrayConstraint wrapper
|
||||
class ArrayConstraint extends NativeArray<Constraint> {
|
||||
class ArrayConstraint extends NativeArray<Constraint?> {
|
||||
ArrayConstraint.fromPointer(Pointer<spine_array_constraint_wrapper> super.ptr);
|
||||
|
||||
@override
|
||||
@ -376,11 +377,12 @@ class ArrayConstraint extends NativeArray<Constraint> {
|
||||
}
|
||||
|
||||
@override
|
||||
Constraint operator [](int index) {
|
||||
Constraint? operator [](int index) {
|
||||
if (index < 0 || index >= length) {
|
||||
throw RangeError.index(index, this, 'index');
|
||||
}
|
||||
final buffer = SpineBindings.bindings.spine_array_constraint_buffer(nativePtr.cast());
|
||||
if (buffer[index].address == 0) return null;
|
||||
final rtti = SpineBindings.bindings.spine_constraint_get_rtti(buffer[index]);
|
||||
final className = SpineBindings.bindings.spine_rtti_get_class_name(rtti).cast<Utf8>().toDartString();
|
||||
switch (className) {
|
||||
@ -401,7 +403,7 @@ class ArrayConstraint extends NativeArray<Constraint> {
|
||||
}
|
||||
|
||||
/// ArrayConstraintData wrapper
|
||||
class ArrayConstraintData extends NativeArray<ConstraintData> {
|
||||
class ArrayConstraintData extends NativeArray<ConstraintData?> {
|
||||
ArrayConstraintData.fromPointer(Pointer<spine_array_constraint_data_wrapper> super.ptr);
|
||||
|
||||
@override
|
||||
@ -410,11 +412,12 @@ class ArrayConstraintData extends NativeArray<ConstraintData> {
|
||||
}
|
||||
|
||||
@override
|
||||
ConstraintData operator [](int index) {
|
||||
ConstraintData? operator [](int index) {
|
||||
if (index < 0 || index >= length) {
|
||||
throw RangeError.index(index, this, 'index');
|
||||
}
|
||||
final buffer = SpineBindings.bindings.spine_array_constraint_data_buffer(nativePtr.cast());
|
||||
if (buffer[index].address == 0) return null;
|
||||
final rtti = SpineBindings.bindings.spine_constraint_data_get_rtti(buffer[index]);
|
||||
final className = SpineBindings.bindings.spine_rtti_get_class_name(rtti).cast<Utf8>().toDartString();
|
||||
switch (className) {
|
||||
@ -435,7 +438,7 @@ class ArrayConstraintData extends NativeArray<ConstraintData> {
|
||||
}
|
||||
|
||||
/// ArrayEvent wrapper
|
||||
class ArrayEvent extends NativeArray<Event> {
|
||||
class ArrayEvent extends NativeArray<Event?> {
|
||||
ArrayEvent.fromPointer(Pointer<spine_array_event_wrapper> super.ptr);
|
||||
|
||||
@override
|
||||
@ -444,17 +447,17 @@ class ArrayEvent extends NativeArray<Event> {
|
||||
}
|
||||
|
||||
@override
|
||||
Event operator [](int index) {
|
||||
Event? operator [](int index) {
|
||||
if (index < 0 || index >= length) {
|
||||
throw RangeError.index(index, this, 'index');
|
||||
}
|
||||
final buffer = SpineBindings.bindings.spine_array_event_buffer(nativePtr.cast());
|
||||
return Event.fromPointer(buffer[index]);
|
||||
return buffer[index].address == 0 ? null : Event.fromPointer(buffer[index]);
|
||||
}
|
||||
}
|
||||
|
||||
/// ArrayEventData wrapper
|
||||
class ArrayEventData extends NativeArray<EventData> {
|
||||
class ArrayEventData extends NativeArray<EventData?> {
|
||||
ArrayEventData.fromPointer(Pointer<spine_array_event_data_wrapper> super.ptr);
|
||||
|
||||
@override
|
||||
@ -463,17 +466,17 @@ class ArrayEventData extends NativeArray<EventData> {
|
||||
}
|
||||
|
||||
@override
|
||||
EventData operator [](int index) {
|
||||
EventData? operator [](int index) {
|
||||
if (index < 0 || index >= length) {
|
||||
throw RangeError.index(index, this, 'index');
|
||||
}
|
||||
final buffer = SpineBindings.bindings.spine_array_event_data_buffer(nativePtr.cast());
|
||||
return EventData.fromPointer(buffer[index]);
|
||||
return buffer[index].address == 0 ? null : EventData.fromPointer(buffer[index]);
|
||||
}
|
||||
}
|
||||
|
||||
/// ArrayFromProperty wrapper
|
||||
class ArrayFromProperty extends NativeArray<FromProperty> {
|
||||
class ArrayFromProperty extends NativeArray<FromProperty?> {
|
||||
ArrayFromProperty.fromPointer(Pointer<spine_array_from_property_wrapper> super.ptr);
|
||||
|
||||
@override
|
||||
@ -482,11 +485,12 @@ class ArrayFromProperty extends NativeArray<FromProperty> {
|
||||
}
|
||||
|
||||
@override
|
||||
FromProperty operator [](int index) {
|
||||
FromProperty? operator [](int index) {
|
||||
if (index < 0 || index >= length) {
|
||||
throw RangeError.index(index, this, 'index');
|
||||
}
|
||||
final buffer = SpineBindings.bindings.spine_array_from_property_buffer(nativePtr.cast());
|
||||
if (buffer[index].address == 0) return null;
|
||||
final rtti = SpineBindings.bindings.spine_from_property_get_rtti(buffer[index]);
|
||||
final className = SpineBindings.bindings.spine_rtti_get_class_name(rtti).cast<Utf8>().toDartString();
|
||||
switch (className) {
|
||||
@ -509,7 +513,7 @@ class ArrayFromProperty extends NativeArray<FromProperty> {
|
||||
}
|
||||
|
||||
/// ArrayPhysicsConstraint wrapper
|
||||
class ArrayPhysicsConstraint extends NativeArray<PhysicsConstraint> {
|
||||
class ArrayPhysicsConstraint extends NativeArray<PhysicsConstraint?> {
|
||||
ArrayPhysicsConstraint.fromPointer(Pointer<spine_array_physics_constraint_wrapper> super.ptr);
|
||||
|
||||
@override
|
||||
@ -518,17 +522,17 @@ class ArrayPhysicsConstraint extends NativeArray<PhysicsConstraint> {
|
||||
}
|
||||
|
||||
@override
|
||||
PhysicsConstraint operator [](int index) {
|
||||
PhysicsConstraint? operator [](int index) {
|
||||
if (index < 0 || index >= length) {
|
||||
throw RangeError.index(index, this, 'index');
|
||||
}
|
||||
final buffer = SpineBindings.bindings.spine_array_physics_constraint_buffer(nativePtr.cast());
|
||||
return PhysicsConstraint.fromPointer(buffer[index]);
|
||||
return buffer[index].address == 0 ? null : PhysicsConstraint.fromPointer(buffer[index]);
|
||||
}
|
||||
}
|
||||
|
||||
/// ArrayPolygon wrapper
|
||||
class ArrayPolygon extends NativeArray<Polygon> {
|
||||
class ArrayPolygon extends NativeArray<Polygon?> {
|
||||
ArrayPolygon.fromPointer(Pointer<spine_array_polygon_wrapper> super.ptr);
|
||||
|
||||
@override
|
||||
@ -537,17 +541,17 @@ class ArrayPolygon extends NativeArray<Polygon> {
|
||||
}
|
||||
|
||||
@override
|
||||
Polygon operator [](int index) {
|
||||
Polygon? operator [](int index) {
|
||||
if (index < 0 || index >= length) {
|
||||
throw RangeError.index(index, this, 'index');
|
||||
}
|
||||
final buffer = SpineBindings.bindings.spine_array_polygon_buffer(nativePtr.cast());
|
||||
return Polygon.fromPointer(buffer[index]);
|
||||
return buffer[index].address == 0 ? null : Polygon.fromPointer(buffer[index]);
|
||||
}
|
||||
}
|
||||
|
||||
/// ArraySkin wrapper
|
||||
class ArraySkin extends NativeArray<Skin> {
|
||||
class ArraySkin extends NativeArray<Skin?> {
|
||||
ArraySkin.fromPointer(Pointer<spine_array_skin_wrapper> super.ptr);
|
||||
|
||||
@override
|
||||
@ -556,17 +560,17 @@ class ArraySkin extends NativeArray<Skin> {
|
||||
}
|
||||
|
||||
@override
|
||||
Skin operator [](int index) {
|
||||
Skin? operator [](int index) {
|
||||
if (index < 0 || index >= length) {
|
||||
throw RangeError.index(index, this, 'index');
|
||||
}
|
||||
final buffer = SpineBindings.bindings.spine_array_skin_buffer(nativePtr.cast());
|
||||
return Skin.fromPointer(buffer[index]);
|
||||
return buffer[index].address == 0 ? null : Skin.fromPointer(buffer[index]);
|
||||
}
|
||||
}
|
||||
|
||||
/// ArraySlot wrapper
|
||||
class ArraySlot extends NativeArray<Slot> {
|
||||
class ArraySlot extends NativeArray<Slot?> {
|
||||
ArraySlot.fromPointer(Pointer<spine_array_slot_wrapper> super.ptr);
|
||||
|
||||
@override
|
||||
@ -575,17 +579,17 @@ class ArraySlot extends NativeArray<Slot> {
|
||||
}
|
||||
|
||||
@override
|
||||
Slot operator [](int index) {
|
||||
Slot? operator [](int index) {
|
||||
if (index < 0 || index >= length) {
|
||||
throw RangeError.index(index, this, 'index');
|
||||
}
|
||||
final buffer = SpineBindings.bindings.spine_array_slot_buffer(nativePtr.cast());
|
||||
return Slot.fromPointer(buffer[index]);
|
||||
return buffer[index].address == 0 ? null : Slot.fromPointer(buffer[index]);
|
||||
}
|
||||
}
|
||||
|
||||
/// ArraySlotData wrapper
|
||||
class ArraySlotData extends NativeArray<SlotData> {
|
||||
class ArraySlotData extends NativeArray<SlotData?> {
|
||||
ArraySlotData.fromPointer(Pointer<spine_array_slot_data_wrapper> super.ptr);
|
||||
|
||||
@override
|
||||
@ -594,17 +598,17 @@ class ArraySlotData extends NativeArray<SlotData> {
|
||||
}
|
||||
|
||||
@override
|
||||
SlotData operator [](int index) {
|
||||
SlotData? operator [](int index) {
|
||||
if (index < 0 || index >= length) {
|
||||
throw RangeError.index(index, this, 'index');
|
||||
}
|
||||
final buffer = SpineBindings.bindings.spine_array_slot_data_buffer(nativePtr.cast());
|
||||
return SlotData.fromPointer(buffer[index]);
|
||||
return buffer[index].address == 0 ? null : SlotData.fromPointer(buffer[index]);
|
||||
}
|
||||
}
|
||||
|
||||
/// ArrayTextureRegion wrapper
|
||||
class ArrayTextureRegion extends NativeArray<TextureRegion> {
|
||||
class ArrayTextureRegion extends NativeArray<TextureRegion?> {
|
||||
ArrayTextureRegion.fromPointer(Pointer<spine_array_texture_region_wrapper> super.ptr);
|
||||
|
||||
@override
|
||||
@ -613,17 +617,17 @@ class ArrayTextureRegion extends NativeArray<TextureRegion> {
|
||||
}
|
||||
|
||||
@override
|
||||
TextureRegion operator [](int index) {
|
||||
TextureRegion? operator [](int index) {
|
||||
if (index < 0 || index >= length) {
|
||||
throw RangeError.index(index, this, 'index');
|
||||
}
|
||||
final buffer = SpineBindings.bindings.spine_array_texture_region_buffer(nativePtr.cast());
|
||||
return TextureRegion.fromPointer(buffer[index]);
|
||||
return buffer[index].address == 0 ? null : TextureRegion.fromPointer(buffer[index]);
|
||||
}
|
||||
}
|
||||
|
||||
/// ArrayTimeline wrapper
|
||||
class ArrayTimeline extends NativeArray<Timeline> {
|
||||
class ArrayTimeline extends NativeArray<Timeline?> {
|
||||
ArrayTimeline.fromPointer(Pointer<spine_array_timeline_wrapper> super.ptr);
|
||||
|
||||
@override
|
||||
@ -632,11 +636,12 @@ class ArrayTimeline extends NativeArray<Timeline> {
|
||||
}
|
||||
|
||||
@override
|
||||
Timeline operator [](int index) {
|
||||
Timeline? operator [](int index) {
|
||||
if (index < 0 || index >= length) {
|
||||
throw RangeError.index(index, this, 'index');
|
||||
}
|
||||
final buffer = SpineBindings.bindings.spine_array_timeline_buffer(nativePtr.cast());
|
||||
if (buffer[index].address == 0) return null;
|
||||
final rtti = SpineBindings.bindings.spine_timeline_get_rtti(buffer[index]);
|
||||
final className = SpineBindings.bindings.spine_rtti_get_class_name(rtti).cast<Utf8>().toDartString();
|
||||
switch (className) {
|
||||
@ -719,7 +724,7 @@ class ArrayTimeline extends NativeArray<Timeline> {
|
||||
}
|
||||
|
||||
/// ArrayToProperty wrapper
|
||||
class ArrayToProperty extends NativeArray<ToProperty> {
|
||||
class ArrayToProperty extends NativeArray<ToProperty?> {
|
||||
ArrayToProperty.fromPointer(Pointer<spine_array_to_property_wrapper> super.ptr);
|
||||
|
||||
@override
|
||||
@ -728,11 +733,12 @@ class ArrayToProperty extends NativeArray<ToProperty> {
|
||||
}
|
||||
|
||||
@override
|
||||
ToProperty operator [](int index) {
|
||||
ToProperty? operator [](int index) {
|
||||
if (index < 0 || index >= length) {
|
||||
throw RangeError.index(index, this, 'index');
|
||||
}
|
||||
final buffer = SpineBindings.bindings.spine_array_to_property_buffer(nativePtr.cast());
|
||||
if (buffer[index].address == 0) return null;
|
||||
final rtti = SpineBindings.bindings.spine_to_property_get_rtti(buffer[index]);
|
||||
final className = SpineBindings.bindings.spine_rtti_get_class_name(rtti).cast<Utf8>().toDartString();
|
||||
switch (className) {
|
||||
@ -755,7 +761,7 @@ class ArrayToProperty extends NativeArray<ToProperty> {
|
||||
}
|
||||
|
||||
/// ArrayTrackEntry wrapper
|
||||
class ArrayTrackEntry extends NativeArray<TrackEntry> {
|
||||
class ArrayTrackEntry extends NativeArray<TrackEntry?> {
|
||||
ArrayTrackEntry.fromPointer(Pointer<spine_array_track_entry_wrapper> super.ptr);
|
||||
|
||||
@override
|
||||
@ -764,17 +770,17 @@ class ArrayTrackEntry extends NativeArray<TrackEntry> {
|
||||
}
|
||||
|
||||
@override
|
||||
TrackEntry operator [](int index) {
|
||||
TrackEntry? operator [](int index) {
|
||||
if (index < 0 || index >= length) {
|
||||
throw RangeError.index(index, this, 'index');
|
||||
}
|
||||
final buffer = SpineBindings.bindings.spine_array_track_entry_buffer(nativePtr.cast());
|
||||
return TrackEntry.fromPointer(buffer[index]);
|
||||
return buffer[index].address == 0 ? null : TrackEntry.fromPointer(buffer[index]);
|
||||
}
|
||||
}
|
||||
|
||||
/// ArrayUpdate wrapper
|
||||
class ArrayUpdate extends NativeArray<Update> {
|
||||
class ArrayUpdate extends NativeArray<Update?> {
|
||||
ArrayUpdate.fromPointer(Pointer<spine_array_update_wrapper> super.ptr);
|
||||
|
||||
@override
|
||||
@ -783,11 +789,12 @@ class ArrayUpdate extends NativeArray<Update> {
|
||||
}
|
||||
|
||||
@override
|
||||
Update operator [](int index) {
|
||||
Update? operator [](int index) {
|
||||
if (index < 0 || index >= length) {
|
||||
throw RangeError.index(index, this, 'index');
|
||||
}
|
||||
final buffer = SpineBindings.bindings.spine_array_update_buffer(nativePtr.cast());
|
||||
if (buffer[index].address == 0) return null;
|
||||
final rtti = SpineBindings.bindings.spine_update_get_rtti(buffer[index]);
|
||||
final className = SpineBindings.bindings.spine_rtti_get_class_name(rtti).cast<Utf8>().toDartString();
|
||||
switch (className) {
|
||||
|
||||
@ -53,9 +53,9 @@ class Atlas {
|
||||
SpineBindings.bindings.spine_atlas_flip_v(_ptr);
|
||||
}
|
||||
|
||||
AtlasRegion findRegion(String name) {
|
||||
AtlasRegion? findRegion(String name) {
|
||||
final result = SpineBindings.bindings.spine_atlas_find_region(_ptr, name.toNativeUtf8().cast<Char>());
|
||||
return AtlasRegion.fromPointer(result);
|
||||
return result.address == 0 ? null : AtlasRegion.fromPointer(result);
|
||||
}
|
||||
|
||||
ArrayAtlasPage get pages {
|
||||
|
||||
@ -65,54 +65,58 @@ class AtlasAttachmentLoader implements AttachmentLoader {
|
||||
}
|
||||
|
||||
@override
|
||||
RegionAttachment newRegionAttachment(Skin skin, String name, String path, Sequence sequence) {
|
||||
RegionAttachment? newRegionAttachment(Skin skin, String name, String path, Sequence? sequence) {
|
||||
final result = SpineBindings.bindings.spine_atlas_attachment_loader_new_region_attachment(
|
||||
_ptr,
|
||||
skin.nativePtr.cast(),
|
||||
name.toNativeUtf8().cast<Char>(),
|
||||
path.toNativeUtf8().cast<Char>(),
|
||||
sequence.nativePtr.cast());
|
||||
return RegionAttachment.fromPointer(result);
|
||||
sequence?.nativePtr.cast() ?? Pointer.fromAddress(0));
|
||||
return result.address == 0 ? null : RegionAttachment.fromPointer(result);
|
||||
}
|
||||
|
||||
@override
|
||||
MeshAttachment newMeshAttachment(Skin skin, String name, String path, Sequence sequence) {
|
||||
final result = SpineBindings.bindings.spine_atlas_attachment_loader_new_mesh_attachment(_ptr, skin.nativePtr.cast(),
|
||||
name.toNativeUtf8().cast<Char>(), path.toNativeUtf8().cast<Char>(), sequence.nativePtr.cast());
|
||||
return MeshAttachment.fromPointer(result);
|
||||
MeshAttachment? newMeshAttachment(Skin skin, String name, String path, Sequence? sequence) {
|
||||
final result = SpineBindings.bindings.spine_atlas_attachment_loader_new_mesh_attachment(
|
||||
_ptr,
|
||||
skin.nativePtr.cast(),
|
||||
name.toNativeUtf8().cast<Char>(),
|
||||
path.toNativeUtf8().cast<Char>(),
|
||||
sequence?.nativePtr.cast() ?? Pointer.fromAddress(0));
|
||||
return result.address == 0 ? null : MeshAttachment.fromPointer(result);
|
||||
}
|
||||
|
||||
@override
|
||||
BoundingBoxAttachment newBoundingBoxAttachment(Skin skin, String name) {
|
||||
BoundingBoxAttachment? newBoundingBoxAttachment(Skin skin, String name) {
|
||||
final result = SpineBindings.bindings.spine_atlas_attachment_loader_new_bounding_box_attachment(
|
||||
_ptr, skin.nativePtr.cast(), name.toNativeUtf8().cast<Char>());
|
||||
return BoundingBoxAttachment.fromPointer(result);
|
||||
return result.address == 0 ? null : BoundingBoxAttachment.fromPointer(result);
|
||||
}
|
||||
|
||||
@override
|
||||
PathAttachment newPathAttachment(Skin skin, String name) {
|
||||
PathAttachment? newPathAttachment(Skin skin, String name) {
|
||||
final result = SpineBindings.bindings.spine_atlas_attachment_loader_new_path_attachment(
|
||||
_ptr, skin.nativePtr.cast(), name.toNativeUtf8().cast<Char>());
|
||||
return PathAttachment.fromPointer(result);
|
||||
return result.address == 0 ? null : PathAttachment.fromPointer(result);
|
||||
}
|
||||
|
||||
@override
|
||||
PointAttachment newPointAttachment(Skin skin, String name) {
|
||||
PointAttachment? newPointAttachment(Skin skin, String name) {
|
||||
final result = SpineBindings.bindings.spine_atlas_attachment_loader_new_point_attachment(
|
||||
_ptr, skin.nativePtr.cast(), name.toNativeUtf8().cast<Char>());
|
||||
return PointAttachment.fromPointer(result);
|
||||
return result.address == 0 ? null : PointAttachment.fromPointer(result);
|
||||
}
|
||||
|
||||
@override
|
||||
ClippingAttachment newClippingAttachment(Skin skin, String name) {
|
||||
ClippingAttachment? newClippingAttachment(Skin skin, String name) {
|
||||
final result = SpineBindings.bindings.spine_atlas_attachment_loader_new_clipping_attachment(
|
||||
_ptr, skin.nativePtr.cast(), name.toNativeUtf8().cast<Char>());
|
||||
return ClippingAttachment.fromPointer(result);
|
||||
return result.address == 0 ? null : ClippingAttachment.fromPointer(result);
|
||||
}
|
||||
|
||||
AtlasRegion findRegion(String name) {
|
||||
AtlasRegion? findRegion(String name) {
|
||||
final result =
|
||||
SpineBindings.bindings.spine_atlas_attachment_loader_find_region(_ptr, name.toNativeUtf8().cast<Char>());
|
||||
return AtlasRegion.fromPointer(result);
|
||||
return result.address == 0 ? null : AtlasRegion.fromPointer(result);
|
||||
}
|
||||
}
|
||||
|
||||
@ -154,7 +154,7 @@ class AtlasPage {
|
||||
SpineBindings.bindings.spine_atlas_page_set_index(_ptr, value);
|
||||
}
|
||||
|
||||
Pointer<Void> get texture {
|
||||
Pointer<Void>? get texture {
|
||||
final result = SpineBindings.bindings.spine_atlas_page_get_texture(_ptr);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -57,9 +57,9 @@ class AtlasRegion extends TextureRegion {
|
||||
SpineBindings.bindings.spine_atlas_region_dispose(_ptr);
|
||||
}
|
||||
|
||||
AtlasPage get page {
|
||||
AtlasPage? get page {
|
||||
final result = SpineBindings.bindings.spine_atlas_region_get_page(_ptr);
|
||||
return AtlasPage.fromPointer(result);
|
||||
return result.address == 0 ? null : AtlasPage.fromPointer(result);
|
||||
}
|
||||
|
||||
String get name {
|
||||
@ -137,8 +137,8 @@ class AtlasRegion extends TextureRegion {
|
||||
return ArrayFloat.fromPointer(result);
|
||||
}
|
||||
|
||||
set page(AtlasPage value) {
|
||||
SpineBindings.bindings.spine_atlas_region_set_page(_ptr, value.nativePtr.cast());
|
||||
set page(AtlasPage? value) {
|
||||
SpineBindings.bindings.spine_atlas_region_set_page(_ptr, value?.nativePtr.cast() ?? Pointer.fromAddress(0));
|
||||
}
|
||||
|
||||
set name(String value) {
|
||||
|
||||
@ -42,10 +42,10 @@ import 'skin.dart';
|
||||
/// AttachmentLoader wrapper
|
||||
abstract class AttachmentLoader {
|
||||
Pointer get nativePtr;
|
||||
RegionAttachment newRegionAttachment(Skin skin, String name, String path, Sequence sequence);
|
||||
MeshAttachment newMeshAttachment(Skin skin, String name, String path, Sequence sequence);
|
||||
BoundingBoxAttachment newBoundingBoxAttachment(Skin skin, String name);
|
||||
PathAttachment newPathAttachment(Skin skin, String name);
|
||||
PointAttachment newPointAttachment(Skin skin, String name);
|
||||
ClippingAttachment newClippingAttachment(Skin skin, String name);
|
||||
RegionAttachment? newRegionAttachment(Skin skin, String name, String path, Sequence? sequence);
|
||||
MeshAttachment? newMeshAttachment(Skin skin, String name, String path, Sequence? sequence);
|
||||
BoundingBoxAttachment? newBoundingBoxAttachment(Skin skin, String name);
|
||||
PathAttachment? newPathAttachment(Skin skin, String name);
|
||||
PointAttachment? newPointAttachment(Skin skin, String name);
|
||||
ClippingAttachment? newClippingAttachment(Skin skin, String name);
|
||||
}
|
||||
|
||||
@ -53,13 +53,15 @@ class Bone extends PosedActive implements Posed, Update {
|
||||
@override
|
||||
Pointer get nativePtr => _ptr;
|
||||
|
||||
factory Bone(BoneData data, Bone parent) {
|
||||
final ptr = SpineBindings.bindings.spine_bone_create(data.nativePtr.cast(), parent.nativePtr.cast());
|
||||
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);
|
||||
}
|
||||
|
||||
factory Bone.from(Bone bone, Bone parent) {
|
||||
final ptr = SpineBindings.bindings.spine_bone_create2(bone.nativePtr.cast(), parent.nativePtr.cast());
|
||||
factory Bone.from(Bone bone, Bone? parent) {
|
||||
final ptr = SpineBindings.bindings
|
||||
.spine_bone_create2(bone.nativePtr.cast(), parent?.nativePtr.cast() ?? Pointer.fromAddress(0));
|
||||
return Bone.fromPointer(ptr);
|
||||
}
|
||||
|
||||
@ -74,9 +76,9 @@ class Bone extends PosedActive implements Posed, Update {
|
||||
return Rtti.fromPointer(result);
|
||||
}
|
||||
|
||||
Bone get parent {
|
||||
Bone? get parent {
|
||||
final result = SpineBindings.bindings.spine_bone_get_parent(_ptr);
|
||||
return Bone.fromPointer(result);
|
||||
return result.address == 0 ? null : Bone.fromPointer(result);
|
||||
}
|
||||
|
||||
ArrayBone get children {
|
||||
|
||||
@ -47,9 +47,9 @@ class BoneData extends PosedData {
|
||||
@override
|
||||
Pointer get nativePtr => _ptr;
|
||||
|
||||
factory BoneData(int index, String name, BoneData parent) {
|
||||
final ptr =
|
||||
SpineBindings.bindings.spine_bone_data_create(index, name.toNativeUtf8().cast<Char>(), parent.nativePtr.cast());
|
||||
factory BoneData(int index, String name, BoneData? parent) {
|
||||
final ptr = SpineBindings.bindings.spine_bone_data_create(
|
||||
index, name.toNativeUtf8().cast<Char>(), parent?.nativePtr.cast() ?? Pointer.fromAddress(0));
|
||||
return BoneData.fromPointer(ptr);
|
||||
}
|
||||
|
||||
@ -63,9 +63,9 @@ class BoneData extends PosedData {
|
||||
return result;
|
||||
}
|
||||
|
||||
BoneData get parent {
|
||||
BoneData? get parent {
|
||||
final result = SpineBindings.bindings.spine_bone_data_get_parent(_ptr);
|
||||
return BoneData.fromPointer(result);
|
||||
return result.address == 0 ? null : BoneData.fromPointer(result);
|
||||
}
|
||||
|
||||
double get length {
|
||||
|
||||
@ -56,13 +56,14 @@ class ClippingAttachment extends VertexAttachment {
|
||||
SpineBindings.bindings.spine_clipping_attachment_dispose(_ptr);
|
||||
}
|
||||
|
||||
SlotData get endSlot {
|
||||
SlotData? get endSlot {
|
||||
final result = SpineBindings.bindings.spine_clipping_attachment_get_end_slot(_ptr);
|
||||
return SlotData.fromPointer(result);
|
||||
return result.address == 0 ? null : SlotData.fromPointer(result);
|
||||
}
|
||||
|
||||
set endSlot(SlotData value) {
|
||||
SpineBindings.bindings.spine_clipping_attachment_set_end_slot(_ptr, value.nativePtr.cast());
|
||||
set endSlot(SlotData? value) {
|
||||
SpineBindings.bindings
|
||||
.spine_clipping_attachment_set_end_slot(_ptr, value?.nativePtr.cast() ?? Pointer.fromAddress(0));
|
||||
}
|
||||
|
||||
Color get color {
|
||||
|
||||
@ -54,7 +54,8 @@ class DrawOrderTimeline extends Timeline {
|
||||
SpineBindings.bindings.spine_draw_order_timeline_dispose(_ptr);
|
||||
}
|
||||
|
||||
void setFrame(int frame, double time, ArrayInt drawOrder) {
|
||||
SpineBindings.bindings.spine_draw_order_timeline_set_frame(_ptr, frame, time, drawOrder.nativePtr.cast());
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
@ -45,9 +45,9 @@ class EventQueueEntry {
|
||||
/// Get the native pointer for FFI calls
|
||||
Pointer get nativePtr => _ptr;
|
||||
|
||||
factory EventQueueEntry(EventType eventType, TrackEntry trackEntry, Event event) {
|
||||
final ptr = SpineBindings.bindings
|
||||
.spine_event_queue_entry_create(eventType.value, trackEntry.nativePtr.cast(), event.nativePtr.cast());
|
||||
factory EventQueueEntry(EventType eventType, TrackEntry? trackEntry, Event? event) {
|
||||
final ptr = SpineBindings.bindings.spine_event_queue_entry_create(eventType.value,
|
||||
trackEntry?.nativePtr.cast() ?? Pointer.fromAddress(0), event?.nativePtr.cast() ?? Pointer.fromAddress(0));
|
||||
return EventQueueEntry.fromPointer(ptr);
|
||||
}
|
||||
|
||||
@ -64,21 +64,21 @@ class EventQueueEntry {
|
||||
SpineBindings.bindings.spine_event_queue_entry_set__type(_ptr, value.value);
|
||||
}
|
||||
|
||||
TrackEntry get entry {
|
||||
TrackEntry? get entry {
|
||||
final result = SpineBindings.bindings.spine_event_queue_entry_get__entry(_ptr);
|
||||
return TrackEntry.fromPointer(result);
|
||||
return result.address == 0 ? null : TrackEntry.fromPointer(result);
|
||||
}
|
||||
|
||||
set entry(TrackEntry value) {
|
||||
SpineBindings.bindings.spine_event_queue_entry_set__entry(_ptr, value.nativePtr.cast());
|
||||
set entry(TrackEntry? value) {
|
||||
SpineBindings.bindings.spine_event_queue_entry_set__entry(_ptr, value?.nativePtr.cast() ?? Pointer.fromAddress(0));
|
||||
}
|
||||
|
||||
Event get event {
|
||||
Event? get event {
|
||||
final result = SpineBindings.bindings.spine_event_queue_entry_get__event(_ptr);
|
||||
return Event.fromPointer(result);
|
||||
return result.address == 0 ? null : Event.fromPointer(result);
|
||||
}
|
||||
|
||||
set event(Event value) {
|
||||
SpineBindings.bindings.spine_event_queue_entry_set__event(_ptr, value.nativePtr.cast());
|
||||
set event(Event? value) {
|
||||
SpineBindings.bindings.spine_event_queue_entry_set__event(_ptr, value?.nativePtr.cast() ?? Pointer.fromAddress(0));
|
||||
}
|
||||
}
|
||||
|
||||
@ -63,12 +63,12 @@ abstract class FromProperty {
|
||||
SpineBindings.bindings.spine_from_property_set__offset(_ptr, value);
|
||||
}
|
||||
|
||||
ArrayToProperty get to {
|
||||
ArrayToProperty? get to {
|
||||
final result = SpineBindings.bindings.spine_from_property_get__to(_ptr);
|
||||
return ArrayToProperty.fromPointer(result);
|
||||
return result.address == 0 ? null : ArrayToProperty.fromPointer(result);
|
||||
}
|
||||
|
||||
set to(ArrayToProperty value) {
|
||||
SpineBindings.bindings.spine_from_property_set__to(_ptr, value.nativePtr.cast());
|
||||
set to(ArrayToProperty? value) {
|
||||
SpineBindings.bindings.spine_from_property_set__to(_ptr, value?.nativePtr.cast() ?? Pointer.fromAddress(0));
|
||||
}
|
||||
}
|
||||
|
||||
@ -108,31 +108,32 @@ class MeshAttachment extends VertexAttachment {
|
||||
SpineBindings.bindings.spine_mesh_attachment_set_path(_ptr, value.toNativeUtf8().cast<Char>());
|
||||
}
|
||||
|
||||
TextureRegion get region {
|
||||
TextureRegion? get region {
|
||||
final result = SpineBindings.bindings.spine_mesh_attachment_get_region(_ptr);
|
||||
return TextureRegion.fromPointer(result);
|
||||
return result.address == 0 ? null : TextureRegion.fromPointer(result);
|
||||
}
|
||||
|
||||
set region(TextureRegion value) {
|
||||
SpineBindings.bindings.spine_mesh_attachment_set_region(_ptr, value.nativePtr.cast());
|
||||
set region(TextureRegion? value) {
|
||||
SpineBindings.bindings.spine_mesh_attachment_set_region(_ptr, value?.nativePtr.cast() ?? Pointer.fromAddress(0));
|
||||
}
|
||||
|
||||
Sequence get sequence {
|
||||
Sequence? get sequence {
|
||||
final result = SpineBindings.bindings.spine_mesh_attachment_get_sequence(_ptr);
|
||||
return Sequence.fromPointer(result);
|
||||
return result.address == 0 ? null : Sequence.fromPointer(result);
|
||||
}
|
||||
|
||||
set sequence(Sequence value) {
|
||||
SpineBindings.bindings.spine_mesh_attachment_set_sequence(_ptr, value.nativePtr.cast());
|
||||
set sequence(Sequence? value) {
|
||||
SpineBindings.bindings.spine_mesh_attachment_set_sequence(_ptr, value?.nativePtr.cast() ?? Pointer.fromAddress(0));
|
||||
}
|
||||
|
||||
MeshAttachment get parentMesh {
|
||||
MeshAttachment? get parentMesh {
|
||||
final result = SpineBindings.bindings.spine_mesh_attachment_get_parent_mesh(_ptr);
|
||||
return MeshAttachment.fromPointer(result);
|
||||
return result.address == 0 ? null : MeshAttachment.fromPointer(result);
|
||||
}
|
||||
|
||||
set parentMesh(MeshAttachment value) {
|
||||
SpineBindings.bindings.spine_mesh_attachment_set_parent_mesh(_ptr, value.nativePtr.cast());
|
||||
set parentMesh(MeshAttachment? value) {
|
||||
SpineBindings.bindings
|
||||
.spine_mesh_attachment_set_parent_mesh(_ptr, value?.nativePtr.cast() ?? Pointer.fromAddress(0));
|
||||
}
|
||||
|
||||
ArrayUnsignedShort get edges {
|
||||
|
||||
@ -140,22 +140,23 @@ class RegionAttachment extends Attachment {
|
||||
SpineBindings.bindings.spine_region_attachment_set_path(_ptr, value.toNativeUtf8().cast<Char>());
|
||||
}
|
||||
|
||||
TextureRegion get region {
|
||||
TextureRegion? get region {
|
||||
final result = SpineBindings.bindings.spine_region_attachment_get_region(_ptr);
|
||||
return TextureRegion.fromPointer(result);
|
||||
return result.address == 0 ? null : TextureRegion.fromPointer(result);
|
||||
}
|
||||
|
||||
set region(TextureRegion value) {
|
||||
SpineBindings.bindings.spine_region_attachment_set_region(_ptr, value.nativePtr.cast());
|
||||
set region(TextureRegion? value) {
|
||||
SpineBindings.bindings.spine_region_attachment_set_region(_ptr, value?.nativePtr.cast() ?? Pointer.fromAddress(0));
|
||||
}
|
||||
|
||||
Sequence get sequence {
|
||||
Sequence? get sequence {
|
||||
final result = SpineBindings.bindings.spine_region_attachment_get_sequence(_ptr);
|
||||
return Sequence.fromPointer(result);
|
||||
return result.address == 0 ? null : Sequence.fromPointer(result);
|
||||
}
|
||||
|
||||
set sequence(Sequence value) {
|
||||
SpineBindings.bindings.spine_region_attachment_set_sequence(_ptr, value.nativePtr.cast());
|
||||
set sequence(Sequence? value) {
|
||||
SpineBindings.bindings
|
||||
.spine_region_attachment_set_sequence(_ptr, value?.nativePtr.cast() ?? Pointer.fromAddress(0));
|
||||
}
|
||||
|
||||
ArrayFloat get offset {
|
||||
|
||||
@ -47,22 +47,22 @@ class RenderCommand {
|
||||
SpineBindings.bindings.spine_render_command_dispose(_ptr);
|
||||
}
|
||||
|
||||
Pointer<Float> get positions {
|
||||
Pointer<Float>? get positions {
|
||||
final result = SpineBindings.bindings.spine_render_command_get_positions(_ptr);
|
||||
return result;
|
||||
}
|
||||
|
||||
Pointer<Float> get uvs {
|
||||
Pointer<Float>? get uvs {
|
||||
final result = SpineBindings.bindings.spine_render_command_get_uvs(_ptr);
|
||||
return result;
|
||||
}
|
||||
|
||||
Pointer<Uint32> get colors {
|
||||
Pointer<Uint32>? get colors {
|
||||
final result = SpineBindings.bindings.spine_render_command_get_colors(_ptr);
|
||||
return result;
|
||||
}
|
||||
|
||||
Pointer<Uint32> get darkColors {
|
||||
Pointer<Uint32>? get darkColors {
|
||||
final result = SpineBindings.bindings.spine_render_command_get_dark_colors(_ptr);
|
||||
return result;
|
||||
}
|
||||
@ -72,7 +72,7 @@ class RenderCommand {
|
||||
return result;
|
||||
}
|
||||
|
||||
Pointer<Uint16> get indices {
|
||||
Pointer<Uint16>? get indices {
|
||||
final result = SpineBindings.bindings.spine_render_command_get_indices(_ptr);
|
||||
return result;
|
||||
}
|
||||
@ -87,13 +87,13 @@ class RenderCommand {
|
||||
return BlendMode.fromValue(result);
|
||||
}
|
||||
|
||||
Pointer<Void> get texture {
|
||||
Pointer<Void>? get texture {
|
||||
final result = SpineBindings.bindings.spine_render_command_get_texture(_ptr);
|
||||
return result;
|
||||
}
|
||||
|
||||
RenderCommand get next {
|
||||
RenderCommand? get next {
|
||||
final result = SpineBindings.bindings.spine_render_command_get_next(_ptr);
|
||||
return RenderCommand.fromPointer(result);
|
||||
return result.address == 0 ? null : RenderCommand.fromPointer(result);
|
||||
}
|
||||
}
|
||||
|
||||
@ -47,9 +47,9 @@ class Rtti {
|
||||
SpineBindings.bindings.spine_rtti_dispose(_ptr);
|
||||
}
|
||||
|
||||
String get className {
|
||||
String? get className {
|
||||
final result = SpineBindings.bindings.spine_rtti_get_class_name(_ptr);
|
||||
return result.cast<Utf8>().toDartString();
|
||||
return result.address == 0 ? null : result.cast<Utf8>().toDartString();
|
||||
}
|
||||
|
||||
bool isExactly(Rtti rtti) {
|
||||
|
||||
@ -60,8 +60,9 @@ class Sequence {
|
||||
return Sequence.fromPointer(result);
|
||||
}
|
||||
|
||||
void apply(SlotPose slot, Attachment attachment) {
|
||||
SpineBindings.bindings.spine_sequence_apply(_ptr, slot.nativePtr.cast(), attachment.nativePtr.cast());
|
||||
void apply(SlotPose? slot, Attachment? attachment) {
|
||||
SpineBindings.bindings.spine_sequence_apply(
|
||||
_ptr, slot?.nativePtr.cast() ?? Pointer.fromAddress(0), attachment?.nativePtr.cast() ?? Pointer.fromAddress(0));
|
||||
}
|
||||
|
||||
String getPath(String basePath, int index) {
|
||||
|
||||
@ -79,8 +79,8 @@ class Skeleton {
|
||||
SpineBindings.bindings.spine_skeleton_constrained(_ptr, object.nativePtr.cast());
|
||||
}
|
||||
|
||||
void sortBone(Bone bone) {
|
||||
SpineBindings.bindings.spine_skeleton_sort_bone(_ptr, bone.nativePtr.cast());
|
||||
void sortBone(Bone? bone) {
|
||||
SpineBindings.bindings.spine_skeleton_sort_bone(_ptr, bone?.nativePtr.cast() ?? Pointer.fromAddress(0));
|
||||
}
|
||||
|
||||
static void sortReset(ArrayBone bones) {
|
||||
@ -118,14 +118,14 @@ class Skeleton {
|
||||
return ArrayUpdate.fromPointer(result);
|
||||
}
|
||||
|
||||
Bone get rootBone {
|
||||
Bone? get rootBone {
|
||||
final result = SpineBindings.bindings.spine_skeleton_get_root_bone(_ptr);
|
||||
return Bone.fromPointer(result);
|
||||
return result.address == 0 ? null : Bone.fromPointer(result);
|
||||
}
|
||||
|
||||
Bone findBone(String boneName) {
|
||||
Bone? findBone(String boneName) {
|
||||
final result = SpineBindings.bindings.spine_skeleton_find_bone(_ptr, boneName.toNativeUtf8().cast<Char>());
|
||||
return Bone.fromPointer(result);
|
||||
return result.address == 0 ? null : Bone.fromPointer(result);
|
||||
}
|
||||
|
||||
ArraySlot get slots {
|
||||
@ -133,9 +133,9 @@ class Skeleton {
|
||||
return ArraySlot.fromPointer(result);
|
||||
}
|
||||
|
||||
Slot findSlot(String slotName) {
|
||||
Slot? findSlot(String slotName) {
|
||||
final result = SpineBindings.bindings.spine_skeleton_find_slot(_ptr, slotName.toNativeUtf8().cast<Char>());
|
||||
return Slot.fromPointer(result);
|
||||
return result.address == 0 ? null : Slot.fromPointer(result);
|
||||
}
|
||||
|
||||
ArraySlot get drawOrder {
|
||||
@ -143,9 +143,9 @@ class Skeleton {
|
||||
return ArraySlot.fromPointer(result);
|
||||
}
|
||||
|
||||
Skin get skin {
|
||||
Skin? get skin {
|
||||
final result = SpineBindings.bindings.spine_skeleton_get_skin(_ptr);
|
||||
return Skin.fromPointer(result);
|
||||
return result.address == 0 ? null : Skin.fromPointer(result);
|
||||
}
|
||||
|
||||
void setAttachment(String slotName, String attachmentName) {
|
||||
@ -273,13 +273,14 @@ class Skeleton {
|
||||
SpineBindings.bindings.spine_skeleton_set_skin_1(_ptr, skinName.toNativeUtf8().cast<Char>());
|
||||
}
|
||||
|
||||
void setSkin2(Skin newSkin) {
|
||||
SpineBindings.bindings.spine_skeleton_set_skin_2(_ptr, newSkin.nativePtr.cast());
|
||||
void setSkin2(Skin? newSkin) {
|
||||
SpineBindings.bindings.spine_skeleton_set_skin_2(_ptr, newSkin?.nativePtr.cast() ?? Pointer.fromAddress(0));
|
||||
}
|
||||
|
||||
Attachment getAttachment(String slotName, String attachmentName) {
|
||||
Attachment? getAttachment(String slotName, String attachmentName) {
|
||||
final result = SpineBindings.bindings.spine_skeleton_get_attachment_1(
|
||||
_ptr, slotName.toNativeUtf8().cast<Char>(), attachmentName.toNativeUtf8().cast<Char>());
|
||||
if (result.address == 0) return null;
|
||||
final rtti = SpineBindings.bindings.spine_attachment_get_rtti(result);
|
||||
final className = SpineBindings.bindings.spine_rtti_get_class_name(rtti).cast<Utf8>().toDartString();
|
||||
switch (className) {
|
||||
@ -300,9 +301,10 @@ class Skeleton {
|
||||
}
|
||||
}
|
||||
|
||||
Attachment getAttachment2(int slotIndex, String attachmentName) {
|
||||
Attachment? getAttachment2(int slotIndex, String attachmentName) {
|
||||
final result = SpineBindings.bindings
|
||||
.spine_skeleton_get_attachment_2(_ptr, slotIndex, attachmentName.toNativeUtf8().cast<Char>());
|
||||
if (result.address == 0) return null;
|
||||
final rtti = SpineBindings.bindings.spine_attachment_get_rtti(result);
|
||||
final className = SpineBindings.bindings.spine_rtti_get_class_name(rtti).cast<Utf8>().toDartString();
|
||||
switch (className) {
|
||||
|
||||
@ -60,10 +60,10 @@ class SkeletonBinary {
|
||||
SpineBindings.bindings.spine_skeleton_binary_dispose(_ptr);
|
||||
}
|
||||
|
||||
SkeletonData readSkeletonDataFile(String path) {
|
||||
SkeletonData? readSkeletonDataFile(String path) {
|
||||
final result =
|
||||
SpineBindings.bindings.spine_skeleton_binary_read_skeleton_data_file(_ptr, path.toNativeUtf8().cast<Char>());
|
||||
return SkeletonData.fromPointer(result);
|
||||
return result.address == 0 ? null : SkeletonData.fromPointer(result);
|
||||
}
|
||||
|
||||
set scale(double value) {
|
||||
|
||||
@ -74,14 +74,16 @@ class SkeletonBounds {
|
||||
return result;
|
||||
}
|
||||
|
||||
Polygon getPolygon(BoundingBoxAttachment attachment) {
|
||||
final result = SpineBindings.bindings.spine_skeleton_bounds_get_polygon(_ptr, attachment.nativePtr.cast());
|
||||
return Polygon.fromPointer(result);
|
||||
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);
|
||||
}
|
||||
|
||||
BoundingBoxAttachment getBoundingBox(Polygon polygon) {
|
||||
final result = SpineBindings.bindings.spine_skeleton_bounds_get_bounding_box(_ptr, polygon.nativePtr.cast());
|
||||
return BoundingBoxAttachment.fromPointer(result);
|
||||
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);
|
||||
}
|
||||
|
||||
ArrayPolygon get polygons {
|
||||
@ -129,14 +131,14 @@ class SkeletonBounds {
|
||||
return result;
|
||||
}
|
||||
|
||||
BoundingBoxAttachment containsPoint2(double x, double y) {
|
||||
BoundingBoxAttachment? containsPoint2(double x, double y) {
|
||||
final result = SpineBindings.bindings.spine_skeleton_bounds_contains_point_2(_ptr, x, y);
|
||||
return BoundingBoxAttachment.fromPointer(result);
|
||||
return result.address == 0 ? null : BoundingBoxAttachment.fromPointer(result);
|
||||
}
|
||||
|
||||
BoundingBoxAttachment intersectsSegment(double x1, double y1, double x2, double y2) {
|
||||
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 BoundingBoxAttachment.fromPointer(result);
|
||||
return result.address == 0 ? null : BoundingBoxAttachment.fromPointer(result);
|
||||
}
|
||||
|
||||
bool intersectsSegment2(Polygon polygon, double x1, double y1, double x2, double y2) {
|
||||
|
||||
@ -55,9 +55,9 @@ class SkeletonClipping {
|
||||
SpineBindings.bindings.spine_skeleton_clipping_dispose(_ptr);
|
||||
}
|
||||
|
||||
int clipStart(Skeleton skeleton, Slot slot, ClippingAttachment clip) {
|
||||
int clipStart(Skeleton skeleton, Slot slot, ClippingAttachment? clip) {
|
||||
final result = SpineBindings.bindings.spine_skeleton_clipping_clip_start(
|
||||
_ptr, skeleton.nativePtr.cast(), slot.nativePtr.cast(), clip.nativePtr.cast());
|
||||
_ptr, skeleton.nativePtr.cast(), slot.nativePtr.cast(), clip?.nativePtr.cast() ?? Pointer.fromAddress(0));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@ -58,31 +58,31 @@ class SkeletonData {
|
||||
SpineBindings.bindings.spine_skeleton_data_dispose(_ptr);
|
||||
}
|
||||
|
||||
BoneData findBone(String boneName) {
|
||||
BoneData? findBone(String boneName) {
|
||||
final result = SpineBindings.bindings.spine_skeleton_data_find_bone(_ptr, boneName.toNativeUtf8().cast<Char>());
|
||||
return BoneData.fromPointer(result);
|
||||
return result.address == 0 ? null : BoneData.fromPointer(result);
|
||||
}
|
||||
|
||||
SlotData findSlot(String slotName) {
|
||||
SlotData? findSlot(String slotName) {
|
||||
final result = SpineBindings.bindings.spine_skeleton_data_find_slot(_ptr, slotName.toNativeUtf8().cast<Char>());
|
||||
return SlotData.fromPointer(result);
|
||||
return result.address == 0 ? null : SlotData.fromPointer(result);
|
||||
}
|
||||
|
||||
Skin findSkin(String skinName) {
|
||||
Skin? findSkin(String skinName) {
|
||||
final result = SpineBindings.bindings.spine_skeleton_data_find_skin(_ptr, skinName.toNativeUtf8().cast<Char>());
|
||||
return Skin.fromPointer(result);
|
||||
return result.address == 0 ? null : Skin.fromPointer(result);
|
||||
}
|
||||
|
||||
EventData findEvent(String eventDataName) {
|
||||
EventData? findEvent(String eventDataName) {
|
||||
final result =
|
||||
SpineBindings.bindings.spine_skeleton_data_find_event(_ptr, eventDataName.toNativeUtf8().cast<Char>());
|
||||
return EventData.fromPointer(result);
|
||||
return result.address == 0 ? null : EventData.fromPointer(result);
|
||||
}
|
||||
|
||||
Animation findAnimation(String animationName) {
|
||||
Animation? findAnimation(String animationName) {
|
||||
final result =
|
||||
SpineBindings.bindings.spine_skeleton_data_find_animation(_ptr, animationName.toNativeUtf8().cast<Char>());
|
||||
return Animation.fromPointer(result);
|
||||
return result.address == 0 ? null : Animation.fromPointer(result);
|
||||
}
|
||||
|
||||
String get name {
|
||||
@ -109,13 +109,14 @@ class SkeletonData {
|
||||
return ArraySkin.fromPointer(result);
|
||||
}
|
||||
|
||||
Skin get defaultSkin {
|
||||
Skin? get defaultSkin {
|
||||
final result = SpineBindings.bindings.spine_skeleton_data_get_default_skin(_ptr);
|
||||
return Skin.fromPointer(result);
|
||||
return result.address == 0 ? null : Skin.fromPointer(result);
|
||||
}
|
||||
|
||||
set defaultSkin(Skin value) {
|
||||
SpineBindings.bindings.spine_skeleton_data_set_default_skin(_ptr, value.nativePtr.cast());
|
||||
set defaultSkin(Skin? value) {
|
||||
SpineBindings.bindings
|
||||
.spine_skeleton_data_set_default_skin(_ptr, value?.nativePtr.cast() ?? Pointer.fromAddress(0));
|
||||
}
|
||||
|
||||
ArrayEventData get events {
|
||||
|
||||
@ -60,16 +60,16 @@ class SkeletonJson {
|
||||
SpineBindings.bindings.spine_skeleton_json_dispose(_ptr);
|
||||
}
|
||||
|
||||
SkeletonData readSkeletonDataFile(String path) {
|
||||
SkeletonData? readSkeletonDataFile(String path) {
|
||||
final result =
|
||||
SpineBindings.bindings.spine_skeleton_json_read_skeleton_data_file(_ptr, path.toNativeUtf8().cast<Char>());
|
||||
return SkeletonData.fromPointer(result);
|
||||
return result.address == 0 ? null : SkeletonData.fromPointer(result);
|
||||
}
|
||||
|
||||
SkeletonData readSkeletonData(String json) {
|
||||
SkeletonData? readSkeletonData(String json) {
|
||||
final result =
|
||||
SpineBindings.bindings.spine_skeleton_json_read_skeleton_data(_ptr, json.toNativeUtf8().cast<Char>());
|
||||
return SkeletonData.fromPointer(result);
|
||||
return result.address == 0 ? null : SkeletonData.fromPointer(result);
|
||||
}
|
||||
|
||||
set scale(double value) {
|
||||
|
||||
@ -53,8 +53,8 @@ class SkeletonRenderer {
|
||||
SpineBindings.bindings.spine_skeleton_renderer_dispose(_ptr);
|
||||
}
|
||||
|
||||
RenderCommand render(Skeleton skeleton) {
|
||||
RenderCommand? render(Skeleton skeleton) {
|
||||
final result = SpineBindings.bindings.spine_skeleton_renderer_render(_ptr, skeleton.nativePtr.cast());
|
||||
return RenderCommand.fromPointer(result);
|
||||
return result.address == 0 ? null : RenderCommand.fromPointer(result);
|
||||
}
|
||||
}
|
||||
|
||||
@ -66,8 +66,9 @@ class Skin {
|
||||
.spine_skin_set_attachment(_ptr, slotIndex, name.toNativeUtf8().cast<Char>(), attachment.nativePtr.cast());
|
||||
}
|
||||
|
||||
Attachment getAttachment(int slotIndex, String name) {
|
||||
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;
|
||||
final rtti = SpineBindings.bindings.spine_attachment_get_rtti(result);
|
||||
final className = SpineBindings.bindings.spine_rtti_get_class_name(rtti).cast<Utf8>().toDartString();
|
||||
switch (className) {
|
||||
|
||||
@ -128,17 +128,18 @@ class SliderData extends PosedData implements ConstraintData {
|
||||
SpineBindings.bindings.spine_slider_data_set_loop(_ptr, value);
|
||||
}
|
||||
|
||||
BoneData get bone {
|
||||
BoneData? get bone {
|
||||
final result = SpineBindings.bindings.spine_slider_data_get_bone(_ptr);
|
||||
return BoneData.fromPointer(result);
|
||||
return result.address == 0 ? null : BoneData.fromPointer(result);
|
||||
}
|
||||
|
||||
set bone(BoneData value) {
|
||||
SpineBindings.bindings.spine_slider_data_set_bone(_ptr, value.nativePtr.cast());
|
||||
set bone(BoneData? value) {
|
||||
SpineBindings.bindings.spine_slider_data_set_bone(_ptr, value?.nativePtr.cast() ?? Pointer.fromAddress(0));
|
||||
}
|
||||
|
||||
FromProperty get property {
|
||||
FromProperty? get property {
|
||||
final result = SpineBindings.bindings.spine_slider_data_get_property(_ptr);
|
||||
if (result.address == 0) return null;
|
||||
final rtti = SpineBindings.bindings.spine_from_property_get_rtti(result);
|
||||
final className = SpineBindings.bindings.spine_rtti_get_class_name(rtti).cast<Utf8>().toDartString();
|
||||
switch (className) {
|
||||
@ -159,8 +160,8 @@ class SliderData extends PosedData implements ConstraintData {
|
||||
}
|
||||
}
|
||||
|
||||
set property(FromProperty value) {
|
||||
SpineBindings.bindings.spine_slider_data_set_property(_ptr, value.nativePtr.cast());
|
||||
set property(FromProperty? value) {
|
||||
SpineBindings.bindings.spine_slider_data_set_property(_ptr, value?.nativePtr.cast() ?? Pointer.fromAddress(0));
|
||||
}
|
||||
|
||||
double get scale {
|
||||
|
||||
@ -84,8 +84,9 @@ class SlotPose {
|
||||
SpineBindings.bindings.spine_slot_pose_set_has_dark_color(_ptr, value);
|
||||
}
|
||||
|
||||
Attachment get attachment {
|
||||
Attachment? get attachment {
|
||||
final result = SpineBindings.bindings.spine_slot_pose_get_attachment(_ptr);
|
||||
if (result.address == 0) return null;
|
||||
final rtti = SpineBindings.bindings.spine_attachment_get_rtti(result);
|
||||
final className = SpineBindings.bindings.spine_rtti_get_class_name(rtti).cast<Utf8>().toDartString();
|
||||
switch (className) {
|
||||
@ -106,8 +107,8 @@ class SlotPose {
|
||||
}
|
||||
}
|
||||
|
||||
set attachment(Attachment value) {
|
||||
SpineBindings.bindings.spine_slot_pose_set_attachment(_ptr, value.nativePtr.cast());
|
||||
set attachment(Attachment? value) {
|
||||
SpineBindings.bindings.spine_slot_pose_set_attachment(_ptr, value?.nativePtr.cast() ?? Pointer.fromAddress(0));
|
||||
}
|
||||
|
||||
int get sequenceIndex {
|
||||
|
||||
@ -52,10 +52,10 @@ abstract class Timeline {
|
||||
return Rtti.fromPointer(result);
|
||||
}
|
||||
|
||||
void apply(Skeleton skeleton, double lastTime, double time, ArrayEvent pEvents, double alpha, MixBlend blend,
|
||||
void apply(Skeleton skeleton, double lastTime, double time, ArrayEvent? pEvents, double alpha, MixBlend blend,
|
||||
MixDirection direction, bool appliedPose) {
|
||||
SpineBindings.bindings.spine_timeline_apply(_ptr, skeleton.nativePtr.cast(), lastTime, time,
|
||||
pEvents.nativePtr.cast(), alpha, blend.value, direction.value, appliedPose);
|
||||
pEvents?.nativePtr.cast() ?? Pointer.fromAddress(0), alpha, blend.value, direction.value, appliedPose);
|
||||
}
|
||||
|
||||
int get frameEntries {
|
||||
|
||||
@ -67,9 +67,9 @@ class TrackEntry {
|
||||
SpineBindings.bindings.spine_track_entry_set_animation(_ptr, value.nativePtr.cast());
|
||||
}
|
||||
|
||||
TrackEntry get previous {
|
||||
TrackEntry? get previous {
|
||||
final result = SpineBindings.bindings.spine_track_entry_get_previous(_ptr);
|
||||
return TrackEntry.fromPointer(result);
|
||||
return result.address == 0 ? null : TrackEntry.fromPointer(result);
|
||||
}
|
||||
|
||||
bool get loop {
|
||||
@ -221,9 +221,9 @@ class TrackEntry {
|
||||
SpineBindings.bindings.spine_track_entry_set_mix_draw_order_threshold(_ptr, value);
|
||||
}
|
||||
|
||||
TrackEntry get next {
|
||||
TrackEntry? get next {
|
||||
final result = SpineBindings.bindings.spine_track_entry_get_next(_ptr);
|
||||
return TrackEntry.fromPointer(result);
|
||||
return result.address == 0 ? null : TrackEntry.fromPointer(result);
|
||||
}
|
||||
|
||||
bool get isComplete {
|
||||
@ -254,14 +254,14 @@ class TrackEntry {
|
||||
SpineBindings.bindings.spine_track_entry_set_mix_blend(_ptr, value.value);
|
||||
}
|
||||
|
||||
TrackEntry get mixingFrom {
|
||||
TrackEntry? get mixingFrom {
|
||||
final result = SpineBindings.bindings.spine_track_entry_get_mixing_from(_ptr);
|
||||
return TrackEntry.fromPointer(result);
|
||||
return result.address == 0 ? null : TrackEntry.fromPointer(result);
|
||||
}
|
||||
|
||||
TrackEntry get mixingTo {
|
||||
TrackEntry? get mixingTo {
|
||||
final result = SpineBindings.bindings.spine_track_entry_get_mixing_to(_ptr);
|
||||
return TrackEntry.fromPointer(result);
|
||||
return result.address == 0 ? null : TrackEntry.fromPointer(result);
|
||||
}
|
||||
|
||||
void resetRotationDirections() {
|
||||
@ -288,7 +288,7 @@ class TrackEntry {
|
||||
return result;
|
||||
}
|
||||
|
||||
Pointer<Void> get rendererObject {
|
||||
Pointer<Void>? get rendererObject {
|
||||
final result = SpineBindings.bindings.spine_track_entry_get_renderer_object(_ptr);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -86,8 +86,9 @@ abstract class VertexAttachment extends Attachment {
|
||||
SpineBindings.bindings.spine_vertex_attachment_set_world_vertices_length(_ptr, value);
|
||||
}
|
||||
|
||||
Attachment get timelineAttachment {
|
||||
Attachment? get timelineAttachment {
|
||||
final result = SpineBindings.bindings.spine_vertex_attachment_get_timeline_attachment(_ptr);
|
||||
if (result.address == 0) return null;
|
||||
final rtti = SpineBindings.bindings.spine_attachment_get_rtti(result);
|
||||
final className = SpineBindings.bindings.spine_rtti_get_class_name(rtti).cast<Utf8>().toDartString();
|
||||
switch (className) {
|
||||
@ -108,8 +109,9 @@ abstract class VertexAttachment extends Attachment {
|
||||
}
|
||||
}
|
||||
|
||||
set timelineAttachment(Attachment value) {
|
||||
SpineBindings.bindings.spine_vertex_attachment_set_timeline_attachment(_ptr, value.nativePtr.cast());
|
||||
set timelineAttachment(Attachment? value) {
|
||||
SpineBindings.bindings
|
||||
.spine_vertex_attachment_set_timeline_attachment(_ptr, value?.nativePtr.cast() ?? Pointer.fromAddress(0));
|
||||
}
|
||||
|
||||
void copyTo(VertexAttachment other) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user