[cocos2d-x] Spine 组件所有特性原生平台适配

This commit is contained in:
SmallMain
2022-07-05 11:05:41 +08:00
parent f4599764fe
commit 3b1584ee1c
25 changed files with 1801 additions and 312 deletions

View File

@@ -3938,14 +3938,14 @@ getRegionOriginalWidth : function (
* @param {float} arg1
* @param {float} arg2
* @param {float} arg3
* @param {bool} arg4
* @param {float} arg4
*/
setUVs : function (
float,
float,
float,
float,
bool
float
)
{
},

View File

@@ -5938,6 +5938,44 @@ static bool js_cocos2dx_spine_MeshAttachment_setRegionOffsetX(se::State& s)
}
SE_BIND_FUNC(js_cocos2dx_spine_MeshAttachment_setRegionOffsetX)
static bool js_cocos2dx_spine_MeshAttachment_setRegionY(se::State& s)
{
spine::MeshAttachment* cobj = (spine::MeshAttachment*)s.nativeThisObject();
SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_MeshAttachment_setRegionY : Invalid Native Object");
const auto& args = s.args();
size_t argc = args.size();
CC_UNUSED bool ok = true;
if (argc == 1) {
float arg0 = 0;
ok &= seval_to_float(args[0], &arg0);
SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_MeshAttachment_setRegionY : Error processing arguments");
cobj->setRegionY(arg0);
return true;
}
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1);
return false;
}
SE_BIND_FUNC(js_cocos2dx_spine_MeshAttachment_setRegionY)
static bool js_cocos2dx_spine_MeshAttachment_setRegionX(se::State& s)
{
spine::MeshAttachment* cobj = (spine::MeshAttachment*)s.nativeThisObject();
SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_MeshAttachment_setRegionX : Invalid Native Object");
const auto& args = s.args();
size_t argc = args.size();
CC_UNUSED bool ok = true;
if (argc == 1) {
float arg0 = 0;
ok &= seval_to_float(args[0], &arg0);
SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_MeshAttachment_setRegionX : Error processing arguments");
cobj->setRegionX(arg0);
return true;
}
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1);
return false;
}
SE_BIND_FUNC(js_cocos2dx_spine_MeshAttachment_setRegionX)
static bool js_cocos2dx_spine_MeshAttachment_copy(se::State& s)
{
spine::MeshAttachment* cobj = (spine::MeshAttachment*)s.nativeThisObject();
@@ -6579,6 +6617,42 @@ static bool js_cocos2dx_spine_MeshAttachment_getRegionOffsetX(se::State& s)
}
SE_BIND_FUNC(js_cocos2dx_spine_MeshAttachment_getRegionOffsetX)
static bool js_cocos2dx_spine_MeshAttachment_getRegionY(se::State& s)
{
spine::MeshAttachment* cobj = (spine::MeshAttachment*)s.nativeThisObject();
SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_MeshAttachment_getRegionY : Invalid Native Object");
const auto& args = s.args();
size_t argc = args.size();
CC_UNUSED bool ok = true;
if (argc == 0) {
float result = cobj->getRegionY();
ok &= float_to_seval(result, &s.rval());
SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_MeshAttachment_getRegionY : Error processing arguments");
return true;
}
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
return false;
}
SE_BIND_FUNC(js_cocos2dx_spine_MeshAttachment_getRegionY)
static bool js_cocos2dx_spine_MeshAttachment_getRegionX(se::State& s)
{
spine::MeshAttachment* cobj = (spine::MeshAttachment*)s.nativeThisObject();
SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_MeshAttachment_getRegionX : Invalid Native Object");
const auto& args = s.args();
size_t argc = args.size();
CC_UNUSED bool ok = true;
if (argc == 0) {
float result = cobj->getRegionX();
ok &= float_to_seval(result, &s.rval());
SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_MeshAttachment_getRegionX : Error processing arguments");
return true;
}
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
return false;
}
SE_BIND_FUNC(js_cocos2dx_spine_MeshAttachment_getRegionX)
static bool js_cocos2dx_spine_MeshAttachment_getRegionV(se::State& s)
{
spine::MeshAttachment* cobj = (spine::MeshAttachment*)s.nativeThisObject();
@@ -6662,6 +6736,8 @@ bool js_register_cocos2dx_spine_MeshAttachment(se::Object* obj)
cls->defineFunction("setRegionOriginalHeight", _SE(js_cocos2dx_spine_MeshAttachment_setRegionOriginalHeight));
cls->defineFunction("setRegionOffsetY", _SE(js_cocos2dx_spine_MeshAttachment_setRegionOffsetY));
cls->defineFunction("setRegionOffsetX", _SE(js_cocos2dx_spine_MeshAttachment_setRegionOffsetX));
cls->defineFunction("setRegionY", _SE(js_cocos2dx_spine_MeshAttachment_setRegionY));
cls->defineFunction("setRegionX", _SE(js_cocos2dx_spine_MeshAttachment_setRegionX));
cls->defineFunction("copy", _SE(js_cocos2dx_spine_MeshAttachment_copy));
cls->defineFunction("getRegionOriginalWidth", _SE(js_cocos2dx_spine_MeshAttachment_getRegionOriginalWidth));
cls->defineFunction("getWidth", _SE(js_cocos2dx_spine_MeshAttachment_getWidth));
@@ -6697,6 +6773,8 @@ bool js_register_cocos2dx_spine_MeshAttachment(se::Object* obj)
cls->defineFunction("getTriangles", _SE(js_cocos2dx_spine_MeshAttachment_getTriangles));
cls->defineFunction("getRegionOffsetY", _SE(js_cocos2dx_spine_MeshAttachment_getRegionOffsetY));
cls->defineFunction("getRegionOffsetX", _SE(js_cocos2dx_spine_MeshAttachment_getRegionOffsetX));
cls->defineFunction("getRegionY", _SE(js_cocos2dx_spine_MeshAttachment_getRegionY));
cls->defineFunction("getRegionX", _SE(js_cocos2dx_spine_MeshAttachment_getRegionX));
cls->defineFunction("getRegionV", _SE(js_cocos2dx_spine_MeshAttachment_getRegionV));
cls->defineFunction("getRegionRotate", _SE(js_cocos2dx_spine_MeshAttachment_getRegionRotate));
cls->defineFunction("getParentMesh", _SE(js_cocos2dx_spine_MeshAttachment_getParentMesh));
@@ -7905,6 +7983,43 @@ static bool js_cocos2dx_spine_RegionAttachment_setRegionOriginalHeight(se::State
}
SE_BIND_FUNC(js_cocos2dx_spine_RegionAttachment_setRegionOriginalHeight)
static bool js_cocos2dx_spine_RegionAttachment_setRegionDegrees(se::State& s)
{
spine::RegionAttachment* cobj = (spine::RegionAttachment*)s.nativeThisObject();
SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_RegionAttachment_setRegionDegrees : Invalid Native Object");
const auto& args = s.args();
size_t argc = args.size();
CC_UNUSED bool ok = true;
if (argc == 1) {
int arg0 = 0;
do { int32_t tmp = 0; ok &= seval_to_int32(args[0], &tmp); arg0 = (int)tmp; } while(false);
SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_RegionAttachment_setRegionDegrees : Error processing arguments");
cobj->setRegionDegrees(arg0);
return true;
}
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1);
return false;
}
SE_BIND_FUNC(js_cocos2dx_spine_RegionAttachment_setRegionDegrees)
static bool js_cocos2dx_spine_RegionAttachment_getRegionDegrees(se::State& s)
{
spine::RegionAttachment* cobj = (spine::RegionAttachment*)s.nativeThisObject();
SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_RegionAttachment_getRegionDegrees : Invalid Native Object");
const auto& args = s.args();
size_t argc = args.size();
CC_UNUSED bool ok = true;
if (argc == 0) {
int result = cobj->getRegionDegrees();
ok &= int32_to_seval(result, &s.rval());
SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_RegionAttachment_getRegionDegrees : Error processing arguments");
return true;
}
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
return false;
}
SE_BIND_FUNC(js_cocos2dx_spine_RegionAttachment_getRegionDegrees)
static bool js_cocos2dx_spine_RegionAttachment_setRegionOffsetY(se::State& s)
{
spine::RegionAttachment* cobj = (spine::RegionAttachment*)s.nativeThisObject();
@@ -7943,6 +8058,44 @@ static bool js_cocos2dx_spine_RegionAttachment_setRegionOffsetX(se::State& s)
}
SE_BIND_FUNC(js_cocos2dx_spine_RegionAttachment_setRegionOffsetX)
static bool js_cocos2dx_spine_RegionAttachment_setRegionY(se::State& s)
{
spine::RegionAttachment* cobj = (spine::RegionAttachment*)s.nativeThisObject();
SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_RegionAttachment_setRegionY : Invalid Native Object");
const auto& args = s.args();
size_t argc = args.size();
CC_UNUSED bool ok = true;
if (argc == 1) {
float arg0 = 0;
ok &= seval_to_float(args[0], &arg0);
SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_RegionAttachment_setRegionY : Error processing arguments");
cobj->setRegionY(arg0);
return true;
}
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1);
return false;
}
SE_BIND_FUNC(js_cocos2dx_spine_RegionAttachment_setRegionY)
static bool js_cocos2dx_spine_RegionAttachment_setRegionX(se::State& s)
{
spine::RegionAttachment* cobj = (spine::RegionAttachment*)s.nativeThisObject();
SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_RegionAttachment_setRegionX : Invalid Native Object");
const auto& args = s.args();
size_t argc = args.size();
CC_UNUSED bool ok = true;
if (argc == 1) {
float arg0 = 0;
ok &= seval_to_float(args[0], &arg0);
SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_RegionAttachment_setRegionX : Error processing arguments");
cobj->setRegionX(arg0);
return true;
}
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1);
return false;
}
SE_BIND_FUNC(js_cocos2dx_spine_RegionAttachment_setRegionX)
static bool js_cocos2dx_spine_RegionAttachment_getRegionOriginalWidth(se::State& s)
{
spine::RegionAttachment* cobj = (spine::RegionAttachment*)s.nativeThisObject();
@@ -7973,12 +8126,12 @@ static bool js_cocos2dx_spine_RegionAttachment_setUVs(se::State& s)
float arg1 = 0;
float arg2 = 0;
float arg3 = 0;
bool arg4;
float arg4 = 0;
ok &= seval_to_float(args[0], &arg0);
ok &= seval_to_float(args[1], &arg1);
ok &= seval_to_float(args[2], &arg2);
ok &= seval_to_float(args[3], &arg3);
ok &= seval_to_boolean(args[4], &arg4);
ok &= seval_to_float(args[4], &arg4);
SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_RegionAttachment_setUVs : Error processing arguments");
cobj->setUVs(arg0, arg1, arg2, arg3, arg4);
return true;
@@ -8518,6 +8671,41 @@ static bool js_cocos2dx_spine_RegionAttachment_getRegionOffsetX(se::State& s)
}
SE_BIND_FUNC(js_cocos2dx_spine_RegionAttachment_getRegionOffsetX)
static bool js_cocos2dx_spine_RegionAttachment_getRegionY(se::State& s)
{
spine::RegionAttachment* cobj = (spine::RegionAttachment*)s.nativeThisObject();
SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_RegionAttachment_getRegionY : Invalid Native Object");
const auto& args = s.args();
size_t argc = args.size();
CC_UNUSED bool ok = true;
if (argc == 0) {
float result = cobj->getRegionY();
ok &= float_to_seval(result, &s.rval());
SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_RegionAttachment_getRegionY : Error processing arguments");
return true;
}
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
return false;
}
SE_BIND_FUNC(js_cocos2dx_spine_RegionAttachment_getRegionY)
static bool js_cocos2dx_spine_RegionAttachment_getRegionX(se::State& s)
{
spine::RegionAttachment* cobj = (spine::RegionAttachment*)s.nativeThisObject();
SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_RegionAttachment_getRegionX : Invalid Native Object");
const auto& args = s.args();
size_t argc = args.size();
CC_UNUSED bool ok = true;
if (argc == 0) {
float result = cobj->getRegionX();
ok &= float_to_seval(result, &s.rval());
SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_RegionAttachment_getRegionX : Error processing arguments");
return true;
}
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
return false;
}
SE_BIND_FUNC(js_cocos2dx_spine_RegionAttachment_getRegionX)
extern se::Object* __jsb_spine_Attachment_proto;
@@ -8529,6 +8717,8 @@ bool js_register_cocos2dx_spine_RegionAttachment(se::Object* obj)
cls->defineFunction("setRegionOriginalHeight", _SE(js_cocos2dx_spine_RegionAttachment_setRegionOriginalHeight));
cls->defineFunction("setRegionOffsetY", _SE(js_cocos2dx_spine_RegionAttachment_setRegionOffsetY));
cls->defineFunction("setRegionOffsetX", _SE(js_cocos2dx_spine_RegionAttachment_setRegionOffsetX));
cls->defineFunction("setRegionY", _SE(js_cocos2dx_spine_RegionAttachment_setRegionY));
cls->defineFunction("setRegionX", _SE(js_cocos2dx_spine_RegionAttachment_setRegionX));
cls->defineFunction("getRegionOriginalWidth", _SE(js_cocos2dx_spine_RegionAttachment_getRegionOriginalWidth));
cls->defineFunction("setUVs", _SE(js_cocos2dx_spine_RegionAttachment_setUVs));
cls->defineFunction("getWidth", _SE(js_cocos2dx_spine_RegionAttachment_getWidth));
@@ -8560,6 +8750,10 @@ bool js_register_cocos2dx_spine_RegionAttachment(se::Object* obj)
cls->defineFunction("getRegionOriginalHeight", _SE(js_cocos2dx_spine_RegionAttachment_getRegionOriginalHeight));
cls->defineFunction("getRegionOffsetY", _SE(js_cocos2dx_spine_RegionAttachment_getRegionOffsetY));
cls->defineFunction("getRegionOffsetX", _SE(js_cocos2dx_spine_RegionAttachment_getRegionOffsetX));
cls->defineFunction("getRegionY", _SE(js_cocos2dx_spine_RegionAttachment_getRegionY));
cls->defineFunction("getRegionX", _SE(js_cocos2dx_spine_RegionAttachment_getRegionX));
cls->defineFunction("setRegionDegrees", _SE(js_cocos2dx_spine_RegionAttachment_setRegionDegrees));
cls->defineFunction("getRegionDegrees", _SE(js_cocos2dx_spine_RegionAttachment_getRegionDegrees));
cls->install();
JSBClassType::registerClass<spine::RegionAttachment>(cls);
@@ -12876,6 +13070,25 @@ static bool js_cocos2dx_spine_SkeletonRenderer_setUseTint(se::State& s)
}
SE_BIND_FUNC(js_cocos2dx_spine_SkeletonRenderer_setUseTint)
static bool js_cocos2dx_spine_SkeletonRenderer_setUseMulti(se::State& s)
{
spine::SkeletonRenderer* cobj = (spine::SkeletonRenderer*)s.nativeThisObject();
SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonRenderer_setUseMulti : Invalid Native Object");
const auto& args = s.args();
size_t argc = args.size();
CC_UNUSED bool ok = true;
if (argc == 1) {
bool arg0;
ok &= seval_to_boolean(args[0], &arg0);
SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonRenderer_setUseMulti : Error processing arguments");
cobj->setUseMulti(arg0);
return true;
}
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1);
return false;
}
SE_BIND_FUNC(js_cocos2dx_spine_SkeletonRenderer_setUseMulti)
static bool js_cocos2dx_spine_SkeletonRenderer_setTimeScale(se::State& s)
{
spine::SkeletonRenderer* cobj = (spine::SkeletonRenderer*)s.nativeThisObject();
@@ -13913,6 +14126,7 @@ bool js_register_cocos2dx_spine_SkeletonRenderer(se::Object* obj)
auto cls = se::Class::create("Skeleton", obj, nullptr, _SE(js_cocos2dx_spine_SkeletonRenderer_constructor));
cls->defineFunction("setUseTint", _SE(js_cocos2dx_spine_SkeletonRenderer_setUseTint));
cls->defineFunction("setUseMulti", _SE(js_cocos2dx_spine_SkeletonRenderer_setUseMulti));
cls->defineFunction("setTimeScale", _SE(js_cocos2dx_spine_SkeletonRenderer_setTimeScale));
cls->defineFunction("render", _SE(js_cocos2dx_spine_SkeletonRenderer_render));
cls->defineFunction("initWithUUID", _SE(js_cocos2dx_spine_SkeletonRenderer_initWithUUID));
@@ -15341,6 +15555,25 @@ static bool js_cocos2dx_spine_SkeletonCacheAnimation_setUseTint(se::State& s)
}
SE_BIND_FUNC(js_cocos2dx_spine_SkeletonCacheAnimation_setUseTint)
static bool js_cocos2dx_spine_SkeletonCacheAnimation_setUseMulti(se::State& s)
{
spine::SkeletonCacheAnimation* cobj = (spine::SkeletonCacheAnimation*)s.nativeThisObject();
SE_PRECONDITION2(cobj, false, "js_cocos2dx_spine_SkeletonCacheAnimation_setUseMulti : Invalid Native Object");
const auto& args = s.args();
size_t argc = args.size();
CC_UNUSED bool ok = true;
if (argc == 1) {
bool arg0;
ok &= seval_to_boolean(args[0], &arg0);
SE_PRECONDITION2(ok, false, "js_cocos2dx_spine_SkeletonCacheAnimation_setUseMulti : Error processing arguments");
cobj->setUseMulti(arg0);
return true;
}
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1);
return false;
}
SE_BIND_FUNC(js_cocos2dx_spine_SkeletonCacheAnimation_setUseMulti)
static bool js_cocos2dx_spine_SkeletonCacheAnimation_setTimeScale(se::State& s)
{
spine::SkeletonCacheAnimation* cobj = (spine::SkeletonCacheAnimation*)s.nativeThisObject();
@@ -16096,6 +16329,7 @@ bool js_register_cocos2dx_spine_SkeletonCacheAnimation(se::Object* obj)
auto cls = se::Class::create("SkeletonCacheAnimation", obj, nullptr, _SE(js_cocos2dx_spine_SkeletonCacheAnimation_constructor));
cls->defineFunction("setUseTint", _SE(js_cocos2dx_spine_SkeletonCacheAnimation_setUseTint));
cls->defineFunction("setUseMulti", _SE(js_cocos2dx_spine_SkeletonCacheAnimation_setUseMulti));
cls->defineFunction("setTimeScale", _SE(js_cocos2dx_spine_SkeletonCacheAnimation_setTimeScale));
cls->defineFunction("findAnimation", _SE(js_cocos2dx_spine_SkeletonCacheAnimation_findAnimation));
cls->defineFunction("setAttachUtil", _SE(js_cocos2dx_spine_SkeletonCacheAnimation_setAttachUtil));

View File

@@ -420,6 +420,8 @@ bool register_all_cocos2dx_spine(se::Object* obj);
SE_DECLARE_FUNC(js_cocos2dx_spine_MeshAttachment_setRegionOriginalHeight);
SE_DECLARE_FUNC(js_cocos2dx_spine_MeshAttachment_setRegionOffsetY);
SE_DECLARE_FUNC(js_cocos2dx_spine_MeshAttachment_setRegionOffsetX);
SE_DECLARE_FUNC(js_cocos2dx_spine_MeshAttachment_setRegionY);
SE_DECLARE_FUNC(js_cocos2dx_spine_MeshAttachment_setRegionX);
SE_DECLARE_FUNC(js_cocos2dx_spine_MeshAttachment_copy);
SE_DECLARE_FUNC(js_cocos2dx_spine_MeshAttachment_getRegionOriginalWidth);
SE_DECLARE_FUNC(js_cocos2dx_spine_MeshAttachment_getWidth);
@@ -455,6 +457,8 @@ SE_DECLARE_FUNC(js_cocos2dx_spine_MeshAttachment_setRegionHeight);
SE_DECLARE_FUNC(js_cocos2dx_spine_MeshAttachment_getTriangles);
SE_DECLARE_FUNC(js_cocos2dx_spine_MeshAttachment_getRegionOffsetY);
SE_DECLARE_FUNC(js_cocos2dx_spine_MeshAttachment_getRegionOffsetX);
SE_DECLARE_FUNC(js_cocos2dx_spine_MeshAttachment_getRegionY);
SE_DECLARE_FUNC(js_cocos2dx_spine_MeshAttachment_getRegionX);
SE_DECLARE_FUNC(js_cocos2dx_spine_MeshAttachment_getRegionV);
SE_DECLARE_FUNC(js_cocos2dx_spine_MeshAttachment_getRegionRotate);
SE_DECLARE_FUNC(js_cocos2dx_spine_MeshAttachment_getParentMesh);
@@ -563,11 +567,15 @@ bool register_all_cocos2dx_spine(se::Object* obj);
SE_DECLARE_FUNC(js_cocos2dx_spine_RegionAttachment_setRegionOriginalHeight);
SE_DECLARE_FUNC(js_cocos2dx_spine_RegionAttachment_setRegionOffsetY);
SE_DECLARE_FUNC(js_cocos2dx_spine_RegionAttachment_setRegionOffsetX);
SE_DECLARE_FUNC(js_cocos2dx_spine_RegionAttachment_setRegionY);
SE_DECLARE_FUNC(js_cocos2dx_spine_RegionAttachment_setRegionX);
SE_DECLARE_FUNC(js_cocos2dx_spine_RegionAttachment_getRegionOriginalWidth);
SE_DECLARE_FUNC(js_cocos2dx_spine_RegionAttachment_setUVs);
SE_DECLARE_FUNC(js_cocos2dx_spine_RegionAttachment_getWidth);
SE_DECLARE_FUNC(js_cocos2dx_spine_RegionAttachment_getY);
SE_DECLARE_FUNC(js_cocos2dx_spine_RegionAttachment_getRotation);
SE_DECLARE_FUNC(js_cocos2dx_spine_RegionAttachment_setRegionDegrees);
SE_DECLARE_FUNC(js_cocos2dx_spine_RegionAttachment_getRegionDegrees);
SE_DECLARE_FUNC(js_cocos2dx_spine_RegionAttachment_setWidth);
SE_DECLARE_FUNC(js_cocos2dx_spine_RegionAttachment_setRegionWidth);
SE_DECLARE_FUNC(js_cocos2dx_spine_RegionAttachment_getUVs);
@@ -594,6 +602,8 @@ SE_DECLARE_FUNC(js_cocos2dx_spine_RegionAttachment_updateOffset);
SE_DECLARE_FUNC(js_cocos2dx_spine_RegionAttachment_getRegionOriginalHeight);
SE_DECLARE_FUNC(js_cocos2dx_spine_RegionAttachment_getRegionOffsetY);
SE_DECLARE_FUNC(js_cocos2dx_spine_RegionAttachment_getRegionOffsetX);
SE_DECLARE_FUNC(js_cocos2dx_spine_RegionAttachment_getRegionY);
SE_DECLARE_FUNC(js_cocos2dx_spine_RegionAttachment_getRegionX);
extern se::Object* __jsb_spine_RotateTimeline_proto;
extern se::Class* __jsb_spine_RotateTimeline_class;
@@ -906,6 +916,7 @@ extern se::Class* __jsb_spine_SkeletonRenderer_class;
bool js_register_spine_SkeletonRenderer(se::Object* obj);
bool register_all_cocos2dx_spine(se::Object* obj);
SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonRenderer_setUseTint);
SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonRenderer_setUseMulti);
SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonRenderer_setTimeScale);
SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonRenderer_render);
SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonRenderer_initWithUUID);
@@ -1006,6 +1017,7 @@ extern se::Class* __jsb_spine_SkeletonCacheAnimation_class;
bool js_register_spine_SkeletonCacheAnimation(se::Object* obj);
bool register_all_cocos2dx_spine(se::Object* obj);
SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonCacheAnimation_setUseTint);
SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonCacheAnimation_setUseMulti);
SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonCacheAnimation_setTimeScale);
SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonCacheAnimation_findAnimation);
SE_DECLARE_FUNC(js_cocos2dx_spine_SkeletonCacheAnimation_setAttachUtil);

