mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-05 19:19:39 -06:00
Add checks to asset_helper that check the length of passed table to registerSceneGraphNodes and registerSceneGraphNodesAndExport
Add check to procedural_globe that checks the parameters to createGlobes Fix issues with Ganymede, Triton, and Dione
This commit is contained in:
@@ -121,6 +121,8 @@ local CharonTrail = {
|
||||
GuiPath = "/Solar System/Dwarf Planets/Pluto"
|
||||
}
|
||||
|
||||
|
||||
|
||||
assetHelper.registerSceneGraphNodesAndExport(asset, {
|
||||
Charon,
|
||||
CharonText,
|
||||
|
||||
@@ -336,6 +336,8 @@ local Rex = {
|
||||
GuiPath = "/Solar System/Missions/New Horizons"
|
||||
}
|
||||
|
||||
|
||||
|
||||
assetHelper.registerSceneGraphNodesAndExport(asset, {
|
||||
Lorri,
|
||||
RalphLeisa,
|
||||
|
||||
@@ -77,6 +77,8 @@ local KerberosTrail = {
|
||||
GuiPath = "/Solar System/Dwarf Planets/Pluto"
|
||||
}
|
||||
|
||||
|
||||
|
||||
assetHelper.registerSceneGraphNodesAndExport(asset, {
|
||||
Kerberos,
|
||||
KerberosText,
|
||||
|
||||
@@ -41,6 +41,8 @@ local PlutoKernels = {
|
||||
Kernels .. "/new_horizons/spk/NavSE_plu047_od122.bsp"
|
||||
}
|
||||
|
||||
|
||||
|
||||
asset.export("Kernels", Kernels)
|
||||
asset.export("NewHorizonsKernels", NewHorizonsKernels)
|
||||
asset.export("PlutoKernels", PlutoKernels)
|
||||
|
||||
@@ -65,6 +65,8 @@ local NixTrail = {
|
||||
GuiPath = "/Solar System/Dwarf Planets/Pluto"
|
||||
}
|
||||
|
||||
|
||||
|
||||
assetHelper.registerSceneGraphNodesAndExport(asset, {
|
||||
Nix,
|
||||
NixText,
|
||||
|
||||
@@ -266,6 +266,8 @@ local PlutoTrail = {
|
||||
GuiPath = "/Solar System/Dwarf Planets/Pluto"
|
||||
}
|
||||
|
||||
|
||||
|
||||
assetHelper.registerSceneGraphNodesAndExport(asset, {
|
||||
Pluto,
|
||||
PlutoBarycenterLabel,
|
||||
|
||||
@@ -73,6 +73,8 @@ local StyxTrail = {
|
||||
GuiPath = "/Solar System/Dwarf Planets/Pluto"
|
||||
}
|
||||
|
||||
|
||||
|
||||
assetHelper.registerSceneGraphNodesAndExport(asset, {
|
||||
Styx,
|
||||
StyxText,
|
||||
|
||||
@@ -130,6 +130,7 @@ local Trail67P = {
|
||||
}
|
||||
|
||||
|
||||
|
||||
assetHelper.registerSceneGraphNodesAndExport(asset, {
|
||||
Barycenter,
|
||||
Comet67P,
|
||||
|
||||
@@ -425,6 +425,8 @@ local PhilaeTrail = {
|
||||
GuiPath = "/Solar System/Missions/Rosetta"
|
||||
}
|
||||
|
||||
|
||||
|
||||
assetHelper.registerSceneGraphNodesAndExport(asset, {
|
||||
Rosetta,
|
||||
RosettaModel,
|
||||
|
||||
@@ -185,6 +185,8 @@ local VoyagerTrailCruiseSaturnInf = {
|
||||
GuiPath = "/Solar System/Missions/Voyager 1"
|
||||
}
|
||||
|
||||
|
||||
|
||||
assetHelper.registerSceneGraphNodesAndExport(asset, {
|
||||
Voyager1,
|
||||
Voyager1Main,
|
||||
|
||||
@@ -267,6 +267,8 @@ local VoyagerTrailCruiseNeptuneInf = {
|
||||
GuiPath = "/Solar System/Missions/Voyager 2"
|
||||
}
|
||||
|
||||
|
||||
|
||||
assetHelper.registerSceneGraphNodesAndExport(asset, {
|
||||
Voyager2,
|
||||
Voyager2Main,
|
||||
|
||||
@@ -46,7 +46,7 @@ local Ganymede = {
|
||||
},
|
||||
Tag = { "moon_solarSystem", "moon_giants", "moon_jupiter" },
|
||||
GuiPath = "/Solar System/Planets/Jupiter/Moons"
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -24,5 +24,5 @@ local Triton = {
|
||||
|
||||
assetHelper.registerSceneGraphNodesAndExport(
|
||||
asset,
|
||||
proceduralGlobes.createGlobes(Triton)
|
||||
proceduralGlobes.createGlobes({ Triton })
|
||||
)
|
||||
|
||||
@@ -44,7 +44,7 @@ local Dione = {
|
||||
},
|
||||
Tag = { "moon_solarSystem", "moon_giants", "moon_saturn" },
|
||||
GuiPath = "/Solar System/Planets/Saturn/Moons"
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
local tableLength = function(table)
|
||||
local count = 0
|
||||
for _ in pairs(nodes) do count = count + 1 end
|
||||
return count
|
||||
end
|
||||
|
||||
|
||||
local registerSpiceKernels = function (spiceAsset, kernels)
|
||||
spiceAsset.onInitialize(function ()
|
||||
for i, kernel in ipairs(kernels) do
|
||||
@@ -12,7 +19,16 @@ local registerSpiceKernels = function (spiceAsset, kernels)
|
||||
end)
|
||||
end
|
||||
|
||||
local registerSceneGraphNodes = function (sceneAsset, nodes)
|
||||
local registerSceneGraphNodes = function (sceneAsset, nodes, override)
|
||||
override = override or false
|
||||
if not override then
|
||||
if tableLength(nodes) == 0 then
|
||||
openspace.printWarning("Register function was called with an empty node list. Pass 'true' as third argument to silence this warning.")
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
sceneAsset.onInitialize(function ()
|
||||
for i, node in ipairs(nodes) do
|
||||
openspace.addSceneGraphNode(node)
|
||||
@@ -26,7 +42,16 @@ local registerSceneGraphNodes = function (sceneAsset, nodes)
|
||||
end)
|
||||
end
|
||||
|
||||
local registerSceneGraphNodesAndExport = function (sceneAsset, nodes)
|
||||
local registerSceneGraphNodesAndExport = function (sceneAsset, nodes, override)
|
||||
override = override or false
|
||||
if not override then
|
||||
if tableLength(nodes) == 0 then
|
||||
openspace.printWarning("Register function was called with an empty node list. Pass 'true' as third argument to silence this warning.")
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
sceneAsset.onInitialize(function ()
|
||||
for i, node in ipairs(nodes) do
|
||||
openspace.addSceneGraphNode(node)
|
||||
|
||||
@@ -41,7 +41,17 @@ end
|
||||
asset.export("createGlobe", createGlobe)
|
||||
|
||||
local createGlobes = function(t)
|
||||
|
||||
for _,v in pairs(t) do
|
||||
if type(v) ~= "table" then
|
||||
openspace.printWarning("The table passed to 'createGlobes' was not a table of tables")
|
||||
-- We return an empty table of tables to silence a potential future warning
|
||||
return {{}}
|
||||
end
|
||||
end
|
||||
|
||||
result = {}
|
||||
|
||||
for i, v in ipairs(t) do
|
||||
globe, trail = createGlobe(
|
||||
v.Name,
|
||||
@@ -61,4 +71,4 @@ local createGlobes = function(t)
|
||||
end
|
||||
return result
|
||||
end
|
||||
asset.export("createGlobes", createGlobes)
|
||||
asset.export("createGlobes", createGlobes)
|
||||
|
||||
Reference in New Issue
Block a user