began work setting several timings to use rational rather than long/double
This commit is contained in:
+38
-29
@@ -65,9 +65,9 @@ QString EffectField::ConvertValueToString(const QVariant &v)
|
||||
return v.toString();
|
||||
}
|
||||
|
||||
void EffectField::UpdateWidgetValue(QWidget *, double) {}
|
||||
void EffectField::UpdateWidgetValue(QWidget *, const rational &) {}
|
||||
|
||||
QVariant EffectField::GetValueAt(double timecode)
|
||||
QVariant EffectField::GetValueAt(const rational& timecode)
|
||||
{
|
||||
if (HasKeyframes()) {
|
||||
int before_keyframe;
|
||||
@@ -96,15 +96,19 @@ QVariant EffectField::GetValueAt(double timecode)
|
||||
|
||||
} else if (before_key.type == EFFECT_KEYFRAME_BEZIER || after_key.type == EFFECT_KEYFRAME_BEZIER) {
|
||||
|
||||
double timecode_dbl = timecode.ToDouble();
|
||||
double before_time_dbl = before_key.time.ToDouble();
|
||||
double after_time_dbl = after_key.time.ToDouble();
|
||||
|
||||
// bezier interpolation
|
||||
if (before_key.type == EFFECT_KEYFRAME_BEZIER && after_key.type == EFFECT_KEYFRAME_BEZIER) {
|
||||
|
||||
// cubic bezier
|
||||
double t = cubic_t_from_x(timecode,
|
||||
before_key.time,
|
||||
before_key.time+GetValidKeyframeHandlePosition(before_keyframe, true),
|
||||
after_key.time+GetValidKeyframeHandlePosition(after_keyframe, false),
|
||||
after_key.time);
|
||||
double t = cubic_t_from_x(timecode_dbl,
|
||||
before_time_dbl,
|
||||
before_time_dbl+GetValidKeyframeHandlePosition(before_keyframe, true),
|
||||
after_time_dbl+GetValidKeyframeHandlePosition(after_keyframe, false),
|
||||
after_time_dbl);
|
||||
|
||||
value = cubic_from_t(before_dbl,
|
||||
before_dbl+before_key.post_handle.y(),
|
||||
@@ -115,10 +119,10 @@ QVariant EffectField::GetValueAt(double timecode)
|
||||
} else if (after_key.type == EFFECT_KEYFRAME_LINEAR) { // quadratic bezier
|
||||
|
||||
// last keyframe is the bezier one
|
||||
double t = quad_t_from_x(timecode,
|
||||
before_key.time,
|
||||
before_key.time+GetValidKeyframeHandlePosition(before_keyframe, true),
|
||||
after_key.time);
|
||||
double t = quad_t_from_x(timecode_dbl,
|
||||
before_time_dbl,
|
||||
before_time_dbl+GetValidKeyframeHandlePosition(before_keyframe, true),
|
||||
after_time_dbl);
|
||||
|
||||
value = quad_from_t(before_dbl,
|
||||
before_dbl+before_key.post_handle.y(),
|
||||
@@ -127,10 +131,10 @@ QVariant EffectField::GetValueAt(double timecode)
|
||||
|
||||
} else {
|
||||
// this keyframe is the bezier one
|
||||
double t = quad_t_from_x(timecode,
|
||||
before_key.time,
|
||||
after_key.time+GetValidKeyframeHandlePosition(after_keyframe, false),
|
||||
after_key.time);
|
||||
double t = quad_t_from_x(timecode_dbl,
|
||||
before_time_dbl,
|
||||
after_time_dbl+GetValidKeyframeHandlePosition(after_keyframe, false),
|
||||
after_time_dbl);
|
||||
|
||||
value = quad_from_t(before_dbl,
|
||||
after_dbl+after_key.pre_handle.y(),
|
||||
@@ -177,7 +181,7 @@ QVariant EffectField::GetValueAt(double timecode)
|
||||
return persistent_data_;
|
||||
}
|
||||
|
||||
void EffectField::SetValueAt(double time, const QVariant &value)
|
||||
void EffectField::SetValueAt(const rational &time, const QVariant &value)
|
||||
{
|
||||
if (HasKeyframes()) {
|
||||
|
||||
@@ -186,7 +190,7 @@ void EffectField::SetValueAt(double time, const QVariant &value)
|
||||
// Check array if a keyframe at this time already exists
|
||||
int keyframe_index = -1;
|
||||
for (int i=0;i<keyframes.size();i++) {
|
||||
if (qFuzzyCompare(keyframes.at(i).time, time)) {
|
||||
if (keyframes.at(i).time == time) {
|
||||
keyframe_index = i;
|
||||
break;
|
||||
}
|
||||
@@ -256,7 +260,7 @@ double EffectField::GetValidKeyframeHandlePosition(int key, bool post) {
|
||||
if (i != key
|
||||
&& ((keyframes.at(i).time > keyframes.at(key).time) == post)
|
||||
&& (comp_key == -1
|
||||
|| ((keyframes.at(i).time < keyframes.at(comp_key).time) == post))) {
|
||||
|| ((keyframes.at(i).time < keyframes.at(comp_key).time) == post))) {
|
||||
// compare with next keyframe for post or previous frame for pre
|
||||
comp_key = i;
|
||||
}
|
||||
@@ -269,7 +273,7 @@ double EffectField::GetValidKeyframeHandlePosition(int key, bool post) {
|
||||
return adjusted_key;
|
||||
}
|
||||
|
||||
double comp = keyframes.at(comp_key).time - keyframes.at(key).time;
|
||||
double comp = keyframes.at(comp_key).time.ToDouble() - keyframes.at(key).time.ToDouble();
|
||||
|
||||
// if comp keyframe is bezier, validate with its accompanying handle
|
||||
if (keyframes.at(comp_key).type == EFFECT_KEYFRAME_BEZIER) {
|
||||
@@ -294,24 +298,29 @@ double EffectField::GetValidKeyframeHandlePosition(int key, bool post) {
|
||||
return adjusted_key;
|
||||
}
|
||||
|
||||
void EffectField::GetKeyframeData(double timecode, int &before, int &after, double &progress) {
|
||||
void EffectField::GetKeyframeData(const rational& timecode, int &before, int &after, double &progress) {
|
||||
int before_keyframe_index = -1;
|
||||
int after_keyframe_index = -1;
|
||||
double before_keyframe_time = DBL_MIN;
|
||||
double after_keyframe_time = DBL_MAX;
|
||||
|
||||
for (int i=0;i<keyframes.size();i++) {
|
||||
double eval_keyframe_time = keyframes.at(i).time;
|
||||
if (qFuzzyCompare(eval_keyframe_time, timecode)) {
|
||||
const rational& eval_keyframe_time = keyframes.at(i).time;
|
||||
if (eval_keyframe_time == timecode) {
|
||||
before = i;
|
||||
after = i;
|
||||
return;
|
||||
} else if (eval_keyframe_time < timecode && eval_keyframe_time > before_keyframe_time) {
|
||||
before_keyframe_index = i;
|
||||
before_keyframe_time = eval_keyframe_time;
|
||||
} else if (eval_keyframe_time > timecode && eval_keyframe_time < after_keyframe_time) {
|
||||
after_keyframe_index = i;
|
||||
after_keyframe_time = eval_keyframe_time;
|
||||
} else {
|
||||
|
||||
double eval_keyframe_dbl = eval_keyframe_time.ToDouble();
|
||||
|
||||
if (eval_keyframe_time < timecode && eval_keyframe_dbl > before_keyframe_time) {
|
||||
before_keyframe_index = i;
|
||||
before_keyframe_time = eval_keyframe_dbl;
|
||||
} else if (eval_keyframe_time > timecode && eval_keyframe_dbl < after_keyframe_time) {
|
||||
after_keyframe_index = i;
|
||||
after_keyframe_time = eval_keyframe_dbl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -320,7 +329,7 @@ void EffectField::GetKeyframeData(double timecode, int &before, int &after, doub
|
||||
// interpolate
|
||||
before = before_keyframe_index;
|
||||
after = after_keyframe_index;
|
||||
progress = (timecode-before_keyframe_time)/(after_keyframe_time-before_keyframe_time);
|
||||
progress = (timecode.ToDouble()-before_keyframe_time)/(after_keyframe_time-before_keyframe_time);
|
||||
} else if (before_keyframe_index > -1) {
|
||||
before = before_keyframe_index;
|
||||
after = before_keyframe_index;
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "effects/keyframe.h"
|
||||
#include "undo/undostack.h"
|
||||
#include "nodes/nodedatatypes.h"
|
||||
#include "global/rational.h"
|
||||
|
||||
class NodeIO;
|
||||
class ComboAction;
|
||||
@@ -151,7 +152,7 @@ public:
|
||||
*
|
||||
* A QVariant representation of the value at the given timecode.
|
||||
*/
|
||||
QVariant GetValueAt(double timecode);
|
||||
QVariant GetValueAt(const rational &timecode);
|
||||
|
||||
/**
|
||||
* @brief Set the value of this field at a given timecode
|
||||
@@ -176,7 +177,7 @@ public:
|
||||
*
|
||||
* The QVariant value to set at this time.
|
||||
*/
|
||||
void SetValueAt(double time, const QVariant& value);
|
||||
void SetValueAt(const rational& time, const QVariant& value);
|
||||
|
||||
/**
|
||||
* @brief Set up keyframing on this field
|
||||
@@ -285,7 +286,7 @@ public:
|
||||
*
|
||||
* The time in clip/media seconds to retrieve data from.
|
||||
*/
|
||||
virtual void UpdateWidgetValue(QWidget* widget, double timecode);
|
||||
virtual void UpdateWidgetValue(QWidget* widget, const rational& timecode);
|
||||
|
||||
/**
|
||||
* @brief Get the correct X position/time value of a bezier keyframe's handles
|
||||
@@ -408,7 +409,7 @@ private:
|
||||
*
|
||||
* The progress between the `before` keyframe and `after` keyframe from 0.0 to 1.0.
|
||||
*/
|
||||
void GetKeyframeData(double timecode, int& before, int& after, double& d);
|
||||
void GetKeyframeData(const rational &timecode, int& before, int& after, double& d);
|
||||
|
||||
/**
|
||||
* @brief Internal enabled value
|
||||
|
||||
@@ -29,7 +29,7 @@ BoolField::BoolField(NodeIO *parent) :
|
||||
EffectField(parent, EffectField::EFFECT_FIELD_BOOL)
|
||||
{}
|
||||
|
||||
bool BoolField::GetBoolAt(double timecode)
|
||||
bool BoolField::GetBoolAt(const rational &timecode)
|
||||
{
|
||||
return GetValueAt(timecode).toBool();
|
||||
}
|
||||
@@ -56,7 +56,7 @@ QWidget *BoolField::CreateWidget(QWidget *existing)
|
||||
return cb;
|
||||
}
|
||||
|
||||
void BoolField::UpdateWidgetValue(QWidget *widget, double timecode)
|
||||
void BoolField::UpdateWidgetValue(QWidget *widget, const rational &timecode)
|
||||
{
|
||||
QCheckBox* cb = static_cast<QCheckBox*>(widget);
|
||||
|
||||
@@ -65,13 +65,8 @@ void BoolField::UpdateWidgetValue(QWidget *widget, double timecode)
|
||||
|
||||
cb->blockSignals(true);
|
||||
|
||||
if (qIsNaN(timecode)) {
|
||||
cb->setTristate(true);
|
||||
cb->setCheckState(Qt::PartiallyChecked);
|
||||
} else {
|
||||
cb->setTristate(false);
|
||||
cb->setChecked(GetBoolAt(timecode));
|
||||
}
|
||||
cb->setTristate(false);
|
||||
cb->setChecked(GetBoolAt(timecode));
|
||||
|
||||
cb->blockSignals(false);
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ public:
|
||||
*
|
||||
* The boolean value at this timecode
|
||||
*/
|
||||
bool GetBoolAt(double timecode);
|
||||
bool GetBoolAt(const rational& timecode);
|
||||
|
||||
/**
|
||||
* @brief Reimplementation of EffectField::CreateWidget()
|
||||
@@ -62,7 +62,7 @@ public:
|
||||
/**
|
||||
* @brief Reimplementation of EffectField::UpdateWidgetValue()
|
||||
*/
|
||||
virtual void UpdateWidgetValue(QWidget* widget, double timecode) override;
|
||||
virtual void UpdateWidgetValue(QWidget* widget, const rational& timecode) override;
|
||||
|
||||
/**
|
||||
* @brief Reimplementation of EffectField::ConvertStringToValue()
|
||||
|
||||
@@ -30,7 +30,7 @@ ColorField::ColorField(NodeIO* parent) :
|
||||
EffectField(parent, EffectField::EFFECT_FIELD_COLOR)
|
||||
{}
|
||||
|
||||
QColor ColorField::GetColorAt(double timecode)
|
||||
QColor ColorField::GetColorAt(const rational& timecode)
|
||||
{
|
||||
return GetValueAt(timecode).value<QColor>();
|
||||
}
|
||||
@@ -45,7 +45,7 @@ QWidget *ColorField::CreateWidget(QWidget *existing)
|
||||
return cb;
|
||||
}
|
||||
|
||||
void ColorField::UpdateWidgetValue(QWidget *widget, double timecode)
|
||||
void ColorField::UpdateWidgetValue(QWidget *widget, const rational &timecode)
|
||||
{
|
||||
ColorButton* cb = static_cast<ColorButton*>(widget);
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ public:
|
||||
*
|
||||
* The color value at this timecode
|
||||
*/
|
||||
QColor GetColorAt(double timecode);
|
||||
QColor GetColorAt(const rational &timecode);
|
||||
|
||||
/**
|
||||
* @brief CreateWidget
|
||||
@@ -62,7 +62,7 @@ public:
|
||||
/**
|
||||
* @brief Reimplementation of EffectField::UpdateWidgetValue()
|
||||
*/
|
||||
virtual void UpdateWidgetValue(QWidget* widget, double timecode) override;
|
||||
virtual void UpdateWidgetValue(QWidget* widget, const rational& timecode) override;
|
||||
|
||||
/**
|
||||
* @brief Reimplementation of EffectField::ConvertStringToValue()
|
||||
|
||||
@@ -62,7 +62,7 @@ QWidget *ComboField::CreateWidget(QWidget *existing)
|
||||
return cb;
|
||||
}
|
||||
|
||||
void ComboField::UpdateWidgetValue(QWidget *widget, double timecode)
|
||||
void ComboField::UpdateWidgetValue(QWidget *widget, const rational &timecode)
|
||||
{
|
||||
QVariant data = GetValueAt(timecode);
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ public:
|
||||
/**
|
||||
* @brief Reimplementation of EffectField::UpdateWidgetValue()
|
||||
*/
|
||||
virtual void UpdateWidgetValue(QWidget* widget, double timecode) override;
|
||||
virtual void UpdateWidgetValue(QWidget* widget, const rational& timecode) override;
|
||||
|
||||
signals:
|
||||
/**
|
||||
|
||||
@@ -36,7 +36,7 @@ DoubleField::DoubleField(NodeIO* parent) :
|
||||
connect(this, SIGNAL(Changed()), this, SLOT(ValueHasBeenSet()), Qt::DirectConnection);
|
||||
}
|
||||
|
||||
double DoubleField::GetDoubleAt(double timecode)
|
||||
double DoubleField::GetDoubleAt(const rational& timecode)
|
||||
{
|
||||
return GetValueAt(timecode).toDouble();
|
||||
}
|
||||
@@ -117,13 +117,13 @@ QWidget *DoubleField::CreateWidget(QWidget *existing)
|
||||
return ls;
|
||||
}
|
||||
|
||||
void DoubleField::UpdateWidgetValue(QWidget *widget, double timecode)
|
||||
void DoubleField::UpdateWidgetValue(QWidget *widget, const rational &timecode)
|
||||
{
|
||||
if (qIsNaN(timecode)) {
|
||||
static_cast<LabelSlider*>(widget)->SetValue(qSNaN());
|
||||
} else {
|
||||
//if (qIsNaN(timecode)) {
|
||||
//static_cast<LabelSlider*>(widget)->SetValue(qSNaN());
|
||||
//} else {
|
||||
static_cast<LabelSlider*>(widget)->SetValue(GetDoubleAt(timecode));
|
||||
}
|
||||
//}
|
||||
}
|
||||
|
||||
void DoubleField::ValueHasBeenSet()
|
||||
|
||||
@@ -54,7 +54,7 @@ public:
|
||||
*
|
||||
* Double value at the set timecode
|
||||
*/
|
||||
double GetDoubleAt(double timecode);
|
||||
double GetDoubleAt(const rational &timecode);
|
||||
|
||||
/**
|
||||
* @brief Sets the minimum allowed number for the user to set to `minimum`.
|
||||
@@ -103,7 +103,7 @@ public:
|
||||
/**
|
||||
* @brief Reimplementation of EffectField::UpdateWidgetValue()
|
||||
*/
|
||||
virtual void UpdateWidgetValue(QWidget* widget, double timecode) override;
|
||||
virtual void UpdateWidgetValue(QWidget* widget, const rational& timecode) override;
|
||||
signals:
|
||||
/**
|
||||
* @brief Signal emitted when the field's maximum value has changed
|
||||
|
||||
@@ -33,7 +33,7 @@ FileField::FileField(NodeIO* parent) :
|
||||
SetValueAt(0, "");
|
||||
}
|
||||
|
||||
QString FileField::GetFileAt(double timecode)
|
||||
QString FileField::GetFileAt(const rational& timecode)
|
||||
{
|
||||
return GetValueAt(timecode).toString();
|
||||
}
|
||||
@@ -48,7 +48,7 @@ QWidget *FileField::CreateWidget(QWidget *existing)
|
||||
return efc;
|
||||
}
|
||||
|
||||
void FileField::UpdateWidgetValue(QWidget *widget, double timecode)
|
||||
void FileField::UpdateWidgetValue(QWidget *widget, const rational &timecode)
|
||||
{
|
||||
EmbeddedFileChooser* efc = static_cast<EmbeddedFileChooser*>(widget);
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ public:
|
||||
*
|
||||
* The filename at this timecode
|
||||
*/
|
||||
QString GetFileAt(double timecode);
|
||||
QString GetFileAt(const rational &timecode);
|
||||
|
||||
/**
|
||||
* @brief Reimplementation of EffectField::CreateWidget()
|
||||
@@ -63,7 +63,7 @@ public:
|
||||
/**
|
||||
* @brief Reimplementation of EffectField::UpdateWidgetValue()
|
||||
*/
|
||||
virtual void UpdateWidgetValue(QWidget *widget, double timecode) override;
|
||||
virtual void UpdateWidgetValue(QWidget *widget, const rational& timecode) override;
|
||||
private slots:
|
||||
/**
|
||||
* @brief Internal function connected to any QWidget made from CreateWidget() to update the value based on user input
|
||||
|
||||
@@ -37,7 +37,7 @@ FontField::FontField(NodeIO* parent) :
|
||||
SetValueAt(0, font_list.first());
|
||||
}
|
||||
|
||||
QString FontField::GetFontAt(double timecode)
|
||||
QString FontField::GetFontAt(const rational& timecode)
|
||||
{
|
||||
return GetValueAt(timecode).toString();
|
||||
}
|
||||
@@ -66,7 +66,7 @@ QWidget *FontField::CreateWidget(QWidget *existing)
|
||||
return fcb;
|
||||
}
|
||||
|
||||
void FontField::UpdateWidgetValue(QWidget *widget, double timecode)
|
||||
void FontField::UpdateWidgetValue(QWidget *widget, const rational &timecode)
|
||||
{
|
||||
QVariant data = GetValueAt(timecode);
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ public:
|
||||
*
|
||||
* The font family name at this timecode
|
||||
*/
|
||||
QString GetFontAt(double timecode);
|
||||
QString GetFontAt(const rational &timecode);
|
||||
|
||||
/**
|
||||
* @brief Reimplementation of EffectField::CreateWidget()
|
||||
@@ -64,7 +64,7 @@ public:
|
||||
/**
|
||||
* @brief Reimplementation of EffectField::UpdateWidgetValue()
|
||||
*/
|
||||
virtual void UpdateWidgetValue(QWidget* widget, double timecode) override;
|
||||
virtual void UpdateWidgetValue(QWidget* widget, const rational& timecode) override;
|
||||
|
||||
private:
|
||||
/**
|
||||
|
||||
@@ -36,7 +36,7 @@ StringField::StringField(NodeIO* parent, bool rich_text) :
|
||||
SetValueAt(0, "");
|
||||
}
|
||||
|
||||
QString StringField::GetStringAt(double timecode)
|
||||
QString StringField::GetStringAt(const rational& timecode)
|
||||
{
|
||||
return GetValueAt(timecode).toString();
|
||||
}
|
||||
@@ -69,7 +69,7 @@ QWidget *StringField::CreateWidget(QWidget *existing)
|
||||
return text_edit;
|
||||
}
|
||||
|
||||
void StringField::UpdateWidgetValue(QWidget *widget, double timecode)
|
||||
void StringField::UpdateWidgetValue(QWidget *widget, const rational &timecode)
|
||||
{
|
||||
TextEditEx* text = static_cast<TextEditEx*>(widget);
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ public:
|
||||
*
|
||||
* The string at this timecode
|
||||
*/
|
||||
QString GetStringAt(double timecode);
|
||||
QString GetStringAt(const rational &timecode);
|
||||
|
||||
/**
|
||||
* @brief Reimplementation of EffectField::CreateWidget()
|
||||
@@ -66,7 +66,7 @@ public:
|
||||
/**
|
||||
* @brief Reimplementation of EffectField::UpdateWidgetValue()
|
||||
*/
|
||||
virtual void UpdateWidgetValue(QWidget* widget, double timecode) override;
|
||||
virtual void UpdateWidgetValue(QWidget* widget, const rational& timecode) override;
|
||||
private slots:
|
||||
/**
|
||||
* @brief Internal function connected to any QWidget made from CreateWidget() to update the value based on user input
|
||||
|
||||
@@ -117,7 +117,7 @@ OldEffectNodePtr RichTextEffect::Create(Clip *c)
|
||||
return std::make_shared<RichTextEffect>(c);
|
||||
}
|
||||
|
||||
void RichTextEffect::redraw(double timecode)
|
||||
void RichTextEffect::redraw(const rational &timecode)
|
||||
{
|
||||
QPainter p(&img);
|
||||
p.setRenderHint(QPainter::Antialiasing);
|
||||
@@ -144,7 +144,7 @@ void RichTextEffect::redraw(double timecode)
|
||||
|
||||
if (auto_scroll_dir != SCROLL_OFF) {
|
||||
double clip_length_secs = double(parent_clip->length()) / parent_clip->media_frame_rate();
|
||||
scroll_progress = (timecode - double(parent_clip->clip_in()) / parent_clip->media_frame_rate()) / clip_length_secs;
|
||||
scroll_progress = (timecode.ToDouble() - double(parent_clip->clip_in()) / parent_clip->media_frame_rate()) / clip_length_secs;
|
||||
}
|
||||
|
||||
if (auto_scroll_dir == SCROLL_OFF || auto_scroll_dir == SCROLL_LEFT || auto_scroll_dir == SCROLL_RIGHT) {
|
||||
@@ -221,5 +221,7 @@ void RichTextEffect::redraw(double timecode)
|
||||
|
||||
bool RichTextEffect::AlwaysUpdate()
|
||||
{
|
||||
return autoscroll->GetValueAt(Now()).toInt() != SCROLL_OFF;
|
||||
// FIXME
|
||||
//return autoscroll->GetValueAt(Now()).toInt() != SCROLL_OFF;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public:
|
||||
virtual olive::TrackType subtype() override;
|
||||
virtual OldEffectNodePtr Create(Clip *c) override;
|
||||
|
||||
virtual void redraw(double timecode) override;
|
||||
virtual void redraw(const rational& timecode) override;
|
||||
|
||||
protected:
|
||||
virtual bool AlwaysUpdate() override;
|
||||
|
||||
@@ -104,7 +104,7 @@ OldEffectNodePtr SolidEffect::Create(Clip *c)
|
||||
return std::make_shared<SolidEffect>(c);
|
||||
}
|
||||
|
||||
void SolidEffect::redraw(double timecode) {
|
||||
void SolidEffect::redraw(const rational &timecode) {
|
||||
int w = img.width();
|
||||
int h = img.height();
|
||||
int alpha = qRound(opacity_field->GetDoubleAt(timecode)*2.55);
|
||||
|
||||
@@ -44,7 +44,7 @@ public:
|
||||
virtual olive::TrackType subtype() override;
|
||||
virtual OldEffectNodePtr Create(Clip *c) override;
|
||||
|
||||
virtual void redraw(double timecode) override;
|
||||
virtual void redraw(const rational& timecode) override;
|
||||
|
||||
void SetType(SolidType type);
|
||||
private slots:
|
||||
|
||||
@@ -156,7 +156,7 @@ OldEffectNodePtr TextEffect::Create(Clip *c)
|
||||
return std::make_shared<TextEffect>(c);
|
||||
}
|
||||
|
||||
void TextEffect::redraw(double timecode) {
|
||||
void TextEffect::redraw(const rational &timecode) {
|
||||
if (size_val->GetDoubleAt(timecode) <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ public:
|
||||
virtual olive::TrackType subtype() override;
|
||||
virtual OldEffectNodePtr Create(Clip *c) override;
|
||||
|
||||
virtual void redraw(double timecode) override;
|
||||
virtual void redraw(const rational& timecode) override;
|
||||
private slots:
|
||||
void outline_enable(bool);
|
||||
void shadow_enable(bool);
|
||||
|
||||
@@ -110,18 +110,18 @@ OldEffectNodePtr TimecodeEffect::Create(Clip *c)
|
||||
}
|
||||
|
||||
|
||||
void TimecodeEffect::redraw(double timecode) {
|
||||
void TimecodeEffect::redraw(const rational &timecode) {
|
||||
Sequence* sequence = parent_clip->track()->sequence();
|
||||
|
||||
if (tc_select->GetValueAt(timecode).toBool()) {
|
||||
display_timecode = prepend_text->GetStringAt(timecode) + frame_to_timecode(sequence->playhead,
|
||||
olive::config.timecode_view,
|
||||
sequence->frame_rate());
|
||||
display_timecode = prepend_text->GetStringAt(timecode) + TimeToSMPTE(sequence->playhead,
|
||||
olive::config.timecode_view,
|
||||
sequence->frame_rate());
|
||||
} else {
|
||||
double media_rate = parent_clip->media_frame_rate();
|
||||
display_timecode = prepend_text->GetStringAt(timecode) + frame_to_timecode(qRound(timecode * media_rate),
|
||||
olive::config.timecode_view,
|
||||
media_rate);
|
||||
display_timecode = prepend_text->GetStringAt(timecode) + TimeToSMPTE(timecode,
|
||||
olive::config.timecode_view,
|
||||
media_rate);
|
||||
}
|
||||
img.fill(Qt::transparent);
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ public:
|
||||
virtual olive::TrackType subtype() override;
|
||||
virtual OldEffectNodePtr Create(Clip *c) override;
|
||||
|
||||
virtual void redraw(double timecode) override;
|
||||
virtual void redraw(const rational &timecode) override;
|
||||
DoubleInput* scale_val;
|
||||
ColorInput* color_val;
|
||||
ColorInput* color_bg_val;
|
||||
|
||||
+3
-1
@@ -24,6 +24,8 @@
|
||||
#include <QVariant>
|
||||
#include <QPointF>
|
||||
|
||||
#include "global/rational.h"
|
||||
|
||||
class EffectField;
|
||||
|
||||
class EffectKeyframe {
|
||||
@@ -31,7 +33,7 @@ public:
|
||||
EffectKeyframe();
|
||||
|
||||
int type;
|
||||
double time;
|
||||
rational time;
|
||||
QVariant data;
|
||||
|
||||
// only for bezier type
|
||||
|
||||
Reference in New Issue
Block a user