mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-05 21:57:20 +00:00
lua: Cel/Palette.frame return a Frame and added Cel/Palette.frameNumber
This commit is contained in:
parent
32e29b8ea7
commit
d1fb49ba83
@ -49,6 +49,16 @@ int Cel_get_layer(lua_State* L)
|
||||
}
|
||||
|
||||
int Cel_get_frame(lua_State* L)
|
||||
{
|
||||
const auto cel = get_docobj<Cel>(L, 1);
|
||||
if (auto sprite = cel->sprite())
|
||||
push_sprite_frame(L, sprite, cel->frame());
|
||||
else
|
||||
lua_pushnil(L);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int Cel_get_frameNumber(lua_State* L)
|
||||
{
|
||||
const auto cel = get_docobj<Cel>(L, 1);
|
||||
lua_pushinteger(L, cel->frame()+1);
|
||||
@ -125,6 +135,7 @@ const Property Cel_properties[] = {
|
||||
{ "sprite", Cel_get_sprite, nullptr },
|
||||
{ "layer", Cel_get_layer, nullptr },
|
||||
{ "frame", Cel_get_frame, nullptr },
|
||||
{ "frameNumber", Cel_get_frameNumber, nullptr },
|
||||
{ "image", Cel_get_image, Cel_set_image },
|
||||
{ "bounds", Cel_get_bounds, nullptr },
|
||||
{ "position", Cel_get_position, Cel_set_position },
|
||||
|
@ -149,6 +149,17 @@ int Palette_setColor(lua_State* L)
|
||||
}
|
||||
|
||||
int Palette_get_frame(lua_State* L)
|
||||
{
|
||||
auto obj = get_obj<PaletteObj>(L, 1);
|
||||
auto pal = obj->palette(L);
|
||||
if (auto sprite = obj->sprite(L))
|
||||
push_sprite_frame(L, sprite, pal->frame());
|
||||
else
|
||||
lua_pushnil(L);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int Palette_get_frameNumber(lua_State* L)
|
||||
{
|
||||
auto obj = get_obj<PaletteObj>(L, 1);
|
||||
auto pal = obj->palette(L);
|
||||
@ -167,6 +178,7 @@ const luaL_Reg Palette_methods[] = {
|
||||
|
||||
const Property Palette_properties[] = {
|
||||
{ "frame", Palette_get_frame, nullptr },
|
||||
{ "frameNumber", Palette_get_frameNumber, nullptr },
|
||||
{ nullptr, nullptr, nullptr }
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user