Make the local bookmarks print their error message if they fail; also replace whitespaces with underscores for identifiers

This commit is contained in:
Alexander Bock
2023-02-27 18:57:12 +01:00
parent 7b78a33df3
commit 3fcb9352f6
2 changed files with 7 additions and 2 deletions

View File

@@ -5,7 +5,10 @@ local nodes = bookmarkHelper.getBookmarks("Local Bookmarks", "${ASSETS}/customiz
asset.onInitialize(function()
for _, n in ipairs(nodes) do
pcall(openspace.addSceneGraphNode, n)
local success, error = pcall(openspace.addSceneGraphNode, n)
if not success then
openspace.printError(error)
end
end
end)

View File

@@ -7,6 +7,8 @@ local getBookmarks = function (guiPath, bookmarkfile)
local matchstring = "(.-),(.-),(.-),(.-),(.-),(.-),(.-),(.-),(.-),(.-),(.-)$"
local group, name, globe, lat, lon, altitude, x, y, z, scale, linewidth = line:match(matchstring)
local identifier = string.gsub(guiPath .. "-" .. name, " ", "_")
scale = (scale == "" and 75000 or scale)
linewidth = (linewidth == "" and 2.0 or tonumber(linewidth))
group = (group == "" and globe or group)
@@ -14,7 +16,7 @@ local getBookmarks = function (guiPath, bookmarkfile)
local parent = (globe == "" and "Root" or globe)
local sgn = {
Identifier = guiPath .. "-" .. name,
Identifier = identifier,
Parent = parent,
Transform = {
Scale = {