export 'setAttachment' function to lua (#868)

* export: sp.SkeletonAnimation:findBone sp.SkeletonAnimation:getBoundingBox

* export 'setAttachment' function to lua

Co-authored-by: tkzcfc <tkzcfc@users.noreply.github.com>
This commit is contained in:
tkzcfc 2022-09-27 19:15:11 +08:00 committed by GitHub
parent 5c1b2d4f16
commit c01af9d338
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 66 additions and 1 deletions

View File

@ -150,6 +150,69 @@ int lua_ax_spine_SkeletonRenderer_getDebugSlotsEnabled(lua_State* tolua_S)
return 0;
}
int lua_ax_spine_SkeletonRenderer_setAttachment(lua_State* tolua_S)
{
int argc = 0;
spine::SkeletonRenderer* cobj = nullptr;
bool ok = true;
#if _AX_DEBUG >= 1
tolua_Error tolua_err;
#endif
#if _AX_DEBUG >= 1
if (!tolua_isusertype(tolua_S,1,"sp.SkeletonRenderer",0,&tolua_err)) goto tolua_lerror;
#endif
cobj = (spine::SkeletonRenderer*)tolua_tousertype(tolua_S,1,0);
#if _AX_DEBUG >= 1
if (!cobj)
{
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_ax_spine_SkeletonRenderer_setAttachment'", nullptr);
return 0;
}
#endif
argc = lua_gettop(tolua_S)-1;
do{
if (argc == 2) {
std::string arg0;
ok &= luaval_to_std_string(tolua_S, 2,&arg0, "sp.SkeletonRenderer:setAttachment");
if (!ok) { break; }
const char* arg1;
std::string arg1_tmp; ok &= luaval_to_std_string(tolua_S, 3, &arg1_tmp, "sp.SkeletonRenderer:setAttachment"); arg1 = arg1_tmp.c_str();
if (!ok) { break; }
bool ret = cobj->setAttachment(arg0, arg1);
tolua_pushboolean(tolua_S,(bool)ret);
return 1;
}
}while(0);
ok = true;
do{
if (argc == 2) {
std::string arg0;
ok &= luaval_to_std_string(tolua_S, 2,&arg0, "sp.SkeletonRenderer:setAttachment");
if (!ok) { break; }
std::string arg1;
ok &= luaval_to_std_string(tolua_S, 3,&arg1, "sp.SkeletonRenderer:setAttachment");
if (!ok) { break; }
bool ret = cobj->setAttachment(arg0, arg1);
tolua_pushboolean(tolua_S,(bool)ret);
return 1;
}
}while(0);
ok = true;
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "sp.SkeletonRenderer:setAttachment",argc, 2);
return 0;
#if _AX_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'lua_ax_spine_SkeletonRenderer_setAttachment'.",&tolua_err);
#endif
return 0;
}
int lua_ax_spine_SkeletonRenderer_setBonesToSetupPose(lua_State* tolua_S)
{
int argc = 0;
@ -1901,6 +1964,7 @@ int lua_register_ax_spine_SkeletonRenderer(lua_State* tolua_S)
tolua_function(tolua_S,"setTimeScale",lua_ax_spine_SkeletonRenderer_setTimeScale);
tolua_function(tolua_S,"setDebugBoundingRectEnabled",lua_ax_spine_SkeletonRenderer_setDebugBoundingRectEnabled);
tolua_function(tolua_S,"getDebugSlotsEnabled",lua_ax_spine_SkeletonRenderer_getDebugSlotsEnabled);
tolua_function(tolua_S,"setAttachment",lua_ax_spine_SkeletonRenderer_setAttachment);
tolua_function(tolua_S,"setBonesToSetupPose",lua_ax_spine_SkeletonRenderer_setBonesToSetupPose);
tolua_function(tolua_S,"initWithData",lua_ax_spine_SkeletonRenderer_initWithData);
tolua_function(tolua_S,"setDebugSlotsEnabled",lua_ax_spine_SkeletonRenderer_setDebugSlotsEnabled);

View File

@ -61,6 +61,7 @@ int register_all_ax_spine(lua_State* tolua_S);
#endif // __ax_spine_h__

View File

@ -37,7 +37,7 @@ classes = SkeletonRenderer SkeletonAnimation
# will apply to all class names. This is a convenience wildcard to be able to skip similar named
# functions from all classes.
skip = SkeletonRenderer::[findBone findSlot getAttachment setAttachment update draw createWithData],
skip = SkeletonRenderer::[findBone findSlot getAttachment update draw createWithData],
*::[update draw drawSkeleton],
SkeletonAnimation::[setAnimationStateData createWithData addAnimation getCurrent setAnimation onAnimationStateEvent onTrackEntryEvent getState createWithFile]