mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-08 12:40:50 +00:00
lua: Fix Frame.from/toFrame properties (return a Frame instead of an integer)
This commit is contained in:
parent
f6a2090ed9
commit
8106aeee44
@ -13,6 +13,7 @@
|
|||||||
#include "app/cmd/set_frame_tag_name.h"
|
#include "app/cmd/set_frame_tag_name.h"
|
||||||
#include "app/cmd/set_frame_tag_range.h"
|
#include "app/cmd/set_frame_tag_range.h"
|
||||||
#include "app/script/docobj.h"
|
#include "app/script/docobj.h"
|
||||||
|
#include "app/script/engine.h"
|
||||||
#include "app/script/luacpp.h"
|
#include "app/script/luacpp.h"
|
||||||
#include "app/tx.h"
|
#include "app/tx.h"
|
||||||
#include "doc/frame_tag.h"
|
#include "doc/frame_tag.h"
|
||||||
@ -43,14 +44,20 @@ int Tag_get_sprite(lua_State* L)
|
|||||||
int Tag_get_fromFrame(lua_State* L)
|
int Tag_get_fromFrame(lua_State* L)
|
||||||
{
|
{
|
||||||
auto tag = get_docobj<FrameTag>(L, 1);
|
auto tag = get_docobj<FrameTag>(L, 1);
|
||||||
lua_pushinteger(L, tag->fromFrame()+1);
|
if (tag->owner()->sprite())
|
||||||
|
push_sprite_frame(L, tag->owner()->sprite(), tag->fromFrame());
|
||||||
|
else
|
||||||
|
lua_pushnil(L);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Tag_get_toFrame(lua_State* L)
|
int Tag_get_toFrame(lua_State* L)
|
||||||
{
|
{
|
||||||
auto tag = get_docobj<FrameTag>(L, 1);
|
auto tag = get_docobj<FrameTag>(L, 1);
|
||||||
lua_pushinteger(L, tag->toFrame()+1);
|
if (tag->owner()->sprite())
|
||||||
|
push_sprite_frame(L, tag->owner()->sprite(), tag->toFrame());
|
||||||
|
else
|
||||||
|
lua_pushnil(L);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,7 +85,7 @@ int Tag_get_aniDir(lua_State* L)
|
|||||||
int Tag_set_fromFrame(lua_State* L)
|
int Tag_set_fromFrame(lua_State* L)
|
||||||
{
|
{
|
||||||
auto tag = get_docobj<FrameTag>(L, 1);
|
auto tag = get_docobj<FrameTag>(L, 1);
|
||||||
const int fromFrame = lua_tointeger(L, 2)-1;
|
const auto fromFrame = get_frame_number_from_arg(L, 2);
|
||||||
Tx tx;
|
Tx tx;
|
||||||
tx(new cmd::SetFrameTagRange(tag, fromFrame,
|
tx(new cmd::SetFrameTagRange(tag, fromFrame,
|
||||||
std::max(fromFrame, tag->toFrame())));
|
std::max(fromFrame, tag->toFrame())));
|
||||||
@ -89,7 +96,7 @@ int Tag_set_fromFrame(lua_State* L)
|
|||||||
int Tag_set_toFrame(lua_State* L)
|
int Tag_set_toFrame(lua_State* L)
|
||||||
{
|
{
|
||||||
auto tag = get_docobj<FrameTag>(L, 1);
|
auto tag = get_docobj<FrameTag>(L, 1);
|
||||||
const int toFrame = lua_tointeger(L, 2)-1;
|
const auto toFrame = get_frame_number_from_arg(L, 2);
|
||||||
Tx tx;
|
Tx tx;
|
||||||
tx(new cmd::SetFrameTagRange(tag,
|
tx(new cmd::SetFrameTagRange(tag,
|
||||||
std::min(tag->fromFrame(), toFrame),
|
std::min(tag->fromFrame(), toFrame),
|
||||||
|
Loading…
Reference in New Issue
Block a user