From e4d7a9b4b560d114d8a078ca977682cc9cec5eff Mon Sep 17 00:00:00 2001 From: bofeng Date: Fri, 9 Aug 2024 15:09:35 +0800 Subject: [PATCH 1/2] Fixing the SkeletonData export error. --- .../editor-support/spine-wasm/CMakeLists.txt | 2 +- .../spine-wasm/spine-type-export.cpp | 56 ++++++++----------- 2 files changed, 24 insertions(+), 34 deletions(-) diff --git a/native/cocos/editor-support/spine-wasm/CMakeLists.txt b/native/cocos/editor-support/spine-wasm/CMakeLists.txt index 079c34083d3..9e95bfb2575 100644 --- a/native/cocos/editor-support/spine-wasm/CMakeLists.txt +++ b/native/cocos/editor-support/spine-wasm/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.0) set(CMAKE_VERBOSE_MAKEFILE ON) -set(CMAKE_BUILD_TYPE "Release") +set(CMAKE_BUILD_TYPE "MinSizeRel") set(APP_NAME "spine" CACHE STRING "Project Name") project(${APP_NAME}_wasm) 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 c8d8be95860..40468f9886c 100644 --- a/native/cocos/editor-support/spine-wasm/spine-type-export.cpp +++ b/native/cocos/editor-support/spine-wasm/spine-type-export.cpp @@ -71,6 +71,9 @@ using SPVectorVectorInt = Vector>; using SPVectorSize_t = Vector; using SPVectorBonePtr = Vector; using SPVectorBoneDataPtr = Vector; +using SPVectorSlotDataPtr = Vector; +using SPVectorTransformConstraintDataPtr = Vector; +using SPVectorPathConstraintDataPtr = Vector; using SPVectorUnsignedShort = Vector; using SPVectorConstraintDataPtr = Vector; using SPVectorSlotPtr = Vector; @@ -185,50 +188,37 @@ EMSCRIPTEN_BINDINGS(spine) { obj[index] = value; }), allow_raw_pointer()); + class_("SPVectorSlotDataPtr") + .function("size", &SPVectorSlotDataPtr::size) + .function("get", &SPVectorSlotDataPtr::operator[], allow_raw_pointers()); + + class_("SPVectorTransformConstraintDataPtr") + .function("size", &SPVectorTransformConstraintDataPtr::size) + .function("get", &SPVectorTransformConstraintDataPtr::operator[], allow_raw_pointers()); + + class_("SPVectorPathConstraintDataPtr") + .function("size", &SPVectorPathConstraintDataPtr::size) + .function("get", &SPVectorPathConstraintDataPtr::operator[], allow_raw_pointers()); + class_("SPVectorConstraintDataPtr") - .constructor<>() - .function("resize", &SPVectorConstraintDataPtr::setSize) .function("size", &SPVectorConstraintDataPtr::size) - .function("get", &SPVectorConstraintDataPtr::operator[], allow_raw_pointers()) - .function("set",optional_override([](SPVectorConstraintDataPtr &obj, int index, ConstraintData *value) { - obj[index] = value; - }), allow_raw_pointer()); + .function("get", &SPVectorConstraintDataPtr::operator[], allow_raw_pointers()); class_("SPVectorSlotPtr") - .constructor<>() - .function("resize", &SPVectorSlotPtr::setSize) .function("size", &SPVectorSlotPtr::size) - .function("get", &SPVectorSlotPtr::operator[], allow_raw_pointers()) - .function("set",optional_override([](SPVectorSlotPtr &obj, int index, Slot *value) { - obj[index] = value; - }), allow_raw_pointer()); + .function("get", &SPVectorSlotPtr::operator[], allow_raw_pointers()); class_("SPVectorSkinPtr") - .constructor<>() - .function("resize", &SPVectorSkinPtr::setSize) .function("size", &SPVectorSkinPtr::size) - .function("get", &SPVectorSkinPtr::operator[], allow_raw_pointers()) - .function("set",optional_override([](SPVectorSkinPtr &obj, int index, Skin *value) { - obj[index] = value; - }), allow_raw_pointer()); + .function("get", &SPVectorSkinPtr::operator[], allow_raw_pointers()); class_("SPVectorEventDataPtr") - .constructor<>() - .function("resize", &SPVectorEventDataPtr::setSize) .function("size", &SPVectorEventDataPtr::size) - .function("get", &SPVectorEventDataPtr::operator[], allow_raw_pointers()) - .function("set",optional_override([](SPVectorEventDataPtr &obj, int index, EventData *value) { - obj[index] = value; - }), allow_raw_pointer()); + .function("get", &SPVectorEventDataPtr::operator[], allow_raw_pointers()); class_("SPVectorAnimationPtr") - .constructor<>() - .function("resize", &SPVectorAnimationPtr::setSize) .function("size", &SPVectorAnimationPtr::size) - .function("get", &SPVectorAnimationPtr::operator[], allow_raw_pointers()) - .function("set",optional_override([](SPVectorAnimationPtr &obj, int index, Animation *value) { - obj[index] = value; - }), allow_raw_pointer()); + .function("get", &SPVectorAnimationPtr::operator[], allow_raw_pointers()); class_("SPVectorIkConstraintPtr") .constructor<>() @@ -1046,7 +1036,7 @@ EMSCRIPTEN_BINDINGS(spine) { .function("getBones", optional_override([](SkeletonData &obj) { return &obj.getBones(); }), allow_raw_pointer()) .function("getSlots", optional_override([](SkeletonData &obj) { - return &obj.getSlots(); }), allow_raw_pointer()) + return &obj.getSlots(); }), allow_raw_pointer()) .function("getSkins", optional_override([](SkeletonData &obj) { return &obj.getSkins(); }), allow_raw_pointer()) .function("getDefaultSkin", &SkeletonData::getDefaultSkin, allow_raw_pointers()) @@ -1058,9 +1048,9 @@ EMSCRIPTEN_BINDINGS(spine) { .function("getIkConstraints", optional_override([](SkeletonData &obj) { return &obj.getIkConstraints(); }), allow_raw_pointer()) .function("getTransformConstraints", optional_override([](SkeletonData &obj) { - return &obj.getTransformConstraints(); }), allow_raw_pointer()) + return &obj.getTransformConstraints(); }), allow_raw_pointer()) .function("getPathConstraints", optional_override([](SkeletonData &obj) { - return &obj.getPathConstraints(); }), allow_raw_pointer()) + return &obj.getPathConstraints(); }), allow_raw_pointer()) .function("getX", &SkeletonData::getX) .function("setX", &SkeletonData::setX) .function("getY", &SkeletonData::getY) From 5c3b1d386b8dd94814901815c59fd9af3186f158 Mon Sep 17 00:00:00 2001 From: bofeng Date: Mon, 12 Aug 2024 09:50:03 +0800 Subject: [PATCH 2/2] update external version --- 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 347536720ef..e161837f64c 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-4" + "checkout": "v3.8.4-5" } } \ No newline at end of file