began work setting several timings to use rational rather than long/double

This commit is contained in:
itsmattkc
2019-06-16 15:13:53 -07:00
parent 0acee942f4
commit 771572f65b
63 changed files with 448 additions and 397 deletions
+1 -1
View File
@@ -10,7 +10,7 @@ BoolInput::BoolInput(Node *parent, const QString& id, const QString& name, bool
AddAcceptedNodeInput(olive::nodes::kBoolean);
}
bool BoolInput::GetBoolAt(double timecode)
bool BoolInput::GetBoolAt(const rational& timecode)
{
return static_cast<BoolField*>(Field(0))->GetBoolAt(timecode);
}
+1 -1
View File
@@ -22,7 +22,7 @@ public:
*
* The boolean value at this timecode
*/
bool GetBoolAt(double timecode);
bool GetBoolAt(const rational &timecode);
signals:
/**
+1 -1
View File
@@ -8,7 +8,7 @@ ColorInput::ColorInput(Node *parent, const QString& id, const QString& name, boo
AddAcceptedNodeInput(olive::nodes::kColor);
}
QColor ColorInput::GetColorAt(double timecode)
QColor ColorInput::GetColorAt(const rational& timecode)
{
return static_cast<ColorField*>(Field(0))->GetColorAt(timecode);
}
+1 -1
View File
@@ -22,7 +22,7 @@ public:
*
* The color value at this timecode
*/
QColor GetColorAt(double timecode);
QColor GetColorAt(const rational &timecode);
};
#endif // COLORINPUT_H
+1 -1
View File
@@ -8,7 +8,7 @@ FontInput::FontInput(Node *parent, const QString& id, const QString& name, bool
AddAcceptedNodeInput(olive::nodes::kFont);
}
QString FontInput::GetFontAt(double timecode)
QString FontInput::GetFontAt(const rational& timecode)
{
return static_cast<FontField*>(Field(0))->GetFontAt(timecode);
}
+1 -1
View File
@@ -22,7 +22,7 @@ public:
*
* The font family name at this timecode
*/
QString GetFontAt(double timecode);
QString GetFontAt(const rational &timecode);
};
#endif // FONTINPUT_H
+1 -1
View File
@@ -8,7 +8,7 @@ StringInput::StringInput(Node *parent, const QString& id, const QString& name, b
AddAcceptedNodeInput(olive::nodes::kString);
}
QString StringInput::GetStringAt(double timecode)
QString StringInput::GetStringAt(const rational& timecode)
{
return static_cast<StringField*>(Field(0))->GetStringAt(timecode);
}
+1 -1
View File
@@ -27,7 +27,7 @@ public:
*
* The string at this timecode
*/
QString GetStringAt(double timecode);
QString GetStringAt(const rational &timecode);
};
#endif // STRINGINPUT_H
+10 -10
View File
@@ -84,7 +84,7 @@ DoubleInput::DoubleInput(Node *parent, const QString &id, const QString &name, b
{
}
double DoubleInput::GetDoubleAt(double timecode)
double DoubleInput::GetDoubleAt(const rational& timecode)
{
return static_cast<DoubleField*>(Field(0))->GetDoubleAt(timecode);
}
@@ -94,12 +94,12 @@ Vec2Input::Vec2Input(Node *parent, const QString &id, const QString &name, bool
{
}
QVector2D Vec2Input::GetVector2DAt(double timecode)
QVector2D Vec2Input::GetVector2DAt(const rational &timecode)
{
return GetValueAt(timecode).value<QVector2D>();
}
QVariant Vec2Input::GetValueAt(double timecode)
QVariant Vec2Input::GetValueAt(const rational &timecode)
{
QVector2D vec2;
vec2.setX(static_cast<DoubleField*>(Field(0))->GetDoubleAt(timecode));
@@ -113,7 +113,7 @@ QVariant Vec2Input::GetValueAt(double timecode)
return vec2;
}
void Vec2Input::SetValueAt(double timecode, const QVariant &value)
void Vec2Input::SetValueAt(const rational &timecode, const QVariant &value)
{
QVector2D vec2 = value.value<QVector2D>();
@@ -126,12 +126,12 @@ Vec3Input::Vec3Input(Node *parent, const QString &id, const QString &name, bool
{
}
QVector3D Vec3Input::GetVector3DAt(double timecode)
QVector3D Vec3Input::GetVector3DAt(const rational &timecode)
{
return GetValueAt(timecode).value<QVector3D>();
}
QVariant Vec3Input::GetValueAt(double timecode)
QVariant Vec3Input::GetValueAt(const rational &timecode)
{
QVector3D vec3;
vec3.setX(static_cast<DoubleField*>(Field(0))->GetDoubleAt(timecode));
@@ -147,7 +147,7 @@ QVariant Vec3Input::GetValueAt(double timecode)
return vec3;
}
void Vec3Input::SetValueAt(double timecode, const QVariant &value)
void Vec3Input::SetValueAt(const rational &timecode, const QVariant &value)
{
QVector3D vec3 = value.value<QVector3D>();
@@ -161,12 +161,12 @@ Vec4Input::Vec4Input(Node *parent, const QString &id, const QString &name, bool
{
}
QVector4D Vec4Input::GetVector4DAt(double timecode)
QVector4D Vec4Input::GetVector4DAt(const rational &timecode)
{
return GetValueAt(timecode).value<QVector4D>();
}
QVariant Vec4Input::GetValueAt(double timecode)
QVariant Vec4Input::GetValueAt(const rational &timecode)
{
QVector4D vec4;
vec4.setX(static_cast<DoubleField*>(Field(0))->GetDoubleAt(timecode));
@@ -184,7 +184,7 @@ QVariant Vec4Input::GetValueAt(double timecode)
return vec4;
}
void Vec4Input::SetValueAt(double timecode, const QVariant &value)
void Vec4Input::SetValueAt(const rational &timecode, const QVariant &value)
{
QVector4D vec4 = value.value<QVector4D>();
+10 -10
View File
@@ -45,34 +45,34 @@ class DoubleInput : public VecInput
public:
DoubleInput(Node* parent, const QString& id, const QString& name, bool savable = true, bool keyframable = true);
double GetDoubleAt(double timecode);
double GetDoubleAt(const rational &timecode);
};
class Vec2Input : public VecInput {
public:
Vec2Input(Node* parent, const QString& id, const QString& name, bool savable = true, bool keyframable = true);
QVector2D GetVector2DAt(double timecode);
virtual QVariant GetValueAt(double timecode) override;
virtual void SetValueAt(double timecode, const QVariant &value) override;
QVector2D GetVector2DAt(const rational& timecode);
virtual QVariant GetValueAt(const rational& timecode) override;
virtual void SetValueAt(const rational& timecode, const QVariant &value) override;
};
class Vec3Input : public VecInput {
public:
Vec3Input(Node* parent, const QString& id, const QString& name, bool savable = true, bool keyframable = true);
QVector3D GetVector3DAt(double timecode);
virtual QVariant GetValueAt(double timecode) override;
virtual void SetValueAt(double timecode, const QVariant &value) override;
QVector3D GetVector3DAt(const rational& timecode);
virtual QVariant GetValueAt(const rational& timecode) override;
virtual void SetValueAt(const rational& timecode, const QVariant &value) override;
};
class Vec4Input : public VecInput {
public:
Vec4Input(Node* parent, const QString& id, const QString& name, bool savable = true, bool keyframable = true);
QVector4D GetVector4DAt(double timecode);
virtual QVariant GetValueAt(double timecode) override;
virtual void SetValueAt(double timecode, const QVariant &value) override;
QVector4D GetVector4DAt(const rational& timecode);
virtual QVariant GetValueAt(const rational& timecode) override;
virtual void SetValueAt(const rational& timecode, const QVariant &value) override;
};
#endif // VEC2INPUT_H
+1 -1
View File
@@ -38,7 +38,7 @@ int Node::ParameterCount()
return parameters_.size();
}
double Node::Time()
const rational& Node::Time()
{
return 0;
}
+1 -1
View File
@@ -22,7 +22,7 @@ public:
NodeIO* Parameter(int i);
int ParameterCount();
double Time();
const rational &Time();
NodeGraph* ParentGraph();
+2 -2
View File
@@ -141,7 +141,7 @@ QVariant NodeIO::GetValue()
return GetValueAt(0);
}
QVariant NodeIO::GetValueAt(double timecode)
QVariant NodeIO::GetValueAt(const rational& timecode)
{
if (FieldCount() == 0) {
return data_;
@@ -157,7 +157,7 @@ void NodeIO::SetValue(const QVariant &value)
SetValueAt(0, value);
}
void NodeIO::SetValueAt(double timecode, const QVariant &value)
void NodeIO::SetValueAt(const rational &timecode, const QVariant &value)
{
if (FieldCount() == 0) {
data_ = value;
+3 -2
View File
@@ -36,6 +36,7 @@ class ClickableLabel;
#include "effects/effectfields.h"
#include "nodes/nodeedge.h"
#include "global/rational.h"
/**
* @brief The EffectRow class
@@ -201,7 +202,7 @@ public:
*
* The value of the first EffectField at the given timecode
*/
virtual QVariant GetValueAt(double timecode);
virtual QVariant GetValueAt(const rational &timecode);
/**
* @brief Set value
@@ -230,7 +231,7 @@ public:
*
* Value to set at this timecode
*/
virtual void SetValueAt(double timecode, const QVariant& value);
virtual void SetValueAt(const rational& timecode, const QVariant& value);
/**
* @brief Sets the enabled state on all EffectField objects on this row to enabled
+2 -12
View File
@@ -796,17 +796,7 @@ bool OldEffectNode::are_gizmos_enabled() {
return (gizmos.size() > 0);
}
double OldEffectNode::Now()
{
return playhead_to_clip_seconds(parent_clip, parent_clip->track()->sequence()->playhead);
}
long OldEffectNode::NowInFrames()
{
return playhead_to_clip_frame(parent_clip, parent_clip->track()->sequence()->playhead);
}
void OldEffectNode::redraw(double) {
void OldEffectNode::redraw(const rational &) {
/*
// run javascript
QPainter p(&img);
@@ -850,7 +840,7 @@ void OldEffectNode::redraw(double) {
*/
}
bool OldEffectNode::valueHasChanged(double timecode) {
bool OldEffectNode::valueHasChanged(const rational &timecode) {
if (cachedValues.isEmpty()) {
for (int i=0;i<ParameterCount();i++) {
+2 -26
View File
@@ -179,30 +179,6 @@ public:
void gizmo_world_to_screen(const QMatrix4x4 &matrix, const QMatrix4x4 &projection);
bool are_gizmos_enabled();
/**
* @brief Get the current clip/media time
*
* A convenience function that can be plugged into GetValueAt() to get the value wherever the appropriate Sequence's
* playhead it.
*
* @return
*
* Current clip/media time in seconds.
*/
double Now();
/**
* @brief Retrieve the current clip as a frame number
*
* Same as Now() but retrieves the value as a frame number (in the appropriate Sequence's frame rate) instead of
* seconds.
*
* @return
*
* The current clip time in frames
*/
long NowInFrames();
template <typename T>
T randomNumber()
{
@@ -267,8 +243,8 @@ private:
// superimpose functions
virtual void redraw(double timecode);
bool valueHasChanged(double timecode);
virtual void redraw(const rational& timecode);
bool valueHasChanged(const rational& timecode);
QVector<QVariant> cachedValues;
void delete_texture();
void validate_meta_path();