Add action to play timelapse in reverse

This commit is contained in:
Malin E
2021-10-06 13:05:14 +02:00
parent 19e936ea18
commit 26101b66cc
5 changed files with 39 additions and 1 deletions

View File

@@ -266,6 +266,24 @@ local playForwards = {
IsLocal = false
}
local playBackwards = {
Identifier = "jwst.play.backwards",
Name = "Play JWST in reverse",
Command = [[
openspace.scriptScheduler.clear();
openspace.time.setDeltaTime(-1);
openspace.time.setTime('2018 OCT 16 09:06:04');
]] .. tostring(timelaps) .. [[
openspace.scriptScheduler.loadScheduledScript(
"2018 OCT 01 14:06:02",
"openspace.scriptScheduler.clear()"
)
]],
Documentation = "Jump to the end of JWST deployment time and play the timelaps of deployment in reverse",
GuiPath = "/JWST",
IsLocal = false
}
local clearPlay = {
Identifier = "jwst.play.clear",
Name = "Clear JWST timelaps",
@@ -285,6 +303,7 @@ local clearPlay = {
asset.onInitialize(function()
openspace.action.registerAction(playForwards)
openspace.action.registerAction(playBackwards)
openspace.action.registerAction(clearPlay)
end)

View File

@@ -59,7 +59,7 @@
{
"documentation": "Toggle all planet and moon trails, except the Moon",
"gui_path": "/JWST",
"identifier": "profile.toggel.trails_not_moon",
"identifier": "profile.toggle.trails_not_moon",
"is_local": false,
"name": "Toggle trails (except Moon)",
"script": "local list = openspace.getProperty('{planetTrail_solarSystem}.Renderable.Enabled'); for _,v in pairs(list) do openspace.setPropertyValueSingle(v, not openspace.getPropertyValue(v)) end local moonlist = openspace.getProperty('{moonTrail_solarSystem}.Renderable.Enabled') for _,v in pairs(moonlist) do openspace.setPropertyValueSingle(v, not openspace.getPropertyValue(v)) end openspace.setPropertyValueSingle('Scene.MoonTrail.Renderable.Enabled', true)"
@@ -152,9 +152,17 @@
"action": "jwst.play.forwards",
"key": "M"
},
{
"action": "jwst.play.backwards",
"key": "N"
},
{
"action": "jwst.play.clear",
"key": "B"
},
{
"action": "profile.toggle.trails_not_moon",
"key": "G"
}
],
"mark_nodes": [

View File

@@ -110,6 +110,11 @@ public:
*/
double currentTime() const;
/**
* Updates the current time to the given j2000 time value
*/
void setCurrentTime(double time);
/**
* \returns a vector of all scripts that has been loaded
*/

View File

@@ -213,6 +213,10 @@ double ScriptScheduler::currentTime() const {
return _currentTime;
}
void ScriptScheduler::setCurrentTime(double time) {
_currentTime = time;
}
std::vector<ScriptScheduler::ScheduledScript> ScriptScheduler::allScripts() const {
std::vector<ScheduledScript> result;
for (size_t i = 0; i < _timings.size(); ++i) {

View File

@@ -30,6 +30,7 @@
#include <openspace/interaction/keybindingmanager.h>
#include <openspace/interaction/sessionrecording.h>
#include <openspace/network/parallelpeer.h>
#include <openspace/scripting/scriptscheduler.h>
#include <openspace/util/keys.h>
#include <openspace/util/timeline.h>
#include <ghoul/logging/logmanager.h>
@@ -405,6 +406,7 @@ void TimeManager::setTimeNextFrame(Time t) {
_shouldSetTime = true;
_timeNextFrame = std::move(t);
clearKeyframes();
global::scriptScheduler->setCurrentTime(t.j2000Seconds());
}
void TimeManager::setDeltaTime(double deltaTime) {