From 4d40ad2ed7dfae647f9dbfa48e99dd571f529745 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=89=93=E5=8C=85=E6=9C=BA?= Date: Tue, 5 Jul 2022 15:05:12 +0800 Subject: [PATCH] =?UTF-8?q?[cocos2d-x]=20=E4=BF=AE=E5=A4=8D=20include=20?= =?UTF-8?q?=E7=AD=89=E5=9C=A8=E7=BC=96=E8=AF=91=E6=A8=A1=E6=8B=9F=E5=99=A8?= =?UTF-8?q?=E6=97=B6=E5=8F=91=E7=8E=B0=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cocos2d-x/cocos/editor-support/spine/Skin.h | 2 ++ .../js-bindings/manual/jsb_conversions.hpp | 26 ------------------- .../js-bindings/manual/jsb_spine_manual.cpp | 26 +++++++++++++++++++ 3 files changed, 28 insertions(+), 26 deletions(-) diff --git a/cocos2d-x/cocos/editor-support/spine/Skin.h b/cocos2d-x/cocos/editor-support/spine/Skin.h index b7e0c865..9b8606ad 100644 --- a/cocos2d-x/cocos/editor-support/spine/Skin.h +++ b/cocos2d-x/cocos/editor-support/spine/Skin.h @@ -32,6 +32,8 @@ #include #include +#include +#include namespace spine { class Attachment; diff --git a/cocos2d-x/cocos/scripting/js-bindings/manual/jsb_conversions.hpp b/cocos2d-x/cocos/scripting/js-bindings/manual/jsb_conversions.hpp index 85e7c98a..5b6dd5d1 100644 --- a/cocos2d-x/cocos/scripting/js-bindings/manual/jsb_conversions.hpp +++ b/cocos2d-x/cocos/scripting/js-bindings/manual/jsb_conversions.hpp @@ -672,32 +672,6 @@ bool seval_to_spine_Vector_T_ptr(const se::Value& v, spine::Vector* ret) return true; } -bool spine_skin_attachments_to_seval(std::vector>& v, se::Value* ret) { - assert(ret != nullptr); - bool ok = true; - se::HandleObject arr(se::Object::createArrayObject(v.size())); - - int i = 0; - - for (const auto &vv : v) - { - se::HandleObject obj(se::Object::createPlainObject()); - - se::Value tmp; - for (const auto& e : vv) { - native_ptr_to_rooted_seval(e.second, &tmp); - obj->setProperty(e.first.c_str(), tmp); - } - - arr->setArrayElement(i, se::Value(obj)); - i++; - } - - ret->setObject(arr, true); - - return ok; -} - bool seval_to_spine_Vector_String(const se::Value& v, spine::Vector* ret); bool spine_Vector_String_to_seval(const spine::Vector& v, se::Value* ret); #endif diff --git a/cocos2d-x/cocos/scripting/js-bindings/manual/jsb_spine_manual.cpp b/cocos2d-x/cocos/scripting/js-bindings/manual/jsb_spine_manual.cpp index 1d780c62..dcac720c 100644 --- a/cocos2d-x/cocos/scripting/js-bindings/manual/jsb_spine_manual.cpp +++ b/cocos2d-x/cocos/scripting/js-bindings/manual/jsb_spine_manual.cpp @@ -235,6 +235,32 @@ static bool js_register_spine_retainSkeletonData(se::State& s) } SE_BIND_FUNC(js_register_spine_retainSkeletonData) +bool spine_skin_attachments_to_seval(std::vector>& v, se::Value* ret) { + assert(ret != nullptr); + bool ok = true; + se::HandleObject arr(se::Object::createArrayObject(v.size())); + + int i = 0; + + for (const auto &vv : v) + { + se::HandleObject obj(se::Object::createPlainObject()); + + se::Value tmp; + for (const auto& e : vv) { + native_ptr_to_rooted_seval(e.second, &tmp); + obj->setProperty(e.first.c_str(), tmp); + } + + arr->setArrayElement(i, se::Value(obj)); + i++; + } + + ret->setObject(arr, true); + + return ok; +} + static bool js_cocos2dx_spine_Skin_getAttachmentsForJSB(se::State& s) { spine::Skin* cobj = (spine::Skin*)s.nativeThisObject(); SE_PRECONDITION2(