mirror of
https://github.com/aseprite/aseprite.git
synced 2025-02-20 18:40:57 +00:00
[lua] Use the correct "controller" when "tool" param is specified in app.useTool()
Fix regression introduced in 1ec502d242ddddadf497c9738986edcaed55000b
This commit is contained in:
parent
6d2ddf877b
commit
7a74aef1a7
@ -293,15 +293,17 @@ int App_useTool(lua_State* L)
|
||||
lua_pop(L, 1);
|
||||
|
||||
// Select tool by name
|
||||
const int buttonIdx = (params.button == tools::ToolLoop::Left ? 0: 1);
|
||||
auto activeToolMgr = App::instance()->activeToolManager();
|
||||
params.tool = activeToolMgr->activeTool();
|
||||
params.ink = params.tool->getInk(params.button == tools::ToolLoop::Left ? 0: 1);
|
||||
params.controller = params.tool->getController(params.button);
|
||||
params.ink = params.tool->getInk(buttonIdx);
|
||||
params.controller = params.tool->getController(buttonIdx);
|
||||
type = lua_getfield(L, 1, "tool");
|
||||
if (type != LUA_TNIL) {
|
||||
if (auto toolArg = get_tool_from_arg(L, -1)) {
|
||||
params.tool = toolArg;
|
||||
params.ink = params.tool->getInk(0);
|
||||
params.ink = params.tool->getInk(buttonIdx);
|
||||
params.controller = params.tool->getController(buttonIdx);
|
||||
}
|
||||
else
|
||||
return luaL_error(L, "invalid tool specified in app.useTool() function");
|
||||
|
Loading…
x
Reference in New Issue
Block a user