Added VFR handling functions to Auto4/Lua.
Originally committed to SVN as r937.
This commit is contained in:
parent
30792ec961
commit
ffe5558ba1
|
@ -226,6 +226,11 @@ namespace Automation4 {
|
||||||
// aegisub.text_extents
|
// aegisub.text_extents
|
||||||
lua_pushcfunction(L, LuaTextExtents);
|
lua_pushcfunction(L, LuaTextExtents);
|
||||||
lua_setfield(L, -2, "text_extents");
|
lua_setfield(L, -2, "text_extents");
|
||||||
|
// VFR handling
|
||||||
|
lua_pushcfunction(L, LuaFrameFromMs);
|
||||||
|
lua_setfield(L, -2, "frame_from_ms");
|
||||||
|
lua_pushcfunction(L, LuaMsFromFrame);
|
||||||
|
lua_setfield(L, -2, "ms_from_frame");
|
||||||
// aegisub.lua_automation_version
|
// aegisub.lua_automation_version
|
||||||
lua_pushinteger(L, 4);
|
lua_pushinteger(L, 4);
|
||||||
lua_setfield(L, -2, "lua_automation_version");
|
lua_setfield(L, -2, "lua_automation_version");
|
||||||
|
@ -416,6 +421,32 @@ namespace Automation4 {
|
||||||
return lua_gettop(L) - pretop;
|
return lua_gettop(L) - pretop;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int LuaScript::LuaFrameFromMs(lua_State *L)
|
||||||
|
{
|
||||||
|
int ms = (int)lua_tonumber(L, -1);
|
||||||
|
lua_pop(L, 1);
|
||||||
|
if (VFR_Output.IsLoaded()) {
|
||||||
|
lua_pushnumber(L, VFR_Output.GetFrameAtTime(ms, true));
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
|
lua_pushnil(L);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int LuaScript::LuaMsFromFrame(lua_State *L)
|
||||||
|
{
|
||||||
|
int frame = (int)lua_tonumber(L, -1);
|
||||||
|
lua_pop(L, 1);
|
||||||
|
if (VFR_Output.IsLoaded()) {
|
||||||
|
lua_pushnumber(L, VFR_Output.GetTimeAtFrame(frame, true));
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
|
lua_pushnil(L);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// LuaThreadedCall
|
// LuaThreadedCall
|
||||||
|
|
||||||
|
|
|
@ -191,6 +191,8 @@ namespace Automation4 {
|
||||||
|
|
||||||
static int LuaTextExtents(lua_State *L);
|
static int LuaTextExtents(lua_State *L);
|
||||||
static int LuaInclude(lua_State *L);
|
static int LuaInclude(lua_State *L);
|
||||||
|
static int LuaFrameFromMs(lua_State *L);
|
||||||
|
static int LuaMsFromFrame(lua_State *L);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LuaScript(const wxString &filename);
|
LuaScript(const wxString &filename);
|
||||||
|
|
Loading…
Reference in a new issue