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

fix spine-type-export.cpp 3.8.0->3.8.1 missing code issue. #15876

Merged
merged 1 commit into from
Aug 7, 2023
Merged
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
229 changes: 117 additions & 112 deletions native/cocos/editor-support/spine-wasm/spine-type-export.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -942,9 +942,11 @@ EMSCRIPTEN_BINDINGS(spine) {
.constructor<SkeletonData *>()
.function("getDefaultMix", &AnimationStateData::getDefaultMix)
.function("getSkeletonData", &AnimationStateData::getSkeletonData, allow_raw_pointers())
.function("setMix", optional_override([](AnimationStateData &obj, std::string fromName, std::string toName, float duration) {
.function("setMixWith", optional_override([](AnimationStateData &obj, Animation *from, Animation *to, float duration) { return obj.setMix(from, to, duration); }), allow_raw_pointers())
.function("getMix", &AnimationStateData::getMix, allow_raw_pointers());
.function("setMix", optional_override([](AnimationStateData &obj, const std::string& fromName, const std::string& toName, float duration) {
return obj.setMix(STRING_STD2SP(fromName), STRING_STD2SP(toName), duration);}))
.function("setMixWith", optional_override([](AnimationStateData &obj, Animation* from, Animation* to, float duration) {
return obj.setMix(from, to, duration);}), allow_raw_pointers())
.function("getMix", &AnimationStateData::getMix, allow_raw_pointers());

// .function("setMixWith", &Skeleton::setMixWith_Export)
//.function("getMix", &Skeleton::setMix_Export);
Expand Down Expand Up @@ -1071,116 +1073,119 @@ EMSCRIPTEN_BINDINGS(spine) {
.function("setSkinByName", optional_override([](Skeleton &obj, const std::string& name) {
return obj.setSkin(STRING_STD2SP(name));}))
.function("setSkin", static_cast<void (Skeleton::*)(Skin *)>(&Skeleton::setSkin), allow_raw_pointer<Skin>())
.function("getAttachmentByName", optional_override([](Skeleton &obj, std::string slotName, std::string attachmentName) {
.function("getAttachment", optional_override([](Skeleton &obj, int slotIndex, std::string attachmentName) {
.function("setAttachment", optional_override([](Skeleton &obj, std::string slotName, std::string attachmentName) {
.function("findIkConstraint", optional_override([](Skeleton &obj, const std::string &name) { return obj.findIkConstraint(STRING_STD2SP(name)); }), allow_raw_pointers())
.function("findTransformConstraint", optional_override([](Skeleton &obj, const std::string &name) { return obj.findTransformConstraint(STRING_STD2SP(name)); }), allow_raw_pointers())
.function("findPathConstraint", optional_override([](Skeleton &obj, const std::string &name) { return obj.findPathConstraint(STRING_STD2SP(name)); }), allow_raw_pointers())
//.function("getBounds", &Skeleton::getBounds)
.function("update", &Skeleton::update);

// incomplete
// class_<SkeletonBinary>("SkeletonBinary")
// .constructor<AttachmentLoader*>()
// .function("setProp_scale", &SkeletonBinary::setScale);
//.function("getProp_scale", &SkeletonBinary::getScale)
//.function("readSkeletonData", &SkeletonBinary::readSkeletonData)
//.function("setCurve", &SkeletonBinary::setCurve);
// incomplete

// class_<SkeletonJson>("SkeletonJson")
// .constructor<Atlas*>()
// .constructor<AttachmentLoader*>();
//.function("readSkeletonData", &SkeletonJson::readSkeletonData)
//.function("getProp_scale", &SkeletonJson::getScale)

class_<VertexEffect>("VertexEffect")
.function("begin", &VertexEffect::begin, pure_virtual())
//.function("transform", &VertexEffect::transform, pure_virtual())
.function("end", &VertexEffect::end, pure_virtual());

class_<JitterVertexEffect, base<VertexEffect>>("JitterEffect")
.constructor<float, float>()
.function("getJitterX", &JitterVertexEffect::getJitterX)
.function("setJitterX", &JitterVertexEffect::setJitterX)
.function("getJitterY", &JitterVertexEffect::getJitterY)
.function("setJitterY", &JitterVertexEffect::setJitterY)
.function("begin", &JitterVertexEffect::begin)
//.function("transform", &JitterVertexEffect::transform)
.function("end", &JitterVertexEffect::end);

class_<SwirlVertexEffect, base<VertexEffect>>("SwirlEffect")
.constructor<float, Interpolation &>()
.function("getCenterX", &SwirlVertexEffect::getCenterX)
.function("setCenterX", &SwirlVertexEffect::setCenterX)
.function("getCenterY", &SwirlVertexEffect::getCenterY)
.function("setCenterY", &SwirlVertexEffect::setCenterY)
.function("getRadius", &SwirlVertexEffect::getRadius)
.function("setRadius", &SwirlVertexEffect::setRadius)
.function("getAngle", &SwirlVertexEffect::getAngle)
.function("setAngle", &SwirlVertexEffect::setAngle)
.function("begin", &SwirlVertexEffect::begin)
//.function("transform", &SwirlVertexEffect::transform)
.function("end", &SwirlVertexEffect::end);

class_<SlotMesh>("SlotMesh")
.property("vCount", &SlotMesh::vCount)
.property("iCount", &SlotMesh::iCount)
.property("blendMode", &SlotMesh::blendMode)
.property("textureID", &SlotMesh::textureID);

register_vector<SlotMesh>("VectorSlotMesh");
class_<SpineModel>("SpineModel")
.property("vCount", &SpineModel::vCount)
.property("iCount", &SpineModel::iCount)
.property("vPtr", &SpineModel::vPtr)
.property("iPtr", &SpineModel::iPtr)
.function("getMeshes", &SpineModel::getMeshes);

class_<SpineDebugShape>("SpineDebugShape")
.property("type", &SpineDebugShape::type)
.property("vOffset", &SpineDebugShape::vOffset)
.property("vCount", &SpineDebugShape::vCount)
.property("iOffset", &SpineDebugShape::iOffset)
.property("iCount", &SpineDebugShape::iCount);

register_vector<SpineDebugShape>("VectorDebugShape");
class_<SpineSkeletonInstance>("SkeletonInstance")
.constructor<>()
.function("initSkeleton", &SpineSkeletonInstance::initSkeleton, allow_raw_pointers())
.function("setAnimation", &SpineSkeletonInstance::setAnimation, allow_raw_pointers())
.function("setSkin", &SpineSkeletonInstance::setSkin)
.function("updateAnimation", &SpineSkeletonInstance::updateAnimation)
.function("updateRenderData", &SpineSkeletonInstance::updateRenderData, allow_raw_pointer<SpineModel>())
.function("setPremultipliedAlpha", &SpineSkeletonInstance::setPremultipliedAlpha)
.function("setUseTint", &SpineSkeletonInstance::setUseTint)
.function("setColor", &SpineSkeletonInstance::setColor)
.function("setJitterEffect", &SpineSkeletonInstance::setJitterEffect, allow_raw_pointer<JitterVertexEffect *>())
.function("setSwirlEffect", &SpineSkeletonInstance::setSwirlEffect, allow_raw_pointer<SwirlVertexEffect *>())
.function("clearEffect", &SpineSkeletonInstance::clearEffect)
.function("getAnimationState", &SpineSkeletonInstance::getAnimationState, allow_raw_pointer<AnimationState>())
.function("setMix", &SpineSkeletonInstance::setMix)
.function("setListener", &SpineSkeletonInstance::setListener)
.function("setDebugMode", &SpineSkeletonInstance::setDebugMode)
.function("getDebugShapes", &SpineSkeletonInstance::getDebugShapes)
.function("resizeSlotRegion", &SpineSkeletonInstance::resizeSlotRegion)
.function("setSlotTexture", &SpineSkeletonInstance::setSlotTexture);
.function("getAttachmentByName", optional_override([](Skeleton &obj, const std::string& slotName, const std::string& attachmentName) {
return obj.getAttachment(STRING_STD2SP(slotName), STRING_STD2SP(attachmentName));}), allow_raw_pointers())
.function("getAttachment", optional_override([](Skeleton &obj, int slotIndex, const std::string& attachmentName) {
return obj.getAttachment(slotIndex, STRING_STD2SP(attachmentName));}),allow_raw_pointers())
.function("setAttachment", optional_override([](Skeleton &obj, const std::string& slotName, const std::string& attachmentName) {
return obj.setAttachment(STRING_STD2SP(slotName), STRING_STD2SP(attachmentName));}))
.function("findIkConstraint", optional_override([](Skeleton &obj, const std::string &name) { return obj.findIkConstraint(STRING_STD2SP(name)); }), allow_raw_pointers())
.function("findTransformConstraint", optional_override([](Skeleton &obj, const std::string &name) { return obj.findTransformConstraint(STRING_STD2SP(name)); }), allow_raw_pointers())
.function("findPathConstraint", optional_override([](Skeleton &obj, const std::string &name) { return obj.findPathConstraint(STRING_STD2SP(name)); }), allow_raw_pointers())
//.function("getBounds", &Skeleton::getBounds)
.function("update", &Skeleton::update);

// incomplete
// class_<SkeletonBinary>("SkeletonBinary")
// .constructor<AttachmentLoader*>()
// .function("setProp_scale", &SkeletonBinary::setScale);
//.function("getProp_scale", &SkeletonBinary::getScale)
//.function("readSkeletonData", &SkeletonBinary::readSkeletonData)
//.function("setCurve", &SkeletonBinary::setCurve);
// incomplete

// class_<SkeletonJson>("SkeletonJson")
// .constructor<Atlas*>()
// .constructor<AttachmentLoader*>();
//.function("readSkeletonData", &SkeletonJson::readSkeletonData)
//.function("getProp_scale", &SkeletonJson::getScale)

class_<VertexEffect>("VertexEffect")
.function("begin", &VertexEffect::begin, pure_virtual())
//.function("transform", &VertexEffect::transform, pure_virtual())
.function("end", &VertexEffect::end, pure_virtual());

class_<JitterVertexEffect, base<VertexEffect>>("JitterEffect")
.constructor<float, float>()
.function("getJitterX", &JitterVertexEffect::getJitterX)
.function("setJitterX", &JitterVertexEffect::setJitterX)
.function("getJitterY", &JitterVertexEffect::getJitterY)
.function("setJitterY", &JitterVertexEffect::setJitterY)
.function("begin", &JitterVertexEffect::begin)
//.function("transform", &JitterVertexEffect::transform)
.function("end", &JitterVertexEffect::end);

class_<SwirlVertexEffect, base<VertexEffect>>("SwirlEffect")
.constructor<float, Interpolation &>()
.function("getCenterX", &SwirlVertexEffect::getCenterX)
.function("setCenterX", &SwirlVertexEffect::setCenterX)
.function("getCenterY", &SwirlVertexEffect::getCenterY)
.function("setCenterY", &SwirlVertexEffect::setCenterY)
.function("getRadius", &SwirlVertexEffect::getRadius)
.function("setRadius", &SwirlVertexEffect::setRadius)
.function("getAngle", &SwirlVertexEffect::getAngle)
.function("setAngle", &SwirlVertexEffect::setAngle)
.function("begin", &SwirlVertexEffect::begin)
//.function("transform", &SwirlVertexEffect::transform)
.function("end", &SwirlVertexEffect::end);

class_<SlotMesh>("SlotMesh")
.property("vCount", &SlotMesh::vCount)
.property("iCount", &SlotMesh::iCount)
.property("blendMode", &SlotMesh::blendMode)
.property("textureID", &SlotMesh::textureID);

register_vector<SlotMesh>("VectorSlotMesh");
class_<SpineModel>("SpineModel")
.property("vCount", &SpineModel::vCount)
.property("iCount", &SpineModel::iCount)
.property("vPtr", &SpineModel::vPtr)
.property("iPtr", &SpineModel::iPtr)
.function("getMeshes", &SpineModel::getMeshes);

class_<SpineDebugShape>("SpineDebugShape")
.property("type", &SpineDebugShape::type)
.property("vOffset", &SpineDebugShape::vOffset)
.property("vCount", &SpineDebugShape::vCount)
.property("iOffset", &SpineDebugShape::iOffset)
.property("iCount", &SpineDebugShape::iCount);

register_vector<SpineDebugShape>("VectorDebugShape");
class_<SpineSkeletonInstance>("SkeletonInstance")
.constructor<>()
.function("initSkeleton", &SpineSkeletonInstance::initSkeleton, allow_raw_pointers())
.function("setAnimation", &SpineSkeletonInstance::setAnimation, allow_raw_pointers())
.function("setSkin", &SpineSkeletonInstance::setSkin)
.function("updateAnimation", &SpineSkeletonInstance::updateAnimation)
.function("updateRenderData", &SpineSkeletonInstance::updateRenderData, allow_raw_pointer<SpineModel>())
.function("setPremultipliedAlpha", &SpineSkeletonInstance::setPremultipliedAlpha)
.function("setUseTint", &SpineSkeletonInstance::setUseTint)
.function("setColor", &SpineSkeletonInstance::setColor)
.function("setJitterEffect", &SpineSkeletonInstance::setJitterEffect, allow_raw_pointer<JitterVertexEffect *>())
.function("setSwirlEffect", &SpineSkeletonInstance::setSwirlEffect, allow_raw_pointer<SwirlVertexEffect *>())
.function("clearEffect", &SpineSkeletonInstance::clearEffect)
.function("getAnimationState", &SpineSkeletonInstance::getAnimationState, allow_raw_pointer<AnimationState>())
.function("setMix", &SpineSkeletonInstance::setMix)
.function("setListener", &SpineSkeletonInstance::setListener)
.function("setDebugMode", &SpineSkeletonInstance::setDebugMode)
.function("getDebugShapes", &SpineSkeletonInstance::getDebugShapes)
.function("resizeSlotRegion", &SpineSkeletonInstance::resizeSlotRegion)
.function("setSlotTexture", &SpineSkeletonInstance::setSlotTexture);
}

EMSCRIPTEN_BINDINGS(cocos_spine) {
class_<SpineWasmUtil>("SpineWasmUtil")
.class_function("spineWasmInit", &SpineWasmUtil::spineWasmInit)
.class_function("spineWasmDestroy", &SpineWasmUtil::spineWasmDestroy)
.class_function("queryStoreMemory", &SpineWasmUtil::queryStoreMemory)
.class_function("querySpineSkeletonDataByUUID", &SpineWasmUtil::querySpineSkeletonDataByUUID, allow_raw_pointers())
.class_function("createSpineSkeletonDataWithJson", &SpineWasmUtil::createSpineSkeletonDataWithJson, allow_raw_pointers())
.class_function("createSpineSkeletonDataWithBinary", &SpineWasmUtil::createSpineSkeletonDataWithBinary, allow_raw_pointers())
.class_function("registerSpineSkeletonDataWithUUID", &SpineWasmUtil::registerSpineSkeletonDataWithUUID, allow_raw_pointers())
.class_function("destroySpineSkeletonDataWithUUID", &SpineWasmUtil::destroySpineSkeletonDataWithUUID)
.class_function("destroySpineInstance", &SpineWasmUtil::destroySpineInstance, allow_raw_pointers())
.class_function("getCurrentListenerID", &SpineWasmUtil::getCurrentListenerID)
.class_function("getCurrentEventType", &SpineWasmUtil::getCurrentEventType)
.class_function("getCurrentTrackEntry", &SpineWasmUtil::getCurrentTrackEntry, allow_raw_pointers())
.class_function("getCurrentEvent", &SpineWasmUtil::getCurrentEvent, allow_raw_pointers());
class_<SpineWasmUtil>("SpineWasmUtil")
.class_function("spineWasmInit", &SpineWasmUtil::spineWasmInit)
.class_function("spineWasmDestroy", &SpineWasmUtil::spineWasmDestroy)
.class_function("queryStoreMemory", &SpineWasmUtil::queryStoreMemory)
.class_function("querySpineSkeletonDataByUUID", &SpineWasmUtil::querySpineSkeletonDataByUUID, allow_raw_pointers())
.class_function("createSpineSkeletonDataWithJson", &SpineWasmUtil::createSpineSkeletonDataWithJson, allow_raw_pointers())
.class_function("createSpineSkeletonDataWithBinary", &SpineWasmUtil::createSpineSkeletonDataWithBinary, allow_raw_pointers())
.class_function("registerSpineSkeletonDataWithUUID", &SpineWasmUtil::registerSpineSkeletonDataWithUUID, allow_raw_pointers())
.class_function("destroySpineSkeletonDataWithUUID", &SpineWasmUtil::destroySpineSkeletonDataWithUUID)
.class_function("destroySpineInstance", &SpineWasmUtil::destroySpineInstance, allow_raw_pointers())
.class_function("getCurrentListenerID", &SpineWasmUtil::getCurrentListenerID)
.class_function("getCurrentEventType", &SpineWasmUtil::getCurrentEventType)
.class_function("getCurrentTrackEntry", &SpineWasmUtil::getCurrentTrackEntry, allow_raw_pointers())
.class_function("getCurrentEvent", &SpineWasmUtil::getCurrentEvent, allow_raw_pointers());
}
Loading