Add function allowing insight into currently loaded assets. Don't print info message when loading asset that was already loaded

This commit is contained in:
Alexander Bock
2022-02-21 21:19:13 +01:00
parent abaaf437b6
commit ae40493627
3 changed files with 48 additions and 1 deletions

View File

@@ -40,7 +40,10 @@ if is_image_file(extension) then
TexturePath = "]] .. filename .. [["
});]] .. ReloadUIScript
elseif extension == ".asset" then
return [[openspace.printInfo("Adding asset: ']] .. filename .. [[' (drag-and-drop)");
return [[
if openspace.asset.isLoaded("]] .. filename .. [[") ~= true then
openspace.printInfo("Adding asset: ']] .. filename .. [[' (drag-and-drop)");
end
openspace.asset.add("]] .. filename .. [[");]] .. ReloadUIScript
elseif extension == ".osrec" or extension == ".osrectxt" then
return [[openspace.sessionRecording.startPlayback("]] .. filename .. [[")]]