View File

@@ -672,6 +672,32 @@ bool seval_to_spine_Vector_T_ptr(const se::Value& v, spine::Vector<T*>* ret)
return true;
}
bool spine_skin_attachments_to_seval(std::vector<std::map<std::string, spine::Attachment*>>& 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<spine::Attachment>(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<spine::String>* ret);
bool spine_Vector_String_to_seval(const spine::Vector<spine::String>& v, se::Value* ret);
#endif

View File

@@ -51,6 +51,8 @@
#include "cocos/editor-support/spine/spine.h"
#include "cocos/editor-support/spine-creator-support/spine-cocos2dx.h"
#include "cocos/editor-support/spine-creator-support/AttachmentVertices.h"
using namespace cocos2d;
static spine::Cocos2dTextureLoader textureLoader;
@@ -233,6 +235,252 @@ static bool js_register_spine_retainSkeletonData(se::State& s)
}
SE_BIND_FUNC(js_register_spine_retainSkeletonData)
static bool js_cocos2dx_spine_Skin_getAttachmentsForJSB(se::State& s) {
spine::Skin* cobj = (spine::Skin*)s.nativeThisObject();
SE_PRECONDITION2(
cobj, false,
"js_cocos2dx_spine_Skin_getAttachmentsForJSB : Invalid Native Object");
const auto& args = s.args();
size_t argc = args.size();
CC_UNUSED bool ok = true;
if (argc == 0) {
std::vector<std::map<std::string, spine::Attachment*>> result =
cobj->getAttachmentsForJSB();
ok &= spine_skin_attachments_to_seval(result, &s.rval());
SE_PRECONDITION2(ok, false,
"js_cocos2dx_spine_Skin_getAttachmentsForJSB : Error "
"processing arguments");
return true;
}
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d",
(int)argc, 0);
return false;
}
SE_BIND_FUNC(js_cocos2dx_spine_Skin_getAttachmentsForJSB)
static bool js_cocos2dx_spine_RegionAttachment_getTextureForJSB(se::State& s) {
spine::RegionAttachment* cobj =
(spine::RegionAttachment*)s.nativeThisObject();
SE_PRECONDITION2(
cobj, false,
"js_cocos2dx_spine_RegionAttachment_getTextureForJSB : Invalid Native Object");
const auto& args = s.args();
size_t argc = args.size();
CC_UNUSED bool ok = true;
if (argc == 0) {
spine::AttachmentVertices* attachmentVertices = (spine::AttachmentVertices*)cobj->getRendererObject();
ok &= native_ptr_to_seval<cocos2d::middleware::Texture2D>((cocos2d::middleware::Texture2D*)attachmentVertices->_texture, &s.rval());
SE_PRECONDITION2(ok, false,
"js_cocos2dx_spine_RegionAttachment_getTextureForJSB : Error "
"processing arguments");
return true;
}
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d",
(int)argc, 0);
return false;
}
SE_BIND_FUNC(js_cocos2dx_spine_RegionAttachment_getTextureForJSB)
static bool js_cocos2dx_spine_RegionAttachment_setRegionForJSB(se::State& s) {
spine::RegionAttachment* attachment =
(spine::RegionAttachment*)s.nativeThisObject();
SE_PRECONDITION2(
attachment, false,
"js_cocos2dx_spine_RegionAttachment_setRegionForJSB : Invalid Native Object");
const auto& args = s.args();
size_t argc = args.size();
if (argc != 5) {
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", argc, 5);
return false;
}
bool ok = false;
if (attachment == nullptr) return false;
cocos2d::middleware::Texture2D* texture = nullptr;
ok = seval_to_native_ptr(args[0], &texture);
SE_PRECONDITION2(
ok, false,
"js_cocos2dx_spine_RegionAttachment_setRegionForJSB: Converting Middleware Texture2D failed!");
cocos2d::renderer::Rect rect;
ok = seval_to_Rect(args[1], &rect);
SE_PRECONDITION2(
ok, false, "js_cocos2dx_spine_RegionAttachment_setRegionForJSB: Converting Invalid Rect failed!");
cocos2d::Size originalSize;
ok = seval_to_Size(args[2], &originalSize);
SE_PRECONDITION2(
ok, false, "js_cocos2dx_spine_RegionAttachment_setRegionForJSB: Converting Invalid OriginalSize failed!");
cocos2d::Vec2 offset;
ok = seval_to_Vec2(args[3], &offset);
SE_PRECONDITION2(
ok, false, "js_cocos2dx_spine_RegionAttachment_setRegionForJSB: Converting Invalid Offset failed!");
float degrees;
ok = seval_to_float(args[4], &degrees);
SE_PRECONDITION2(
ok, false, "js_cocos2dx_spine_RegionAttachment_setRegionForJSB: Converting Invalid Degrees failed!");
spine::AttachmentVertices* attachmentVertices = (spine::AttachmentVertices*)attachment->getRendererObject();
CC_SAFE_RELEASE(attachmentVertices->_texture);
attachmentVertices->_texture = texture;
CC_SAFE_RETAIN(texture);
float u, v, u2, v2;
float w = texture->getNativeTexture()->getWidth();
float h = texture->getNativeTexture()->getHeight();
if (degrees != 0) {
u = rect.x / w;
v = rect.y / h;
u2 = (rect.x + rect.h) / w;
v2 = (rect.y + rect.w) / h;
} else {
u = rect.x / w;
v = rect.y / h;
u2 = (rect.x + rect.w) / w;
v2 = (rect.y + rect.h) / h;
}
attachment->setRegionX(rect.x);
attachment->setRegionY(rect.y);
attachment->setRegionWidth(rect.w);
attachment->setRegionHeight(rect.h);
attachment->setRegionOriginalWidth(originalSize.width);
attachment->setRegionOriginalHeight(originalSize.height);
attachment->setRegionOffsetX(offset.x);
attachment->setRegionOffsetY(offset.y);
attachment->setRegionDegrees(degrees);
attachment->setUVs(u, v, u2, v2, degrees);
attachment->updateOffset();
cocos2d::middleware::V2F_T2F_C4B* vertices = attachmentVertices->_triangles->verts;
for (int i = 0, ii = 0; i < 4; ++i, ii += 2) {
vertices[i].texCoord.u = attachment->getUVs()[ii];
vertices[i].texCoord.v = attachment->getUVs()[ii + 1];
}
return true;
}
SE_BIND_FUNC(js_cocos2dx_spine_RegionAttachment_setRegionForJSB)
static bool js_cocos2dx_spine_MeshAttachment_getTextureForJSB(se::State& s) {
spine::MeshAttachment* cobj =
(spine::MeshAttachment*)s.nativeThisObject();
SE_PRECONDITION2(
cobj, false,
"js_cocos2dx_spine_MeshAttachment_getTextureForJSB : Invalid Native Object");
const auto& args = s.args();
size_t argc = args.size();
CC_UNUSED bool ok = true;
if (argc == 0) {
spine::AttachmentVertices* attachmentVertices = (spine::AttachmentVertices*)cobj->getRendererObject();
ok &= native_ptr_to_seval<cocos2d::middleware::Texture2D>((cocos2d::middleware::Texture2D*)attachmentVertices->_texture, &s.rval());
SE_PRECONDITION2(ok, false,
"js_cocos2dx_spine_MeshAttachment_getTextureForJSB : Error "
"processing arguments");
return true;
}
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d",
(int)argc, 0);
return false;
}
SE_BIND_FUNC(js_cocos2dx_spine_MeshAttachment_getTextureForJSB)
static bool js_cocos2dx_spine_MeshAttachment_setRegionForJSB(se::State& s) {
spine::MeshAttachment* attachment =
(spine::MeshAttachment*)s.nativeThisObject();
SE_PRECONDITION2(
attachment, false,
"js_cocos2dx_spine_MeshAttachment_setRegionForJSB : Invalid Native Object");
const auto& args = s.args();
size_t argc = args.size();
if (argc != 5) {
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", argc, 5);
return false;
}
bool ok = false;
if (attachment == nullptr) return false;
cocos2d::middleware::Texture2D* texture = nullptr;
ok = seval_to_native_ptr(args[0], &texture);
SE_PRECONDITION2(
ok, false,
"js_cocos2dx_spine_MeshAttachment_setRegionForJSB: Converting Middleware Texture2D failed!");
cocos2d::renderer::Rect rect;
ok = seval_to_Rect(args[1], &rect);
SE_PRECONDITION2(
ok, false, "js_cocos2dx_spine_MeshAttachment_setRegionForJSB: Converting Invalid Rect failed!");
cocos2d::Size originalSize;
ok = seval_to_Size(args[2], &originalSize);
SE_PRECONDITION2(
ok, false, "js_cocos2dx_spine_MeshAttachment_setRegionForJSB: Converting Invalid OriginalSize failed!");
cocos2d::Vec2 offset;
ok = seval_to_Vec2(args[3], &offset);
SE_PRECONDITION2(
ok, false, "js_cocos2dx_spine_MeshAttachment_setRegionForJSB: Converting Invalid Offset failed!");
float degrees;
ok = seval_to_float(args[4], &degrees);
SE_PRECONDITION2(
ok, false, "js_cocos2dx_spine_MeshAttachment_setRegionForJSB: Converting Invalid Degrees failed!");
spine::AttachmentVertices* attachmentVertices = (spine::AttachmentVertices*)attachment->getRendererObject();
CC_SAFE_RELEASE(attachmentVertices->_texture);
attachmentVertices->_texture = texture;
CC_SAFE_RETAIN(texture);
float u, v, u2, v2;
float w = texture->getNativeTexture()->getWidth();
float h = texture->getNativeTexture()->getHeight();
if (degrees != 0) {
u = rect.x / w;
v = rect.y / h;
u2 = (rect.x + rect.h) / w;
v2 = (rect.y + rect.w) / h;
} else {
u = rect.x / w;
v = rect.y / h;
u2 = (rect.x + rect.w) / w;
v2 = (rect.y + rect.h) / h;
}
attachment->setRegionU(u);
attachment->setRegionV(v);
attachment->setRegionU2(u2);
attachment->setRegionV2(v2);
attachment->setRegionRotate(degrees != 0);
attachment->setRegionDegrees(degrees);
attachment->setRegionX(rect.x);
attachment->setRegionY(rect.y);
attachment->setRegionWidth(rect.w);
attachment->setRegionHeight(rect.h);
attachment->setRegionOriginalWidth(originalSize.width);
attachment->setRegionOriginalHeight(originalSize.height);
attachment->setRegionOffsetX(offset.x);
attachment->setRegionOffsetY(offset.y);
attachment->updateUVs();
cocos2d::middleware::V2F_T2F_C4B* vertices = attachmentVertices->_triangles->verts;
for (size_t i = 0, ii = 0, nn = attachment->getWorldVerticesLength(); ii < nn; ++i, ii += 2) {
vertices[i].texCoord.u = attachment->getUVs()[ii];
vertices[i].texCoord.v = attachment->getUVs()[ii + 1];
}
return true;
}
SE_BIND_FUNC(js_cocos2dx_spine_MeshAttachment_setRegionForJSB)
bool register_all_spine_manual(se::Object* obj)
{
// Get the ns
@@ -249,7 +497,15 @@ bool register_all_spine_manual(se::Object* obj)
ns->defineFunction("initSkeletonData", _SE(js_register_spine_initSkeletonData));
ns->defineFunction("retainSkeletonData", _SE(js_register_spine_retainSkeletonData));
ns->defineFunction("disposeSkeletonData", _SE(js_register_spine_disposeSkeletonData));
__jsb_spine_Skin_proto->defineFunction("getAttachments", _SE(js_cocos2dx_spine_Skin_getAttachmentsForJSB));
__jsb_spine_RegionAttachment_proto->defineFunction("getTextureForJSB",_SE(js_cocos2dx_spine_RegionAttachment_getTextureForJSB));
__jsb_spine_RegionAttachment_proto->defineFunction("setRegionForJSB",_SE(js_cocos2dx_spine_RegionAttachment_setRegionForJSB));
__jsb_spine_MeshAttachment_proto->defineFunction("getTextureForJSB",_SE(js_cocos2dx_spine_MeshAttachment_getTextureForJSB));
__jsb_spine_MeshAttachment_proto->defineFunction("setRegionForJSB",_SE(js_cocos2dx_spine_MeshAttachment_setRegionForJSB));
spine::setSpineObjectDisposeCallback([](void* spineObj){
se::Object* seObj = nullptr;

View File

@@ -30,4 +30,7 @@ namespace se {
class Object;
}
SE_DECLARE_FUNC(js_cocos2dx_spine_Skin_getAttachmentsForJSB);
SE_DECLARE_FUNC(js_cocos2dx_spine_RegionAttachment_getTextureForJSB);
bool register_all_spine_manual(se::Object* obj);