Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing the SkeletonData export error. #17520

Merged
merged 2 commits into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion native/cocos/editor-support/spine-wasm/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
56 changes: 23 additions & 33 deletions native/cocos/editor-support/spine-wasm/spine-type-export.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ using SPVectorVectorInt = Vector<Vector<int>>;
using SPVectorSize_t = Vector<size_t>;
using SPVectorBonePtr = Vector<Bone*>;
using SPVectorBoneDataPtr = Vector<BoneData*>;
using SPVectorSlotDataPtr = Vector<SlotData*>;
using SPVectorTransformConstraintDataPtr = Vector<TransformConstraintData*>;
using SPVectorPathConstraintDataPtr = Vector<PathConstraintData*>;
using SPVectorUnsignedShort = Vector<unsigned short>;
using SPVectorConstraintDataPtr = Vector<ConstraintData*>;
using SPVectorSlotPtr = Vector<Slot*>;
Expand Down Expand Up @@ -185,50 +188,37 @@ EMSCRIPTEN_BINDINGS(spine) {
obj[index] = value;
}), allow_raw_pointer<BoneData*>());

class_<SPVectorSlotDataPtr>("SPVectorSlotDataPtr")
.function("size", &SPVectorSlotDataPtr::size)
.function("get", &SPVectorSlotDataPtr::operator[], allow_raw_pointers());

class_<SPVectorTransformConstraintDataPtr>("SPVectorTransformConstraintDataPtr")
.function("size", &SPVectorTransformConstraintDataPtr::size)
.function("get", &SPVectorTransformConstraintDataPtr::operator[], allow_raw_pointers());

class_<SPVectorPathConstraintDataPtr>("SPVectorPathConstraintDataPtr")
.function("size", &SPVectorPathConstraintDataPtr::size)
.function("get", &SPVectorPathConstraintDataPtr::operator[], allow_raw_pointers());

class_<SPVectorConstraintDataPtr>("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<ConstraintData*>());
.function("get", &SPVectorConstraintDataPtr::operator[], allow_raw_pointers());

class_<SPVectorSlotPtr>("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<Slot*>());
.function("get", &SPVectorSlotPtr::operator[], allow_raw_pointers());

class_<SPVectorSkinPtr>("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<Skin*>());
.function("get", &SPVectorSkinPtr::operator[], allow_raw_pointers());

class_<SPVectorEventDataPtr>("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<EventData*>());
.function("get", &SPVectorEventDataPtr::operator[], allow_raw_pointers());

class_<SPVectorAnimationPtr>("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<Animation*>());
.function("get", &SPVectorAnimationPtr::operator[], allow_raw_pointers());

class_<SPVectorIkConstraintPtr>("SPVectorIkConstraintPtr")
.constructor<>()
Expand Down Expand Up @@ -1046,7 +1036,7 @@ EMSCRIPTEN_BINDINGS(spine) {
.function("getBones", optional_override([](SkeletonData &obj) {
return &obj.getBones(); }), allow_raw_pointer<SPVectorBoneDataPtr>())
.function("getSlots", optional_override([](SkeletonData &obj) {
return &obj.getSlots(); }), allow_raw_pointer<SPVectorSlotPtr>())
return &obj.getSlots(); }), allow_raw_pointer<SPVectorSlotDataPtr>())
.function("getSkins", optional_override([](SkeletonData &obj) {
return &obj.getSkins(); }), allow_raw_pointer<SPVectorSkinPtr>())
.function("getDefaultSkin", &SkeletonData::getDefaultSkin, allow_raw_pointers())
Expand All @@ -1058,9 +1048,9 @@ EMSCRIPTEN_BINDINGS(spine) {
.function("getIkConstraints", optional_override([](SkeletonData &obj) {
return &obj.getIkConstraints(); }), allow_raw_pointer<SPVectorIkConstraintDataPtr>())
.function("getTransformConstraints", optional_override([](SkeletonData &obj) {
return &obj.getTransformConstraints(); }), allow_raw_pointer<SPVectorTransformConstraintPtr>())
return &obj.getTransformConstraints(); }), allow_raw_pointer<SPVectorTransformConstraintDataPtr>())
.function("getPathConstraints", optional_override([](SkeletonData &obj) {
return &obj.getPathConstraints(); }), allow_raw_pointer<SPVectorPathConstraintPtr>())
return &obj.getPathConstraints(); }), allow_raw_pointer<SPVectorPathConstraintDataPtr>())
.function("getX", &SkeletonData::getX)
.function("setX", &SkeletonData::setX)
.function("getY", &SkeletonData::getY)
Expand Down
2 changes: 1 addition & 1 deletion native/external-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"type": "github",
"owner": "cocos-creator",
"name": "engine-native-external",
"checkout": "v3.8.4-4"
"checkout": "v3.8.4-5"
}
}
Loading