diff --git a/data/assets/scene/solarsystem/heliosphere/bastille_day/density_volume.asset b/data/assets/scene/solarsystem/heliosphere/bastille_day/density_volume.asset index d65a1da26c..5ce05f9a16 100644 --- a/data/assets/scene/solarsystem/heliosphere/bastille_day/density_volume.asset +++ b/data/assets/scene/solarsystem/heliosphere/bastille_day/density_volume.asset @@ -51,7 +51,25 @@ local densityVolume = { local toggle_volume = { Identifier = "os.events.bastilleday.densityvolume.togglevolume", Name = "Toggle volume", - Command = propertyHelper.invert("Scene.MAS-MHD-Density-bastille-day-2000.Renderable.Enabled"), + Command = [[ + if openspace.getPropertyValue("Scene.MAS-MHD-Density-bastille-day-2000.Renderable.Enabled") then + openspace.setPropertyValueSingle( + "Scene.MAS-MHD-Density-bastille-day-2000.Renderable.Fade", + 0.0, + openspace.getPropertyValue("OpenSpaceEngine.FadeDuration"), + "Linear", + 'openspace.setPropertyValueSingle("Scene.MAS-MHD-Density-bastille-day-2000.Renderable.Enabled", false)' + ) + else + openspace.setPropertyValueSingle("Scene.MAS-MHD-Density-bastille-day-2000.Renderable.Enabled", true) + openspace.setPropertyValueSingle( + "Scene.MAS-MHD-Density-bastille-day-2000.Renderable.Fade", + 1.0, + openspace.getPropertyValue("OpenSpaceEngine.FadeDuration"), + "Linear" + ) + end + ]], Documentation = "Toggle volume rendering of CME", GuiPath = "/Bastille-Day 2000", IsLocal = false diff --git a/data/assets/scene/solarsystem/heliosphere/bastille_day/fieldlines.asset b/data/assets/scene/solarsystem/heliosphere/bastille_day/fieldlines.asset index 14fbe8ff1f..cafd5b822c 100644 --- a/data/assets/scene/solarsystem/heliosphere/bastille_day/fieldlines.asset +++ b/data/assets/scene/solarsystem/heliosphere/bastille_day/fieldlines.asset @@ -50,7 +50,25 @@ local fieldlines = { local toggle_fieldlines = { Identifier = "os.events.bastilleday.fieldlines.togglefieldlines", Name = "Toggle fieldlines", - Command = propertyHelper.invert("Scene.MAS-MHD-Fieldlines-bastille-day-2000.Renderable.Enabled"), + Command = [[ + if openspace.getPropertyValue("Scene.MAS-MHD-Fieldlines-bastille-day-2000.Renderable.Enabled") then + openspace.setPropertyValueSingle( + "Scene.MAS-MHD-Fieldlines-bastille-day-2000.Renderable.Fade", + 0.0, + openspace.getPropertyValue("OpenSpaceEngine.FadeDuration"), + "Linear", + 'openspace.setPropertyValueSingle("Scene.MAS-MHD-Fieldlines-bastille-day-2000.Renderable.Enabled", false)' + ) + else + openspace.setPropertyValueSingle("Scene.MAS-MHD-Fieldlines-bastille-day-2000.Renderable.Enabled", true) + openspace.setPropertyValueSingle( + "Scene.MAS-MHD-Fieldlines-bastille-day-2000.Renderable.Fade", + 1.0, + openspace.getPropertyValue("OpenSpaceEngine.FadeDuration"), + "Linear" + ) + end + ]], Documentation = "Toggle fieldline rendering of CME", GuiPath = "/Bastille-Day 2000", IsLocal = false diff --git a/data/assets/scene/solarsystem/heliosphere/bastille_day/fluxnodes.asset b/data/assets/scene/solarsystem/heliosphere/bastille_day/fluxnodes.asset index b770439465..b2007da61d 100644 --- a/data/assets/scene/solarsystem/heliosphere/bastille_day/fluxnodes.asset +++ b/data/assets/scene/solarsystem/heliosphere/bastille_day/fluxnodes.asset @@ -35,7 +35,25 @@ local fluxNodes = { local toggle_fluxnodes = { Identifier = "os.events.bastilleday.fluxnodes.togglefluxnodes", Name = "Toggle flux nodes", - Command = propertyHelper.invert("Scene.MAS-MHD-FluxNodes-bastille-day-2000.Renderable.Enabled"), + Command = [[ + if openspace.getPropertyValue("Scene.MAS-MHD-FluxNodes-bastille-day-2000.Renderable.Enabled") then + openspace.setPropertyValueSingle( + "Scene.MAS-MHD-FluxNodes-bastille-day-2000.Renderable.Fade", + 0.0, + openspace.getPropertyValue("OpenSpaceEngine.FadeDuration"), + "Linear", + 'openspace.setPropertyValueSingle("Scene.MAS-MHD-FluxNodes-bastille-day-2000.Renderable.Enabled", false)' + ) + else + openspace.setPropertyValueSingle("Scene.MAS-MHD-FluxNodes-bastille-day-2000.Renderable.Enabled", true) + openspace.setPropertyValueSingle( + "Scene.MAS-MHD-FluxNodes-bastille-day-2000.Renderable.Fade", + 1.0, + openspace.getPropertyValue("OpenSpaceEngine.FadeDuration"), + "Linear" + ) + end + ]], Documentation = "Toggle flux node rendering of CME", GuiPath = "/Bastille-Day 2000", IsLocal = false diff --git a/data/assets/scene/solarsystem/heliosphere/bastille_day/fluxnodescutplane.asset b/data/assets/scene/solarsystem/heliosphere/bastille_day/fluxnodescutplane.asset index 62d6bdb192..673c38a54a 100644 --- a/data/assets/scene/solarsystem/heliosphere/bastille_day/fluxnodescutplane.asset +++ b/data/assets/scene/solarsystem/heliosphere/bastille_day/fluxnodescutplane.asset @@ -72,7 +72,25 @@ local MeridialCutplane = { local toggle_equatorial = { Identifier = "os.events.bastilleday.fluxnodescutplane.toggleequatorial", Name = "Toggle equatorial cutplane", - Command = propertyHelper.invert("Scene.EquatorialCutplane-bastille-day-2000.Renderable.Enabled"), + Command = [[ + if openspace.getPropertyValue("Scene.EquatorialCutplane-bastille-day-2000.Renderable.Enabled") then + openspace.setPropertyValueSingle( + "Scene.EquatorialCutplane-bastille-day-2000.Renderable.Fade", + 0.0, + openspace.getPropertyValue("OpenSpaceEngine.FadeDuration"), + "Linear", + 'openspace.setPropertyValueSingle("Scene.EquatorialCutplane-bastille-day-2000.Renderable.Enabled", false)' + ) + else + openspace.setPropertyValueSingle("Scene.EquatorialCutplane-bastille-day-2000.Renderable.Enabled", true) + openspace.setPropertyValueSingle( + "Scene.EquatorialCutplane-bastille-day-2000.Renderable.Fade", + 1.0, + openspace.getPropertyValue("OpenSpaceEngine.FadeDuration"), + "Linear" + ) + end + ]], Documentation = "Toggle equatorial cutplane of CME", GuiPath = "/Bastille-Day 2000", IsLocal = false @@ -80,7 +98,25 @@ local toggle_equatorial = { local toggle_meridial = { Identifier = "os.events.bastilleday.fluxnodescutplane.togglemeridial", Name = "Toggle meridial cutplane", - Command = propertyHelper.invert("Scene.MeridialCutplane-bastille-day-2000.Renderable.Enabled"), + Command = [[ + if openspace.getPropertyValue("Scene.MeridialCutplane-bastille-day-2000.Renderable.Enabled") then + openspace.setPropertyValueSingle( + "Scene.MeridialCutplane-bastille-day-2000.Renderable.Fade", + 0.0, + openspace.getPropertyValue("OpenSpaceEngine.FadeDuration"), + "Linear", + 'openspace.setPropertyValueSingle("Scene.MeridialCutplane-bastille-day-2000.Renderable.Enabled", false)' + ) + else + openspace.setPropertyValueSingle("Scene.MeridialCutplane-bastille-day-2000.Renderable.Enabled", true) + openspace.setPropertyValueSingle( + "Scene.MeridialCutplane-bastille-day-2000.Renderable.Fade", + 1.0, + openspace.getPropertyValue("OpenSpaceEngine.FadeDuration"), + "Linear" + ) + end + ]], Documentation = "Toggle meridial cutplane of CME", GuiPath = "/Bastille-Day 2000", IsLocal = false diff --git a/data/assets/scene/solarsystem/heliosphere/bastille_day/fluxnodeslegend.asset b/data/assets/scene/solarsystem/heliosphere/bastille_day/fluxnodeslegend.asset index 03fa7c43df..ea2f53b555 100644 --- a/data/assets/scene/solarsystem/heliosphere/bastille_day/fluxnodeslegend.asset +++ b/data/assets/scene/solarsystem/heliosphere/bastille_day/fluxnodeslegend.asset @@ -15,23 +15,37 @@ local legend = { CartesianPosition = { 0.677970, 0.0, -1.049180 } } -local show_legend = { - Identifier = "os.events.bastilleday.fluxnodelegend.showlegend", - Name = "Show the legend image", +local toggle_legend = { + Identifier = "os.events.bastilleday.fluxnodelegend.togglelegend", + Name = "Toggle the legend image", Command = [[ - openspace.setPropertyValueSingle("ScreenSpace.LegendFluxNodes-bastille-day-2000.Opacity", 0.0); - openspace.setPropertyValueSingle("ScreenSpace.LegendFluxNodes-bastille-day-2000.Enabled", true); - openspace.setPropertyValueSingle("ScreenSpace.LegendFluxNodes-bastille-day-2000.Opacity", 1.0, 4); + if openspace.getPropertyValue("ScreenSpace.LegendFluxNodes-bastille-day-2000.Enabled") then + openspace.setPropertyValueSingle( + "ScreenSpace.LegendFluxNodes-bastille-day-2000.Fade", + 0.0, + openspace.getPropertyValue("OpenSpaceEngine.FadeDuration"), + "Linear", + 'openspace.setPropertyValueSingle("ScreenSpace.LegendFluxNodes-bastille-day-2000.Enabled", false)' + ) + else + openspace.setPropertyValueSingle("ScreenSpace.LegendFluxNodes-bastille-day-2000.Enabled", true) + openspace.setPropertyValueSingle( + "ScreenSpace.LegendFluxNodes-bastille-day-2000.Fade", + 1.0, + openspace.getPropertyValue("OpenSpaceEngine.FadeDuration"), + "Linear" + ) + end ]], - Documentation = "Show the legend image", + Documentation = "Toggle the legend image", GuiPath = "/Bastille-Day 2000", - IsLocal = false + IsLocal = false } local hide_legend = { Identifier = "os.events.bastilleday.fluxnodelegend.hidelegend", Name = "Hides the legend image", - Command = [[openspace.setPropertyValueSingle("ScreenSpace.LegendFluxNodes-bastille-day-2000.Opacity", 0.0, 2)]], + Command = [[openspace.setPropertyValueSingle("ScreenSpace.LegendFluxNodes-bastille-day-2000.Fade", 0.0, openspace.getPropertyValue("OpenSpaceEngine.FadeDuration"), "Linear", 'openspace.setPropertyValueSingle("ScreenSpace.LegendFluxNodes-bastille-day-2000.Enabled", false)')]], Documentation = "Hides the legend image", GuiPath = "/Bastille-Day 2000", IsLocal = false @@ -41,14 +55,12 @@ asset.onInitialize(function() openspace.addScreenSpaceRenderable(legend) -- These numbers are there to put the legend on the side of the screen. openspace.setPropertyValueSingle("ScreenSpace.LegendFluxNodes-bastille-day-2000.Rotation", { 0.0, 0.0, 0.56652 }); - openspace.action.registerAction(show_legend) - openspace.action.registerAction(hide_legend) + openspace.action.registerAction(toggle_legend) end) asset.onDeinitialize(function () openspace.removeScreenSpaceRenderable(legend) - openspace.action.removeAction(show_legend) - openspace.action.removeAction(hide_legend) + openspace.action.removeAction(toggle_legend) end) asset.meta = { diff --git a/data/assets/scene/solarsystem/sun/EUV_layer.asset b/data/assets/scene/solarsystem/sun/EUV_layer.asset index 31eb818d07..7de9c4a0e3 100644 --- a/data/assets/scene/solarsystem/sun/EUV_layer.asset +++ b/data/assets/scene/solarsystem/sun/EUV_layer.asset @@ -33,7 +33,25 @@ local EUVLayer = { local toggle_EUV_layer = { Identifier = "os.solarsystem.sun.toggleeuv", Name = "Toggle EUV layer", - Command = propertyHelper.invert("Scene.EUV-Layer-bastille-day-2000.Renderable.Enabled"), + Command = [[ + if openspace.getPropertyValue("Scene.EUV-Layer-bastille-day-2000.Renderable.Enabled") then + openspace.setPropertyValueSingle( + "Scene.EUV-Layer-bastille-day-2000.Renderable.Fade", + 0.0, + openspace.getPropertyValue("OpenSpaceEngine.FadeDuration"), + "Linear", + 'openspace.setPropertyValueSingle("Scene.EUV-Layer-bastille-day-2000.Renderable.Enabled", false)' + ) + else + openspace.setPropertyValueSingle("Scene.EUV-Layer-bastille-day-2000.Renderable.Enabled", true) + openspace.setPropertyValueSingle( + "Scene.EUV-Layer-bastille-day-2000.Renderable.Fade", + 1.0, + openspace.getPropertyValue("OpenSpaceEngine.FadeDuration"), + "Linear" + ) + end + ]], Documentation = "Toggle EUV layer of sun", GuiPath = "/Bastille-Day 2000", IsLocal = false