From 361c6b4bb4c01835628e3a5a3f2e17ec5701f085 Mon Sep 17 00:00:00 2001 From: bofeng Date: Wed, 17 Jul 2024 10:58:28 +0800 Subject: [PATCH 1/7] Fix missing constructor for spine.String & SkeletonBounds --- cocos/spine/lib/spine-core.d.ts | 2 ++ .../editor-support/spine-wasm/spine-type-export.cpp | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/cocos/spine/lib/spine-core.d.ts b/cocos/spine/lib/spine-core.d.ts index 55e14a954ae..5989e9ec767 100644 --- a/cocos/spine/lib/spine-core.d.ts +++ b/cocos/spine/lib/spine-core.d.ts @@ -26,6 +26,8 @@ declare namespace spine { class String { + constructor(name: string, own: boolean); + constructor(val: String); length: number; isEmpty: boolean; strPtr: number; diff --git a/native/cocos/editor-support/spine-wasm/spine-type-export.cpp b/native/cocos/editor-support/spine-wasm/spine-type-export.cpp index 4fc0eac3c8d..894d310d320 100644 --- a/native/cocos/editor-support/spine-wasm/spine-type-export.cpp +++ b/native/cocos/editor-support/spine-wasm/spine-type-export.cpp @@ -60,6 +60,11 @@ void VECTOR_STD_COPY_SP(std::vector &stdVector, Vector &spVector) { } } +String* constructorSpineString(emscripten::val name, bool own) { + std::string tmp = name.as(); + return new String(tmp.c_str(), own); +} + using SPVectorFloat = Vector; using SPVectorVectorFloat = Vector>; using SPVectorInt = Vector; @@ -302,6 +307,9 @@ EMSCRIPTEN_BINDINGS(spine) { .function("normalize", &Vector2::normalize); class_("String") + .constructor<>() + .constructor(constructorSpineString) + .constructor() .function("length", &String::length) .function("isEmpty", &String::isEmpty) .function("append", select_overload(&String::append)) @@ -499,6 +507,7 @@ EMSCRIPTEN_BINDINGS(spine) { .function("setTranslateMix", &PathConstraintData::setTranslateMix); class_("SkeletonBounds") + .constructor<>() .function("update", &SkeletonBounds::update) .function("aabbContainsPoint", &SkeletonBounds::aabbcontainsPoint) .function("aabbIntersectsSegment", &SkeletonBounds::aabbintersectsSegment) From 964b50ed010c71786e4bb8cfdc38fbeebc4fe482 Mon Sep 17 00:00:00 2001 From: bofeng Date: Wed, 17 Jul 2024 11:06:58 +0800 Subject: [PATCH 2/7] refine --- native/external-config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/native/external-config.json b/native/external-config.json index c2416bbfd75..45b7100d021 100644 --- a/native/external-config.json +++ b/native/external-config.json @@ -3,6 +3,6 @@ "type": "github", "owner": "cocos-creator", "name": "engine-native-external", - "checkout": "v3.8.4-1" + "checkout": "v3.8.4-2" } } \ No newline at end of file From 08d870fc28d964d8903370fd88b56466ae203963 Mon Sep 17 00:00:00 2001 From: bofeng Date: Wed, 17 Jul 2024 14:05:22 +0800 Subject: [PATCH 3/7] refine --- cocos/spine/lib/spine-core.d.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cocos/spine/lib/spine-core.d.ts b/cocos/spine/lib/spine-core.d.ts index 5989e9ec767..6de05f3cf5a 100644 --- a/cocos/spine/lib/spine-core.d.ts +++ b/cocos/spine/lib/spine-core.d.ts @@ -27,7 +27,7 @@ declare namespace spine { class String { constructor(name: string, own: boolean); - constructor(val: String); + constructor(val: spine.String); length: number; isEmpty: boolean; strPtr: number; @@ -774,6 +774,7 @@ declare namespace spine { static filterFromString(text: string): TextureFilter; static wrapFromString(text: string): TextureWrap; } + /* eslint-disable @typescript-eslint/no-duplicate-enum-values */ enum TextureFilter { Nearest = 9728, Linear = 9729, @@ -783,6 +784,7 @@ declare namespace spine { MipMapNearestLinear = 9986, MipMapLinearLinear = 9987 } + /* eslint-enable @typescript-eslint/no-duplicate-enum-values */ enum TextureWrap { MirroredRepeat = 33648, ClampToEdge = 33071, From 36bf3bc9b6616b7c91eefb35210605431793b20e Mon Sep 17 00:00:00 2001 From: bofeng Date: Wed, 17 Jul 2024 14:08:47 +0800 Subject: [PATCH 4/7] refine --- native/cocos/editor-support/spine-wasm/spine-type-export.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/native/cocos/editor-support/spine-wasm/spine-type-export.cpp b/native/cocos/editor-support/spine-wasm/spine-type-export.cpp index 894d310d320..c8d8be95860 100644 --- a/native/cocos/editor-support/spine-wasm/spine-type-export.cpp +++ b/native/cocos/editor-support/spine-wasm/spine-type-export.cpp @@ -61,8 +61,7 @@ void VECTOR_STD_COPY_SP(std::vector &stdVector, Vector &spVector) { } String* constructorSpineString(emscripten::val name, bool own) { - std::string tmp = name.as(); - return new String(tmp.c_str(), own); + return new String(name.as().c_str(), own); } using SPVectorFloat = Vector; From f9d97af47e05a337d72e8b96eed460b041bde52c Mon Sep 17 00:00:00 2001 From: bofeng Date: Wed, 17 Jul 2024 14:24:53 +0800 Subject: [PATCH 5/7] refine --- native/external-config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/native/external-config.json b/native/external-config.json index 45b7100d021..c2416bbfd75 100644 --- a/native/external-config.json +++ b/native/external-config.json @@ -3,6 +3,6 @@ "type": "github", "owner": "cocos-creator", "name": "engine-native-external", - "checkout": "v3.8.4-2" + "checkout": "v3.8.4-1" } } \ No newline at end of file From 156ea166408adbc3ace34c8171e02892eb9a9384 Mon Sep 17 00:00:00 2001 From: bofeng Date: Wed, 17 Jul 2024 14:35:13 +0800 Subject: [PATCH 6/7] refine --- cocos/spine/lib/spine-core.d.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/cocos/spine/lib/spine-core.d.ts b/cocos/spine/lib/spine-core.d.ts index 6de05f3cf5a..0abe29e8027 100644 --- a/cocos/spine/lib/spine-core.d.ts +++ b/cocos/spine/lib/spine-core.d.ts @@ -774,7 +774,6 @@ declare namespace spine { static filterFromString(text: string): TextureFilter; static wrapFromString(text: string): TextureWrap; } - /* eslint-disable @typescript-eslint/no-duplicate-enum-values */ enum TextureFilter { Nearest = 9728, Linear = 9729, @@ -784,7 +783,6 @@ declare namespace spine { MipMapNearestLinear = 9986, MipMapLinearLinear = 9987 } - /* eslint-enable @typescript-eslint/no-duplicate-enum-values */ enum TextureWrap { MirroredRepeat = 33648, ClampToEdge = 33071, From b92e5d893661e4a8c6383f42d63a0625b54cc0fc Mon Sep 17 00:00:00 2001 From: bofeng Date: Wed, 17 Jul 2024 15:33:18 +0800 Subject: [PATCH 7/7] refine --- native/external-config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/native/external-config.json b/native/external-config.json index c2416bbfd75..45b7100d021 100644 --- a/native/external-config.json +++ b/native/external-config.json @@ -3,6 +3,6 @@ "type": "github", "owner": "cocos-creator", "name": "engine-native-external", - "checkout": "v3.8.4-1" + "checkout": "v3.8.4-2" } } \ No newline at end of file