mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-22 02:06:03 +08:00
[tests] Haxe serializer
This commit is contained in:
parent
790caa8316
commit
4a715633a7
@ -132,7 +132,7 @@ export class DartWriter {
|
|||||||
lines.push(this.generateHeader());
|
lines.push(this.generateHeader());
|
||||||
|
|
||||||
// Imports (unified logic)
|
// Imports (unified logic)
|
||||||
lines.push(...this.generateImports(dartClass.imports, dartClass.needsPackageFfi, dartClass.hasRtti));
|
lines.push(...this.generateImports(dartClass.imports, dartClass.hasRtti));
|
||||||
|
|
||||||
// Class declaration (unified)
|
// Class declaration (unified)
|
||||||
lines.push(this.generateClassDeclaration(dartClass));
|
lines.push(this.generateClassDeclaration(dartClass));
|
||||||
@ -242,7 +242,7 @@ export class DartWriter {
|
|||||||
|
|
||||||
// Add destructor as dispose method for concrete classes
|
// Add destructor as dispose method for concrete classes
|
||||||
if (classType === 'concrete' && cType.destructor) {
|
if (classType === 'concrete' && cType.destructor) {
|
||||||
members.push(this.createDisposeMethod(cType.destructor, cType));
|
members.push(this.createDisposeMethod(cType.destructor));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Process methods with unified logic - Apply SAME logic for ALL class types
|
// Process methods with unified logic - Apply SAME logic for ALL class types
|
||||||
@ -338,7 +338,7 @@ export class DartWriter {
|
|||||||
return overloadedSetters;
|
return overloadedSetters;
|
||||||
}
|
}
|
||||||
|
|
||||||
private createDisposeMethod (destructor: CMethod, cType: CClassOrStruct): DartMember {
|
private createDisposeMethod (destructor: CMethod): DartMember {
|
||||||
const implementation = `SpineBindings.bindings.${destructor.name}(_ptr);`;
|
const implementation = `SpineBindings.bindings.${destructor.name}(_ptr);`;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@ -498,7 +498,7 @@ export class DartWriter {
|
|||||||
// AUTO GENERATED FILE, DO NOT EDIT.`;
|
// AUTO GENERATED FILE, DO NOT EDIT.`;
|
||||||
}
|
}
|
||||||
|
|
||||||
private generateImports (imports: string[], needsPackageFfi: boolean, hasRtti: boolean): string[] {
|
private generateImports (imports: string[], hasRtti: boolean): string[] {
|
||||||
const lines: string[] = [];
|
const lines: string[] = [];
|
||||||
|
|
||||||
lines.push('');
|
lines.push('');
|
||||||
|
|||||||
@ -638,7 +638,7 @@ class SkeletonJson {
|
|||||||
var box:BoundingBoxAttachment = attachmentLoader.newBoundingBoxAttachment(skin, name);
|
var box:BoundingBoxAttachment = attachmentLoader.newBoundingBoxAttachment(skin, name);
|
||||||
if (box == null)
|
if (box == null)
|
||||||
return null;
|
return null;
|
||||||
readVertices(map, box, Std.parseInt(Reflect.field(map, "vertexCount")) << 1);
|
readVertices(map, box, getInt(map, "vertexCount", 0) << 1);
|
||||||
return box;
|
return box;
|
||||||
case AttachmentType.path:
|
case AttachmentType.path:
|
||||||
var path:PathAttachment = attachmentLoader.newPathAttachment(skin, name);
|
var path:PathAttachment = attachmentLoader.newPathAttachment(skin, name);
|
||||||
@ -646,7 +646,7 @@ class SkeletonJson {
|
|||||||
return null;
|
return null;
|
||||||
path.closed = Reflect.hasField(map, "closed") ? cast(Reflect.field(map, "closed"), Bool) : false;
|
path.closed = Reflect.hasField(map, "closed") ? cast(Reflect.field(map, "closed"), Bool) : false;
|
||||||
path.constantSpeed = Reflect.hasField(map, "constantSpeed") ? cast(Reflect.field(map, "constantSpeed"), Bool) : true;
|
path.constantSpeed = Reflect.hasField(map, "constantSpeed") ? cast(Reflect.field(map, "constantSpeed"), Bool) : true;
|
||||||
var vertexCount:Int = Std.parseInt(Reflect.field(map, "vertexCount"));
|
var vertexCount:Int = getInt(map, "vertexCount", 0);
|
||||||
readVertices(map, path, vertexCount << 1);
|
readVertices(map, path, vertexCount << 1);
|
||||||
var lengths:Array<Float> = new Array<Float>();
|
var lengths:Array<Float> = new Array<Float>();
|
||||||
for (curves in cast(Reflect.field(map, "lengths"), Array<Dynamic>)) {
|
for (curves in cast(Reflect.field(map, "lengths"), Array<Dynamic>)) {
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -95,7 +95,13 @@ class HeadlessTest {
|
|||||||
|
|
||||||
// Print skeleton state
|
// Print skeleton state
|
||||||
Sys.println("\n=== SKELETON STATE ===");
|
Sys.println("\n=== SKELETON STATE ===");
|
||||||
|
try {
|
||||||
Sys.println(serializer.serializeSkeleton(skeleton));
|
Sys.println(serializer.serializeSkeleton(skeleton));
|
||||||
|
} catch (e:Dynamic) {
|
||||||
|
Sys.stderr().writeString('Error serializing skeleton: $e\n');
|
||||||
|
Sys.stderr().writeString(haxe.CallStack.toString(haxe.CallStack.exceptionStack()) + '\n');
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
|
||||||
// Print animation state if present
|
// Print animation state if present
|
||||||
if (state != null) {
|
if (state != null) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user