diff --git a/app/node/factory.cpp b/app/node/factory.cpp
index b5e561e50..6080c159a 100644
--- a/app/node/factory.cpp
+++ b/app/node/factory.cpp
@@ -8,6 +8,7 @@
#include "distort/transform/transform.h"
#include "input/media/video/video.h"
#include "input/media/audio/audio.h"
+#include "input/time/timeinput.h"
#include "math/math.h"
#include "output/track/track.h"
#include "output/viewer/viewer.h"
@@ -138,6 +139,8 @@ Node *NodeFactory::CreateInternal(const NodeFactory::InternalID &id)
return new PanNode();
case kMath:
return new MathNode();
+ case kTime:
+ return new TimeInput();
case kInternalNodeCount:
break;
diff --git a/app/node/factory.h b/app/node/factory.h
index 55f204e4d..a0bd892aa 100644
--- a/app/node/factory.h
+++ b/app/node/factory.h
@@ -20,6 +20,7 @@ public:
kAudioVolume,
kAudioPanning,
kMath,
+ kTime,
// Count value
kInternalNodeCount
diff --git a/app/node/input/CMakeLists.txt b/app/node/input/CMakeLists.txt
index eca5ea46f..5f711f39c 100644
--- a/app/node/input/CMakeLists.txt
+++ b/app/node/input/CMakeLists.txt
@@ -15,6 +15,7 @@
# along with this program. If not, see .
add_subdirectory(media)
+add_subdirectory(time)
set(OLIVE_SOURCES
${OLIVE_SOURCES}
diff --git a/app/node/input/time/CMakeLists.txt b/app/node/input/time/CMakeLists.txt
new file mode 100644
index 000000000..0d308d952
--- /dev/null
+++ b/app/node/input/time/CMakeLists.txt
@@ -0,0 +1,22 @@
+# Olive - Non-Linear Video Editor
+# Copyright (C) 2019 Olive Team
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+
+set(OLIVE_SOURCES
+ ${OLIVE_SOURCES}
+ node/input/time/timeinput.h
+ node/input/time/timeinput.cpp
+ PARENT_SCOPE
+)
diff --git a/app/node/input/time/timeinput.cpp b/app/node/input/time/timeinput.cpp
new file mode 100644
index 000000000..12f334ad1
--- /dev/null
+++ b/app/node/input/time/timeinput.cpp
@@ -0,0 +1,41 @@
+#include "timeinput.h"
+
+TimeInput::TimeInput()
+{
+}
+
+Node *TimeInput::copy() const
+{
+ return new TimeInput();
+}
+
+QString TimeInput::Name() const
+{
+ return tr("Time");
+}
+
+QString TimeInput::id() const
+{
+ return QStringLiteral("org.olivevideoeditor.Olive.videoinput");
+}
+
+QString TimeInput::Category() const
+{
+ return tr("Input");
+}
+
+QString TimeInput::Description() const
+{
+ return tr("Generates the time (in seconds) at this frame");
+}
+
+NodeValueTable TimeInput::Value(const NodeValueDatabase &value) const
+{
+ NodeValueTable table = value.Merge();
+
+ table.Push(NodeParam::kFloat,
+ value[QStringLiteral("global")].Get(NodeParam::kFloat, QStringLiteral("time_in")),
+ QStringLiteral("time"));
+
+ return table;
+}
diff --git a/app/node/input/time/timeinput.h b/app/node/input/time/timeinput.h
new file mode 100644
index 000000000..340646e64
--- /dev/null
+++ b/app/node/input/time/timeinput.h
@@ -0,0 +1,23 @@
+#ifndef TIMEINPUT_H
+#define TIMEINPUT_H
+
+#include "node/node.h"
+
+class TimeInput : public Node
+{
+ Q_OBJECT
+public:
+ TimeInput();
+
+ virtual Node* copy() const override;
+
+ virtual QString Name() const override;
+ virtual QString id() const override;
+ virtual QString Category() const override;
+ virtual QString Description() const override;
+
+ virtual NodeValueTable Value(const NodeValueDatabase& value) const override;
+
+};
+
+#endif // TIMEINPUT_H
diff --git a/app/node/traverser.cpp b/app/node/traverser.cpp
index fb3f28239..ea601312f 100644
--- a/app/node/traverser.cpp
+++ b/app/node/traverser.cpp
@@ -29,6 +29,12 @@ NodeValueDatabase NodeTraverser::GenerateDatabase(const Node* node, const TimeRa
}
}
+ // Insert global variables
+ NodeValueTable global;
+ global.Push(NodeParam::kFloat, range.in().toDouble(), QStringLiteral("time_in"));
+ global.Push(NodeParam::kFloat, range.out().toDouble(), QStringLiteral("time_out"));
+ database.Insert(QStringLiteral("global"), global);
+
return database;
}