adding context menu function to trashcans

This commit is contained in:
Chr1Z93 2023-03-09 20:04:53 +01:00
parent 39b7b3a245
commit 5236769fc1
6 changed files with 16 additions and 5 deletions

View File

@ -34,7 +34,7 @@
"IgnoreFoW": false, "IgnoreFoW": false,
"LayoutGroupSortIndex": 0, "LayoutGroupSortIndex": 0,
"Locked": true, "Locked": true,
"LuaScript": "", "LuaScript": "require(\"util/Trashcan\")",
"LuaScriptState": "", "LuaScriptState": "",
"MaterialIndex": -1, "MaterialIndex": -1,
"MeasureMovement": false, "MeasureMovement": false,

View File

@ -34,7 +34,7 @@
"IgnoreFoW": false, "IgnoreFoW": false,
"LayoutGroupSortIndex": 0, "LayoutGroupSortIndex": 0,
"Locked": true, "Locked": true,
"LuaScript": "", "LuaScript": "require(\"util/Trashcan\")",
"LuaScriptState": "", "LuaScriptState": "",
"MaterialIndex": -1, "MaterialIndex": -1,
"MeasureMovement": false, "MeasureMovement": false,

View File

@ -34,7 +34,7 @@
"IgnoreFoW": false, "IgnoreFoW": false,
"LayoutGroupSortIndex": 0, "LayoutGroupSortIndex": 0,
"Locked": true, "Locked": true,
"LuaScript": "", "LuaScript": "require(\"util/Trashcan\")",
"LuaScriptState": "", "LuaScriptState": "",
"MaterialIndex": -1, "MaterialIndex": -1,
"MeasureMovement": false, "MeasureMovement": false,

View File

@ -34,7 +34,7 @@
"IgnoreFoW": false, "IgnoreFoW": false,
"LayoutGroupSortIndex": 0, "LayoutGroupSortIndex": 0,
"Locked": true, "Locked": true,
"LuaScript": "", "LuaScript": "require(\"util/Trashcan\")",
"LuaScriptState": "", "LuaScriptState": "",
"MaterialIndex": -1, "MaterialIndex": -1,
"MeasureMovement": false, "MeasureMovement": false,

View File

@ -34,7 +34,7 @@
"IgnoreFoW": false, "IgnoreFoW": false,
"LayoutGroupSortIndex": 0, "LayoutGroupSortIndex": 0,
"Locked": true, "Locked": true,
"LuaScript": "", "LuaScript": "require(\"util/Trashcan\")",
"LuaScriptState": "", "LuaScriptState": "",
"MaterialIndex": -1, "MaterialIndex": -1,
"MeasureMovement": false, "MeasureMovement": false,

11
src/util/Trashcan.ttslua Normal file
View File

@ -0,0 +1,11 @@
-- adds a context menu entry to trigger the emptying
function onLoad()
self.addContextMenuItem("Empty Trash", emptyTrash)
end
-- removes all objects by taking them out and then destructing them
function emptyTrash()
for _, trash in ipairs(self.getObjects()) do
self.takeObject().destruct()
end
end