mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-01 18:00:26 +00:00
[lua] Add ev.tileset value to remaptileset event
This commit is contained in:
parent
c8d4c60f07
commit
28c26aa62c
@ -23,7 +23,7 @@ template <typename T> void push_docobj(lua_State* L, doc::ObjectId id) {
|
||||
lua_setmetatable(L, -2);
|
||||
}
|
||||
|
||||
template <typename T> void push_docobj(lua_State* L, T* obj) {
|
||||
template <typename T> void push_docobj(lua_State* L, const T* obj) {
|
||||
push_docobj<T>(L, obj->id());
|
||||
}
|
||||
|
||||
|
@ -162,7 +162,7 @@ namespace app {
|
||||
void push_sprite_slices(lua_State* L, doc::Sprite* sprite);
|
||||
void push_sprite_tags(lua_State* L, doc::Sprite* sprite);
|
||||
void push_sprites(lua_State* L);
|
||||
void push_tileset(lua_State* L, doc::Tileset* tileset);
|
||||
void push_tileset(lua_State* L, const doc::Tileset* tileset);
|
||||
void push_tileset_image(lua_State* L, doc::Tileset* tileset, doc::Image* image);
|
||||
void push_tilesets(lua_State* L, doc::Tilesets* tilesets);
|
||||
void push_tool(lua_State* L, app::tools::Tool* tool);
|
||||
|
@ -264,6 +264,7 @@ public:
|
||||
void onRemapTileset(DocEvent& ev, const doc::Remap& remap) override {
|
||||
const bool fromUndo = (ev.document()->transaction() == nullptr);
|
||||
call(RemapTileset, { { "remap", std::any(&remap) },
|
||||
{ "tileset", std::any((const doc::Tileset*)ev.tileset()) },
|
||||
{ "fromUndo", fromUndo } });
|
||||
}
|
||||
|
||||
|
@ -114,7 +114,7 @@ void register_tileset_class(lua_State* L)
|
||||
REG_CLASS_PROPERTIES(L, Tileset);
|
||||
}
|
||||
|
||||
void push_tileset(lua_State* L, Tileset* tileset)
|
||||
void push_tileset(lua_State* L, const Tileset* tileset)
|
||||
{
|
||||
push_docobj(L, tileset);
|
||||
}
|
||||
|
@ -113,6 +113,8 @@ void push_value_to_lua(lua_State* L, const std::any& value) {
|
||||
push_value_to_lua(L, *v);
|
||||
else if (auto v = std::any_cast<const doc::Remap*>(&value))
|
||||
push_value_to_lua(L, **v);
|
||||
else if (auto v = std::any_cast<const doc::Tileset*>(&value))
|
||||
push_tileset(L, *v);
|
||||
else {
|
||||
ASSERT(false);
|
||||
throw std::runtime_error("Cannot convert type inside std::any");
|
||||
|
Loading…
Reference in New Issue
Block a user