mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-03-13 08:58:54 -05:00
- Remove the asset_helper file and call the onInitialize and onDeinitialize functions directly - Small compile fix on Windows - Removes the need for the registerIdentifierWithMeta function by automatically doing that for all asset.export statements - Allow the passing of either identifiers (as before) or entire tables to the removeSceneGraphNode, removeScreenSpaceRenderable, deleteLayer, removeAction, and export methods. In that case, the Identifier key from the table is extracted and used instead
48 lines
1.3 KiB
Lua
48 lines
1.3 KiB
Lua
local stateMachineHelper = asset.require("util/lua_state_machine_helper")
|
|
|
|
local states = {
|
|
{
|
|
Title = "Highlight EarthTrail",
|
|
Play = function ()
|
|
openspace.setPropertyValue("Scene.EarthTrail.Renderable.Appearance.LineWidth", 10, 1)
|
|
end,
|
|
Rewind = function ()
|
|
openspace.setPropertyValue("Scene.EarthTrail.Renderable.Appearance.LineWidth", 2, 1)
|
|
end
|
|
},
|
|
{
|
|
Title = "Highlight MarsTrail",
|
|
Play = function ()
|
|
openspace.setPropertyValue("Scene.EarthTrail.Renderable.Appearance.LineWidth", 2, 1)
|
|
openspace.setPropertyValue("Scene.MarsTrail.Renderable.Appearance.LineWidth", 10, 1)
|
|
end,
|
|
Rewind = function ()
|
|
openspace.setPropertyValue("Scene.MarsTrail.Renderable.Appearance.LineWidth", 2, 1)
|
|
openspace.setPropertyValue("Scene.EarthTrail.Renderable.Appearance.LineWidth", 10, 1)
|
|
end
|
|
}
|
|
}
|
|
|
|
local stateMachine
|
|
|
|
function next()
|
|
stateMachine.goToNextState()
|
|
end
|
|
|
|
function previous()
|
|
stateMachine.goToPreviousState()
|
|
end
|
|
|
|
asset.onInitialize(function()
|
|
stateMachine = stateMachineHelper.createStateMachine(states)
|
|
openspace.bindKey("RIGHT", "next()")
|
|
openspace.bindKey("LEFT", "previous()")
|
|
end)
|
|
|
|
|
|
asset.onDeinitialize(function()
|
|
stateMachine = nil
|
|
openspace.clearKey("RIGHT")
|
|
openspace.clearKey("LEFT")
|
|
end)
|