diff --git a/dialogs/speeddialog.cpp b/dialogs/speeddialog.cpp index 9b7cad23e..d4e2e5f8b 100644 --- a/dialogs/speeddialog.cpp +++ b/dialogs/speeddialog.cpp @@ -33,7 +33,7 @@ #include "panels/timeline.h" #include "undo/undo.h" #include "undo/undostack.h" -#include "nodes/node.h" +#include "nodes/oldeffectnode.h" #include "project/media.h" SpeedDialog::SpeedDialog(QWidget *parent, QVector clips) : QDialog(parent) { diff --git a/effects/effectfield.cpp b/effects/effectfield.cpp index 5968d7577..5ee306d9c 100644 --- a/effects/effectfield.cpp +++ b/effects/effectfield.cpp @@ -26,15 +26,15 @@ #include "rendering/renderfunctions.h" #include "global/config.h" #include "global/timing.h" -#include "effects/effectrow.h" -#include "nodes/node.h" +#include "nodes/nodeio.h" +#include "nodes/oldeffectnode.h" #include "undo/undo.h" #include "timeline/clip.h" #include "timeline/sequence.h" #include "global/math.h" #include "global/debug.h" -EffectField::EffectField(EffectRow* parent, EffectFieldType t) : +EffectField::EffectField(NodeIO* parent, EffectFieldType t) : QObject(parent), type_(t), enabled_(true) @@ -49,9 +49,9 @@ EffectField::EffectField(EffectRow* parent, EffectFieldType t) : connect(this, SIGNAL(Changed()), parent->GetParentEffect(), SLOT(FieldChanged())); } -EffectRow *EffectField::GetParentRow() +NodeIO *EffectField::GetParentRow() { - return static_cast(parent()); + return static_cast(parent()); } QVariant EffectField::ConvertStringToValue(const QString &s) diff --git a/effects/effectfield.h b/effects/effectfield.h index e72e3d685..39d3182d2 100644 --- a/effects/effectfield.h +++ b/effects/effectfield.h @@ -29,7 +29,7 @@ #include "undo/undostack.h" #include "nodes/nodedatatypes.h" -class EffectRow; +class NodeIO; class ComboAction; /** @@ -106,7 +106,7 @@ public: * * The type of data contained within this field. This is expected to be filled by a derived class. */ - EffectField(EffectRow* parent, EffectFieldType t); + EffectField(NodeIO* parent, EffectFieldType t); /** * @brief Get the EffectRow that this field is a member of. @@ -117,7 +117,7 @@ public: * * The EffectRow that this field is a member of. */ - EffectRow* GetParentRow(); + NodeIO* GetParentRow(); /** * @brief Get the type of data to expect from this field diff --git a/effects/effectgizmo.cpp b/effects/effectgizmo.cpp index db810016c..b74e93175 100644 --- a/effects/effectgizmo.cpp +++ b/effects/effectgizmo.cpp @@ -22,9 +22,9 @@ #include "ui/labelslider.h" #include "effects/fields/doublefield.h" -#include "nodes/node.h" +#include "nodes/oldeffectnode.h" -EffectGizmo::EffectGizmo(Node *parent, int type) : +EffectGizmo::EffectGizmo(OldEffectNode *parent, int type) : QObject(parent), x_field1(nullptr), x_field_multi1(1.0), diff --git a/effects/effectgizmo.h b/effects/effectgizmo.h index aea73fcf2..25ad8ae70 100644 --- a/effects/effectgizmo.h +++ b/effects/effectgizmo.h @@ -39,12 +39,12 @@ enum GizmoType { #include class DoubleField; -class Node; +class OldEffectNode; class EffectGizmo : public QObject { Q_OBJECT public: - EffectGizmo(Node* parent, int type); + EffectGizmo(OldEffectNode* parent, int type); QVector world_pos; QVector screen_pos; diff --git a/effects/effectloaders.cpp b/effects/effectloaders.cpp index ae04cce81..3168374aa 100644 --- a/effects/effectloaders.cpp +++ b/effects/effectloaders.cpp @@ -24,7 +24,7 @@ #include #include -#include "nodes/node.h" +#include "nodes/oldeffectnode.h" #include "effects/transition.h" #include "global/path.h" #include "panels/panels.h" diff --git a/effects/fields/boolfield.cpp b/effects/fields/boolfield.cpp index ac3be8ea6..acca67548 100644 --- a/effects/fields/boolfield.cpp +++ b/effects/fields/boolfield.cpp @@ -22,10 +22,10 @@ #include -#include "nodes/node.h" +#include "nodes/oldeffectnode.h" #include "undo/undo.h" -BoolField::BoolField(EffectRow *parent) : +BoolField::BoolField(NodeIO *parent) : EffectField(parent, EffectField::EFFECT_FIELD_BOOL) {} diff --git a/effects/fields/boolfield.h b/effects/fields/boolfield.h index 1e8e891ae..89693b4b6 100644 --- a/effects/fields/boolfield.h +++ b/effects/fields/boolfield.h @@ -35,7 +35,7 @@ public: /** * @brief Reimplementation of EffectField::EffectField(). */ - BoolField(EffectRow* parent); + BoolField(NodeIO* parent); /** * @brief Get the boolean value at a given timecode diff --git a/effects/fields/buttonfield.cpp b/effects/fields/buttonfield.cpp index 2023105f3..bbb0a1c78 100644 --- a/effects/fields/buttonfield.cpp +++ b/effects/fields/buttonfield.cpp @@ -22,7 +22,7 @@ #include -ButtonField::ButtonField(EffectRow *parent, const QString &string) : +ButtonField::ButtonField(NodeIO *parent, const QString &string) : EffectField(parent, EffectField::EFFECT_FIELD_UI), button_text_(string) {} diff --git a/effects/fields/buttonfield.h b/effects/fields/buttonfield.h index 0cea15459..8a4ccfaf2 100644 --- a/effects/fields/buttonfield.h +++ b/effects/fields/buttonfield.h @@ -42,7 +42,7 @@ public: /** * @brief Reimplementation of EffectField::EffectField(). */ - ButtonField(EffectRow* parent, const QString& string); + ButtonField(NodeIO* parent, const QString& string); /** * @brief Set whether this pushbutton is checkable diff --git a/effects/fields/colorfield.cpp b/effects/fields/colorfield.cpp index 5702b4582..ad3d96c04 100644 --- a/effects/fields/colorfield.cpp +++ b/effects/fields/colorfield.cpp @@ -23,10 +23,10 @@ #include #include "ui/colorbutton.h" -#include "nodes/node.h" +#include "nodes/oldeffectnode.h" #include "undo/undo.h" -ColorField::ColorField(EffectRow* parent) : +ColorField::ColorField(NodeIO* parent) : EffectField(parent, EffectField::EFFECT_FIELD_COLOR) {} diff --git a/effects/fields/colorfield.h b/effects/fields/colorfield.h index 235e831dc..c0421e6ad 100644 --- a/effects/fields/colorfield.h +++ b/effects/fields/colorfield.h @@ -35,7 +35,7 @@ public: /** * @brief Reimplementation of EffectField::EffectField(). */ - ColorField(EffectRow* parent); + ColorField(NodeIO* parent); /** * @brief Get the color value at a given timecode diff --git a/effects/fields/combofield.cpp b/effects/fields/combofield.cpp index c9542a000..84f5c574a 100644 --- a/effects/fields/combofield.cpp +++ b/effects/fields/combofield.cpp @@ -22,11 +22,11 @@ #include -#include "nodes/node.h" +#include "nodes/oldeffectnode.h" #include "ui/comboboxex.h" #include "undo/undo.h" -ComboField::ComboField(EffectRow* parent) : +ComboField::ComboField(NodeIO* parent) : EffectField(parent, EffectField::EFFECT_FIELD_COMBO) {} diff --git a/effects/fields/combofield.h b/effects/fields/combofield.h index 2ba63c400..bbccdea32 100644 --- a/effects/fields/combofield.h +++ b/effects/fields/combofield.h @@ -48,7 +48,7 @@ public: /** * @brief Reimplementation of EffectField::EffectField(). */ - ComboField(EffectRow* parent); + ComboField(NodeIO* parent); /** * @brief Add an item to this ComboField diff --git a/effects/fields/doublefield.cpp b/effects/fields/doublefield.cpp index 14ef3ec15..9e4563a3c 100644 --- a/effects/fields/doublefield.cpp +++ b/effects/fields/doublefield.cpp @@ -20,10 +20,10 @@ #include "doublefield.h" -#include "nodes/node.h" +#include "nodes/oldeffectnode.h" #include "undo/undo.h" -DoubleField::DoubleField(EffectRow* parent) : +DoubleField::DoubleField(NodeIO* parent) : EffectField(parent, EffectField::EFFECT_FIELD_DOUBLE), min_(qSNaN()), max_(qSNaN()), diff --git a/effects/fields/doublefield.h b/effects/fields/doublefield.h index 11734244e..4f31bc138 100644 --- a/effects/fields/doublefield.h +++ b/effects/fields/doublefield.h @@ -39,7 +39,7 @@ public: /** * @brief Reimplementation of EffectField::EffectField(). */ - DoubleField(EffectRow* parent); + DoubleField(NodeIO* parent); /** * @brief Get double value at timecode diff --git a/effects/fields/filefield.cpp b/effects/fields/filefield.cpp index cc7f7a244..30414484b 100644 --- a/effects/fields/filefield.cpp +++ b/effects/fields/filefield.cpp @@ -23,10 +23,10 @@ #include #include "ui/embeddedfilechooser.h" -#include "nodes/node.h" +#include "nodes/oldeffectnode.h" #include "undo/undo.h" -FileField::FileField(EffectRow* parent) : +FileField::FileField(NodeIO* parent) : EffectField(parent, EffectField::EFFECT_FIELD_FILE) { // Set default value to an empty string diff --git a/effects/fields/filefield.h b/effects/fields/filefield.h index 3752fd3f7..bc462c0d7 100644 --- a/effects/fields/filefield.h +++ b/effects/fields/filefield.h @@ -36,7 +36,7 @@ public: /** * @brief Reimplementation of EffectField::EffectField(). */ - FileField(EffectRow* parent); + FileField(NodeIO* parent); /** * @brief Get the filename at the given timecode diff --git a/effects/fields/fontfield.cpp b/effects/fields/fontfield.cpp index 24e51615a..a6040d149 100644 --- a/effects/fields/fontfield.cpp +++ b/effects/fields/fontfield.cpp @@ -24,12 +24,12 @@ #include #include "ui/comboboxex.h" -#include "nodes/node.h" +#include "nodes/oldeffectnode.h" #include "undo/undo.h" // NOTE/TODO: This shares a lot of similarity with ComboInput, and could probably be a derived class of it -FontField::FontField(EffectRow* parent) : +FontField::FontField(NodeIO* parent) : EffectField(parent, EffectField::EFFECT_FIELD_FONT) { font_list = QFontDatabase().families(); diff --git a/effects/fields/fontfield.h b/effects/fields/fontfield.h index 6abd7c6c2..9b7256a35 100644 --- a/effects/fields/fontfield.h +++ b/effects/fields/fontfield.h @@ -37,7 +37,7 @@ public: /** * @brief Reimplementation of EffectField::EffectField(). */ - FontField(EffectRow* parent); + FontField(NodeIO* parent); /** * @brief Get the font family name at the given timecode diff --git a/effects/fields/labelfield.cpp b/effects/fields/labelfield.cpp index 45306699a..b9f1b4fac 100644 --- a/effects/fields/labelfield.cpp +++ b/effects/fields/labelfield.cpp @@ -22,7 +22,7 @@ #include -LabelField::LabelField(EffectRow *parent, const QString &string) : +LabelField::LabelField(NodeIO *parent, const QString &string) : EffectField(parent, EffectField::EFFECT_FIELD_UI), label_text_(string) {} diff --git a/effects/fields/labelfield.h b/effects/fields/labelfield.h index dba2912ff..82985f612 100644 --- a/effects/fields/labelfield.h +++ b/effects/fields/labelfield.h @@ -37,7 +37,7 @@ public: /** * @brief Reimplementation of EffectField::EffectField(). */ - LabelField(EffectRow* parent, const QString& string); + LabelField(NodeIO* parent, const QString& string); /** * @brief Reimplementation of EffectField::CreateWidget() diff --git a/effects/fields/stringfield.cpp b/effects/fields/stringfield.cpp index 6da53cd93..11c379fbd 100644 --- a/effects/fields/stringfield.cpp +++ b/effects/fields/stringfield.cpp @@ -23,12 +23,12 @@ #include #include -#include "nodes/node.h" +#include "nodes/oldeffectnode.h" #include "ui/texteditex.h" #include "global/config.h" #include "undo/undo.h" -StringField::StringField(EffectRow* parent, bool rich_text) : +StringField::StringField(NodeIO* parent, bool rich_text) : EffectField(parent, EffectField::EFFECT_FIELD_STRING), rich_text_(rich_text) { diff --git a/effects/fields/stringfield.h b/effects/fields/stringfield.h index 4124285bb..4a26a1957 100644 --- a/effects/fields/stringfield.h +++ b/effects/fields/stringfield.h @@ -39,7 +39,7 @@ public: * Provides a setting for whether this StringField - and its attached TextEditEx objects - should operate in rich * text or plain text mode, defaulting to rich text mode. */ - StringField(EffectRow* parent, bool rich_text = true); + StringField(NodeIO* parent, bool rich_text = true); /** * @brief Get the string at the given timecode diff --git a/effects/internal/audionoiseeffect.cpp b/effects/internal/audionoiseeffect.cpp index 128921978..839f6b2e9 100644 --- a/effects/internal/audionoiseeffect.cpp +++ b/effects/internal/audionoiseeffect.cpp @@ -23,7 +23,7 @@ #include #include -AudioNoiseEffect::AudioNoiseEffect(Clip* c) : Node(c) { +AudioNoiseEffect::AudioNoiseEffect(Clip* c) : OldEffectNode(c) { amount_val = new DoubleInput(this, "amount", tr("Amount")); amount_val->SetMinimum(0); amount_val->SetDefault(20); @@ -58,7 +58,7 @@ olive::TrackType AudioNoiseEffect::subtype() return olive::kTypeAudio; } -NodePtr AudioNoiseEffect::Create(Clip *c) +OldEffectNodePtr AudioNoiseEffect::Create(Clip *c) { return std::make_shared(c); } diff --git a/effects/internal/audionoiseeffect.h b/effects/internal/audionoiseeffect.h index d950080b5..d04e00da0 100644 --- a/effects/internal/audionoiseeffect.h +++ b/effects/internal/audionoiseeffect.h @@ -21,9 +21,9 @@ #ifndef AUDIONOISEEFFECT_H #define AUDIONOISEEFFECT_H -#include "nodes/node.h" +#include "nodes/oldeffectnode.h" -class AudioNoiseEffect : public Node { +class AudioNoiseEffect : public OldEffectNode { Q_OBJECT public: AudioNoiseEffect(Clip* c); @@ -33,7 +33,7 @@ public: virtual QString description() override; virtual EffectType type() override; virtual olive::TrackType subtype() override; - virtual NodePtr Create(Clip *c) override; + virtual OldEffectNodePtr Create(Clip *c) override; virtual void process_audio(double timecode_start, double timecode_end, diff --git a/effects/internal/cornerpineffect.cpp b/effects/internal/cornerpineffect.cpp index 2e5f93281..059945a2f 100644 --- a/effects/internal/cornerpineffect.cpp +++ b/effects/internal/cornerpineffect.cpp @@ -24,8 +24,8 @@ #include "timeline/clip.h" #include "global/debug.h" -CornerPinEffect::CornerPinEffect(Clip* c) : Node(c) { - SetFlags(Node::CoordsFlag | Node::ShaderFlag); +CornerPinEffect::CornerPinEffect(Clip* c) : OldEffectNode(c) { + SetFlags(OldEffectNode::CoordsFlag | OldEffectNode::ShaderFlag); top_left = new Vec2Input(this, "topleft", tr("Top Left")); @@ -88,7 +88,7 @@ olive::TrackType CornerPinEffect::subtype() return olive::kTypeVideo; } -NodePtr CornerPinEffect::Create(Clip *c) +OldEffectNodePtr CornerPinEffect::Create(Clip *c) { return std::make_shared(c); } diff --git a/effects/internal/cornerpineffect.h b/effects/internal/cornerpineffect.h index 9226d7c40..06d7a61f7 100644 --- a/effects/internal/cornerpineffect.h +++ b/effects/internal/cornerpineffect.h @@ -21,9 +21,9 @@ #ifndef CORNERPINEFFECT_H #define CORNERPINEFFECT_H -#include "nodes/node.h" +#include "nodes/oldeffectnode.h" -class CornerPinEffect : public Node { +class CornerPinEffect : public OldEffectNode { Q_OBJECT public: CornerPinEffect(Clip* c); @@ -34,7 +34,7 @@ public: virtual QString description() override; virtual EffectType type() override; virtual olive::TrackType subtype() override; - virtual NodePtr Create(Clip *c) override; + virtual OldEffectNodePtr Create(Clip *c) override; void process_coords(double timecode, GLTextureCoords& coords, int data); void process_shader(double timecode, GLTextureCoords& coords, int iterations); diff --git a/effects/internal/crossdissolvetransition.cpp b/effects/internal/crossdissolvetransition.cpp index dc895acea..d98869018 100644 --- a/effects/internal/crossdissolvetransition.cpp +++ b/effects/internal/crossdissolvetransition.cpp @@ -23,7 +23,7 @@ #include CrossDissolveTransition::CrossDissolveTransition(Clip* c) : Transition(c) { - SetFlags(Node::CoordsFlag); + SetFlags(OldEffectNode::CoordsFlag); } QString CrossDissolveTransition::name() @@ -56,7 +56,7 @@ olive::TrackType CrossDissolveTransition::subtype() return olive::kTypeVideo; } -NodePtr CrossDissolveTransition::Create(Clip *c) +OldEffectNodePtr CrossDissolveTransition::Create(Clip *c) { return std::make_shared(c); } diff --git a/effects/internal/crossdissolvetransition.h b/effects/internal/crossdissolvetransition.h index 153665def..b95588716 100644 --- a/effects/internal/crossdissolvetransition.h +++ b/effects/internal/crossdissolvetransition.h @@ -33,7 +33,7 @@ public: virtual QString description() override; virtual EffectType type() override; virtual olive::TrackType subtype() override; - virtual NodePtr Create(Clip *c) override; + virtual OldEffectNodePtr Create(Clip *c) override; virtual void process_coords(double timecode, GLTextureCoords &, int data) override; }; diff --git a/effects/internal/exponentialfadetransition.cpp b/effects/internal/exponentialfadetransition.cpp index 8c5aae400..791dd5a03 100644 --- a/effects/internal/exponentialfadetransition.cpp +++ b/effects/internal/exponentialfadetransition.cpp @@ -52,7 +52,7 @@ olive::TrackType ExponentialFadeTransition::subtype() return olive::kTypeAudio; } -NodePtr ExponentialFadeTransition::Create(Clip *c) +OldEffectNodePtr ExponentialFadeTransition::Create(Clip *c) { return std::make_shared(c); } diff --git a/effects/internal/exponentialfadetransition.h b/effects/internal/exponentialfadetransition.h index 19e326a06..a63564869 100644 --- a/effects/internal/exponentialfadetransition.h +++ b/effects/internal/exponentialfadetransition.h @@ -32,7 +32,7 @@ public: virtual QString description() override; virtual EffectType type() override; virtual olive::TrackType subtype() override; - virtual NodePtr Create(Clip *c) override; + virtual OldEffectNodePtr Create(Clip *c) override; virtual void process_audio(double timecode_start, double timecode_end, diff --git a/effects/internal/fillleftrighteffect.cpp b/effects/internal/fillleftrighteffect.cpp index 141583124..ed5d9a594 100644 --- a/effects/internal/fillleftrighteffect.cpp +++ b/effects/internal/fillleftrighteffect.cpp @@ -25,7 +25,7 @@ enum FillType { FILL_TYPE_RIGHT }; -FillLeftRightEffect::FillLeftRightEffect(Clip* c) : Node(c) { +FillLeftRightEffect::FillLeftRightEffect(Clip* c) : OldEffectNode(c) { fill_type = new ComboInput(this, "type", tr("Type")); fill_type->AddItem(tr("Fill Left with Right"), FILL_TYPE_LEFT); fill_type->AddItem(tr("Fill Right with Left"), FILL_TYPE_RIGHT); @@ -56,7 +56,7 @@ olive::TrackType FillLeftRightEffect::subtype() return olive::kTypeAudio; } -NodePtr FillLeftRightEffect::Create(Clip *c) +OldEffectNodePtr FillLeftRightEffect::Create(Clip *c) { return std::make_shared(c); } diff --git a/effects/internal/fillleftrighteffect.h b/effects/internal/fillleftrighteffect.h index 1acd1de54..11de0a3e6 100644 --- a/effects/internal/fillleftrighteffect.h +++ b/effects/internal/fillleftrighteffect.h @@ -21,9 +21,9 @@ #ifndef FILLLEFTRIGHTEFFECT_H #define FILLLEFTRIGHTEFFECT_H -#include "nodes/node.h" +#include "nodes/oldeffectnode.h" -class FillLeftRightEffect : public Node { +class FillLeftRightEffect : public OldEffectNode { Q_OBJECT public: FillLeftRightEffect(Clip* c); @@ -33,7 +33,7 @@ public: virtual QString description() override; virtual EffectType type() override; virtual olive::TrackType subtype() override; - virtual NodePtr Create(Clip *c) override; + virtual OldEffectNodePtr Create(Clip *c) override; virtual void process_audio(double timecode_start, double timecode_end, diff --git a/effects/internal/linearfadetransition.cpp b/effects/internal/linearfadetransition.cpp index e89e311dc..270716a5b 100644 --- a/effects/internal/linearfadetransition.cpp +++ b/effects/internal/linearfadetransition.cpp @@ -47,7 +47,7 @@ olive::TrackType LinearFadeTransition::subtype() return olive::kTypeAudio; } -NodePtr LinearFadeTransition::Create(Clip *c) +OldEffectNodePtr LinearFadeTransition::Create(Clip *c) { return std::make_shared(c); } diff --git a/effects/internal/linearfadetransition.h b/effects/internal/linearfadetransition.h index b2add8670..315e78e92 100644 --- a/effects/internal/linearfadetransition.h +++ b/effects/internal/linearfadetransition.h @@ -32,7 +32,7 @@ public: virtual QString description() override; virtual EffectType type() override; virtual olive::TrackType subtype() override; - virtual NodePtr Create(Clip *c) override; + virtual OldEffectNodePtr Create(Clip *c) override; virtual void process_audio(double timecode_start, double timecode_end, diff --git a/effects/internal/logarithmicfadetransition.cpp b/effects/internal/logarithmicfadetransition.cpp index 79fc82875..05b278f5b 100644 --- a/effects/internal/logarithmicfadetransition.cpp +++ b/effects/internal/logarithmicfadetransition.cpp @@ -52,7 +52,7 @@ olive::TrackType LogarithmicFadeTransition::subtype() return olive::kTypeAudio; } -NodePtr LogarithmicFadeTransition::Create(Clip *c) +OldEffectNodePtr LogarithmicFadeTransition::Create(Clip *c) { return std::make_shared(c); } diff --git a/effects/internal/logarithmicfadetransition.h b/effects/internal/logarithmicfadetransition.h index 0d3d2cbd1..eeca0577c 100644 --- a/effects/internal/logarithmicfadetransition.h +++ b/effects/internal/logarithmicfadetransition.h @@ -32,7 +32,7 @@ public: virtual QString description() override; virtual EffectType type() override; virtual olive::TrackType subtype() override; - virtual NodePtr Create(Clip* c) override; + virtual OldEffectNodePtr Create(Clip* c) override; virtual void process_audio(double timecode_start, double timecode_end, diff --git a/effects/internal/paneffect.cpp b/effects/internal/paneffect.cpp index 223933f8a..cea8936db 100644 --- a/effects/internal/paneffect.cpp +++ b/effects/internal/paneffect.cpp @@ -28,7 +28,7 @@ #include "ui/labelslider.h" #include "ui/collapsiblewidget.h" -PanEffect::PanEffect(Clip* c) : Node(c) { +PanEffect::PanEffect(Clip* c) : OldEffectNode(c) { pan_val = new DoubleInput(this, "pan", tr("Pan")); pan_val->SetMinimum(-100); pan_val->SetDefault(0); @@ -60,7 +60,7 @@ olive::TrackType PanEffect::subtype() return olive::kTypeAudio; } -NodePtr PanEffect::Create(Clip *c) +OldEffectNodePtr PanEffect::Create(Clip *c) { return std::make_shared(c); } diff --git a/effects/internal/paneffect.h b/effects/internal/paneffect.h index ac6ea6034..9a682b76a 100644 --- a/effects/internal/paneffect.h +++ b/effects/internal/paneffect.h @@ -21,9 +21,9 @@ #ifndef PANEFFECT_H #define PANEFFECT_H -#include "nodes/node.h" +#include "nodes/oldeffectnode.h" -class PanEffect : public Node { +class PanEffect : public OldEffectNode { Q_OBJECT public: PanEffect(Clip* c); @@ -33,7 +33,7 @@ public: virtual QString description() override; virtual EffectType type() override; virtual olive::TrackType subtype() override; - virtual NodePtr Create(Clip *c) override; + virtual OldEffectNodePtr Create(Clip *c) override; virtual void process_audio(double timecode_start, double timecode_end, diff --git a/effects/internal/richtexteffect.cpp b/effects/internal/richtexteffect.cpp index 6bc3ca4a9..b8b9a42af 100644 --- a/effects/internal/richtexteffect.cpp +++ b/effects/internal/richtexteffect.cpp @@ -35,9 +35,9 @@ enum AutoscrollDirection { }; RichTextEffect::RichTextEffect(Clip *c) : - Node(c) + OldEffectNode(c) { - SetFlags(Node::SuperimposeFlag); + SetFlags(OldEffectNode::SuperimposeFlag); text_val = new StringInput(this, "text", tr("Text")); @@ -112,7 +112,7 @@ olive::TrackType RichTextEffect::subtype() return olive::kTypeVideo; } -NodePtr RichTextEffect::Create(Clip *c) +OldEffectNodePtr RichTextEffect::Create(Clip *c) { return std::make_shared(c); } diff --git a/effects/internal/richtexteffect.h b/effects/internal/richtexteffect.h index 8944d802c..e6c7970e6 100644 --- a/effects/internal/richtexteffect.h +++ b/effects/internal/richtexteffect.h @@ -21,9 +21,9 @@ #ifndef RICHTEXTEFFECT_H #define RICHTEXTEFFECT_H -#include "nodes/node.h" +#include "nodes/oldeffectnode.h" -class RichTextEffect : public Node { +class RichTextEffect : public OldEffectNode { Q_OBJECT public: RichTextEffect(Clip* c); @@ -34,7 +34,7 @@ public: virtual QString description() override; virtual EffectType type() override; virtual olive::TrackType subtype() override; - virtual NodePtr Create(Clip *c) override; + virtual OldEffectNodePtr Create(Clip *c) override; virtual void redraw(double timecode) override; diff --git a/effects/internal/shakeeffect.cpp b/effects/internal/shakeeffect.cpp index 7d623dd19..f8816c1ec 100644 --- a/effects/internal/shakeeffect.cpp +++ b/effects/internal/shakeeffect.cpp @@ -32,8 +32,8 @@ #include "panels/timeline.h" #include "global/debug.h" -ShakeEffect::ShakeEffect(Clip* c) : Node(c) { - SetFlags(Node::CoordsFlag); +ShakeEffect::ShakeEffect(Clip* c) : OldEffectNode(c) { + SetFlags(OldEffectNode::CoordsFlag); intensity_val = new DoubleInput(this, "intensity", tr("Intensity")); intensity_val->SetMinimum(0); @@ -110,7 +110,7 @@ olive::TrackType ShakeEffect::subtype() return olive::kTypeVideo; } -NodePtr ShakeEffect::Create(Clip *c) +OldEffectNodePtr ShakeEffect::Create(Clip *c) { return std::make_shared(c); } diff --git a/effects/internal/shakeeffect.h b/effects/internal/shakeeffect.h index a9e6e9829..bcf4163c1 100644 --- a/effects/internal/shakeeffect.h +++ b/effects/internal/shakeeffect.h @@ -21,11 +21,11 @@ #ifndef SHAKEEFFECT_H #define SHAKEEFFECT_H -#include "nodes/node.h" +#include "nodes/oldeffectnode.h" #define RANDOM_VAL_SIZE 30 -class ShakeEffect : public Node { +class ShakeEffect : public OldEffectNode { Q_OBJECT public: ShakeEffect(Clip* c); @@ -37,7 +37,7 @@ public: virtual QString description() override; virtual EffectType type() override; virtual olive::TrackType subtype() override; - virtual NodePtr Create(Clip *c) override; + virtual OldEffectNodePtr Create(Clip *c) override; DoubleInput* intensity_val; DoubleInput* rotation_val; diff --git a/effects/internal/solideffect.cpp b/effects/internal/solideffect.cpp index 452ea1e93..c5104a4e9 100644 --- a/effects/internal/solideffect.cpp +++ b/effects/internal/solideffect.cpp @@ -35,9 +35,9 @@ const int SMPTE_STRIP_COUNT = 3; const int SMPTE_LOWER_BARS = 4; SolidEffect::SolidEffect(Clip* c) : - Node(c) + OldEffectNode(c) { - SetFlags(Node::SuperimposeFlag); + SetFlags(OldEffectNode::SuperimposeFlag); // Field for solid type solid_type = new ComboInput(this, "type", tr("Type")); @@ -99,7 +99,7 @@ olive::TrackType SolidEffect::subtype() return olive::kTypeVideo; } -NodePtr SolidEffect::Create(Clip *c) +OldEffectNodePtr SolidEffect::Create(Clip *c) { return std::make_shared(c); } diff --git a/effects/internal/solideffect.h b/effects/internal/solideffect.h index f1bd50c1a..26d3211f2 100644 --- a/effects/internal/solideffect.h +++ b/effects/internal/solideffect.h @@ -21,11 +21,11 @@ #ifndef SOLIDEFFECT_H #define SOLIDEFFECT_H -#include "nodes/node.h" +#include "nodes/oldeffectnode.h" #include -class SolidEffect : public Node { +class SolidEffect : public OldEffectNode { Q_OBJECT public: enum SolidType { @@ -42,7 +42,7 @@ public: virtual QString description() override; virtual EffectType type() override; virtual olive::TrackType subtype() override; - virtual NodePtr Create(Clip *c) override; + virtual OldEffectNodePtr Create(Clip *c) override; virtual void redraw(double timecode) override; diff --git a/effects/internal/texteffect.cpp b/effects/internal/texteffect.cpp index b32262f9c..d82360bc0 100644 --- a/effects/internal/texteffect.cpp +++ b/effects/internal/texteffect.cpp @@ -43,9 +43,9 @@ #include "global/config.h" TextEffect::TextEffect(Clip* c) : - Node(c) + OldEffectNode(c) { - SetFlags(Node::SuperimposeFlag); + SetFlags(OldEffectNode::SuperimposeFlag); text_val = new StringInput(this, "text", tr("Text"), false); @@ -151,7 +151,7 @@ olive::TrackType TextEffect::subtype() return olive::kTypeVideo; } -NodePtr TextEffect::Create(Clip *c) +OldEffectNodePtr TextEffect::Create(Clip *c) { return std::make_shared(c); } diff --git a/effects/internal/texteffect.h b/effects/internal/texteffect.h index de4076616..99ca57eb2 100644 --- a/effects/internal/texteffect.h +++ b/effects/internal/texteffect.h @@ -21,12 +21,12 @@ #ifndef TEXTEFFECT_H #define TEXTEFFECT_H -#include "nodes/node.h" +#include "nodes/oldeffectnode.h" #include #include -class TextEffect : public Node { +class TextEffect : public OldEffectNode { Q_OBJECT public: TextEffect(Clip* c); @@ -37,7 +37,7 @@ public: virtual QString description() override; virtual EffectType type() override; virtual olive::TrackType subtype() override; - virtual NodePtr Create(Clip *c) override; + virtual OldEffectNodePtr Create(Clip *c) override; virtual void redraw(double timecode) override; private slots: diff --git a/effects/internal/timecodeeffect.cpp b/effects/internal/timecodeeffect.cpp index 32a892cdf..ed8c5c35b 100644 --- a/effects/internal/timecodeeffect.cpp +++ b/effects/internal/timecodeeffect.cpp @@ -43,9 +43,9 @@ #include "global/config.h" TimecodeEffect::TimecodeEffect(Clip* c) : - Node(c) + OldEffectNode(c) { - SetFlags(Node::SuperimposeFlag); + SetFlags(OldEffectNode::SuperimposeFlag); tc_select = new ComboInput(this, "tc_selector", tr("Timecode")); tc_select->AddItem(tr("Sequence"), true); @@ -104,7 +104,7 @@ olive::TrackType TimecodeEffect::subtype() return olive::kTypeVideo; } -NodePtr TimecodeEffect::Create(Clip *c) +OldEffectNodePtr TimecodeEffect::Create(Clip *c) { return std::make_shared(c); } diff --git a/effects/internal/timecodeeffect.h b/effects/internal/timecodeeffect.h index 71051d421..74ee7fd18 100644 --- a/effects/internal/timecodeeffect.h +++ b/effects/internal/timecodeeffect.h @@ -21,12 +21,12 @@ #ifndef TIMECODEEFFECT_H #define TIMECODEEFFECT_H -#include "nodes/node.h" +#include "nodes/oldeffectnode.h" #include #include -class TimecodeEffect : public Node { +class TimecodeEffect : public OldEffectNode { Q_OBJECT public: TimecodeEffect(Clip* c); @@ -37,7 +37,7 @@ public: virtual QString description() override; virtual EffectType type() override; virtual olive::TrackType subtype() override; - virtual NodePtr Create(Clip *c) override; + virtual OldEffectNodePtr Create(Clip *c) override; virtual void redraw(double timecode) override; DoubleInput* scale_val; diff --git a/effects/internal/toneeffect.cpp b/effects/internal/toneeffect.cpp index b0b66fa46..f7ccfbe2a 100644 --- a/effects/internal/toneeffect.cpp +++ b/effects/internal/toneeffect.cpp @@ -27,7 +27,7 @@ #include "timeline/clip.h" #include "timeline/sequence.h" -ToneEffect::ToneEffect(Clip* c) : Node(c), sinX(INT_MIN) { +ToneEffect::ToneEffect(Clip* c) : OldEffectNode(c), sinX(INT_MIN) { type_val = new ComboInput(this, "type", tr("Type")); type_val->AddItem(tr("Sine"), TONE_TYPE_SINE); @@ -70,7 +70,7 @@ olive::TrackType ToneEffect::subtype() return olive::kTypeAudio; } -NodePtr ToneEffect::Create(Clip *c) +OldEffectNodePtr ToneEffect::Create(Clip *c) { return std::make_shared(c); } diff --git a/effects/internal/toneeffect.h b/effects/internal/toneeffect.h index ddb723d79..60734b5c2 100644 --- a/effects/internal/toneeffect.h +++ b/effects/internal/toneeffect.h @@ -21,9 +21,9 @@ #ifndef TONEEFFECT_H #define TONEEFFECT_H -#include "nodes/node.h" +#include "nodes/oldeffectnode.h" -class ToneEffect : public Node { +class ToneEffect : public OldEffectNode { Q_OBJECT public: ToneEffect(Clip* c); @@ -33,7 +33,7 @@ public: virtual QString description() override; virtual EffectType type() override; virtual olive::TrackType subtype() override; - virtual NodePtr Create(Clip *c) override; + virtual OldEffectNodePtr Create(Clip *c) override; virtual void process_audio(double timecode_start, double timecode_end, diff --git a/effects/internal/transformeffect.cpp b/effects/internal/transformeffect.cpp index 1e04afc13..2f0e63c88 100644 --- a/effects/internal/transformeffect.cpp +++ b/effects/internal/transformeffect.cpp @@ -43,8 +43,8 @@ #include "panels/viewer.h" #include "ui/viewerwidget.h" -TransformEffect::TransformEffect(Clip* c) : Node(c) { - SetFlags(Node::CoordsFlag); +TransformEffect::TransformEffect(Clip* c) : OldEffectNode(c) { + SetFlags(OldEffectNode::CoordsFlag); position = new Vec2Input(this, "pos", tr("Position")); @@ -68,7 +68,7 @@ TransformEffect::TransformEffect(Clip* c) : Node(c) { opacity->SetDefault(100); // TEMP - Create matrix output - EffectRow* matrix_output = new EffectRow(this, "matrix", "Matrix", false, false); + NodeIO* matrix_output = new NodeIO(this, "matrix", "Matrix", false, false); matrix_output->SetOutputDataType(olive::nodes::kMatrix); // set up gizmos @@ -155,7 +155,7 @@ olive::TrackType TransformEffect::subtype() return olive::kTypeVideo; } -NodePtr TransformEffect::Create(Clip *c) +OldEffectNodePtr TransformEffect::Create(Clip *c) { return std::make_shared(c); } diff --git a/effects/internal/transformeffect.h b/effects/internal/transformeffect.h index 2ead33e31..8b61d2267 100644 --- a/effects/internal/transformeffect.h +++ b/effects/internal/transformeffect.h @@ -21,9 +21,9 @@ #ifndef TRANSFORMEFFECT_H #define TRANSFORMEFFECT_H -#include "nodes/node.h" +#include "nodes/oldeffectnode.h" -class TransformEffect : public Node { +class TransformEffect : public OldEffectNode { Q_OBJECT public: TransformEffect(Clip* c); @@ -34,7 +34,7 @@ public: virtual QString description() override; virtual EffectType type() override; virtual olive::TrackType subtype() override; - virtual NodePtr Create(Clip *c) override; + virtual OldEffectNodePtr Create(Clip *c) override; virtual void refresh() override; virtual void process_coords(double timecode, GLTextureCoords& coords, int data) override; diff --git a/effects/internal/voideffect.cpp b/effects/internal/voideffect.cpp index f5eb5a8d2..477324e09 100644 --- a/effects/internal/voideffect.cpp +++ b/effects/internal/voideffect.cpp @@ -28,7 +28,7 @@ #include "global/debug.h" VoidEffect::VoidEffect(Clip* c, const QString& n, const QString& id) : - Node(c), + OldEffectNode(c), display_name_(n), id_(id) { @@ -69,13 +69,13 @@ bool VoidEffect::IsCreatable() return false; } -NodePtr VoidEffect::Create(Clip *) +OldEffectNodePtr VoidEffect::Create(Clip *) { return nullptr; } -NodePtr VoidEffect::copy(Clip* c) { - NodePtr copy = std::make_shared(c, display_name_, id_); +OldEffectNodePtr VoidEffect::copy(Clip* c) { + OldEffectNodePtr copy = std::make_shared(c, display_name_, id_); copy->SetEnabled(IsEnabled()); copy_field_keyframes(copy); return copy; diff --git a/effects/internal/voideffect.h b/effects/internal/voideffect.h index e551f4ae0..f1c56a463 100644 --- a/effects/internal/voideffect.h +++ b/effects/internal/voideffect.h @@ -27,9 +27,9 @@ * isn't lost if the user saves over the project. */ -#include "nodes/node.h" +#include "nodes/oldeffectnode.h" -class VoidEffect : public Node { +class VoidEffect : public OldEffectNode { Q_OBJECT public: VoidEffect(Clip* c, const QString& n, const QString &id); @@ -40,8 +40,8 @@ public: virtual EffectType type() override; virtual olive::TrackType subtype() override; virtual bool IsCreatable() override; - virtual NodePtr Create(Clip *c) override; - virtual NodePtr copy(Clip* c) override; + virtual OldEffectNodePtr Create(Clip *c) override; + virtual OldEffectNodePtr copy(Clip* c) override; virtual void load(QXmlStreamReader &stream) override; virtual void save(QXmlStreamWriter &stream) override; diff --git a/effects/internal/volumeeffect.cpp b/effects/internal/volumeeffect.cpp index 96c66b676..7e5ced506 100644 --- a/effects/internal/volumeeffect.cpp +++ b/effects/internal/volumeeffect.cpp @@ -28,7 +28,7 @@ #include "ui/labelslider.h" #include "ui/collapsiblewidget.h" -VolumeEffect::VolumeEffect(Clip* c) : Node(c) { +VolumeEffect::VolumeEffect(Clip* c) : OldEffectNode(c) { volume_val = new DoubleInput(this, "volume", tr("Volume")); // set defaults @@ -61,7 +61,7 @@ olive::TrackType VolumeEffect::subtype() return olive::kTypeAudio; } -NodePtr VolumeEffect::Create(Clip *c) +OldEffectNodePtr VolumeEffect::Create(Clip *c) { return std::make_shared(c); } diff --git a/effects/internal/volumeeffect.h b/effects/internal/volumeeffect.h index d8cdbf81f..98746c463 100644 --- a/effects/internal/volumeeffect.h +++ b/effects/internal/volumeeffect.h @@ -21,9 +21,9 @@ #ifndef VOLUMEEFFECT_H #define VOLUMEEFFECT_H -#include "nodes/node.h" +#include "nodes/oldeffectnode.h" -class VolumeEffect : public Node { +class VolumeEffect : public OldEffectNode { Q_OBJECT public: VolumeEffect(Clip* c); @@ -33,7 +33,7 @@ public: virtual QString description() override; virtual EffectType type() override; virtual olive::TrackType subtype() override; - virtual NodePtr Create(Clip *c) override; + virtual OldEffectNodePtr Create(Clip *c) override; virtual void process_audio(double timecode_start, double timecode_end, diff --git a/effects/internal/vsthost.cpp b/effects/internal/vsthost.cpp index c4d9f2aff..b4ef5a503 100644 --- a/effects/internal/vsthost.cpp +++ b/effects/internal/vsthost.cpp @@ -228,7 +228,7 @@ void VSTHost::send_data_cache_to_plugin() } VSTHost::VSTHost(Clip* c) : - Node(c), + OldEffectNode(c), plugin(nullptr), dialog(nullptr), input_cache(BLOCK_SIZE), @@ -274,7 +274,7 @@ olive::TrackType VSTHost::subtype() return olive::kTypeAudio; } -NodePtr VSTHost::Create(Clip *c) +OldEffectNodePtr VSTHost::Create(Clip *c) { return std::make_shared(c); } @@ -321,7 +321,7 @@ void VSTHost::custom_load(QXmlStreamReader &stream) { } void VSTHost::save(QXmlStreamWriter &stream) { - Node::save(stream); + OldEffectNode::save(stream); if (plugin != nullptr) { char* p = nullptr; int32_t length = int32_t(dispatcher(plugin, effGetChunk, 0, 0, &p, 0)); diff --git a/effects/internal/vsthost.h b/effects/internal/vsthost.h index 39c0be1fd..eea17bf99 100644 --- a/effects/internal/vsthost.h +++ b/effects/internal/vsthost.h @@ -24,7 +24,7 @@ #include #include -#include "nodes/node.h" +#include "nodes/oldeffectnode.h" #include "include/vestige.h" // Plugin's dispatcher function @@ -46,7 +46,7 @@ private: void destroy(); }; -class VSTHost : public Node { +class VSTHost : public OldEffectNode { Q_OBJECT public: VSTHost(Clip* c); @@ -57,7 +57,7 @@ public: virtual QString description() override; virtual EffectType type() override; virtual olive::TrackType subtype() override; - virtual NodePtr Create(Clip *c) override; + virtual OldEffectNodePtr Create(Clip *c) override; virtual void process_audio(double timecode_start, double timecode_end, diff --git a/effects/transition.cpp b/effects/transition.cpp index af25547ad..71cad6f5e 100644 --- a/effects/transition.cpp +++ b/effects/transition.cpp @@ -41,7 +41,7 @@ #include Transition::Transition(Clip *c) : - Node(c), + OldEffectNode(c), secondary_clip(nullptr) { length_field = new DoubleInput(this, "length", tr("Length"), false, false); @@ -57,8 +57,8 @@ Transition::Transition(Clip *c) : connect(length_field, SIGNAL(Changed()), this, SLOT(UpdateMaximumLength())); } -NodePtr Transition::copy(Clip *c) { - NodePtr node = Node::copy(c); +OldEffectNodePtr Transition::copy(Clip *c) { + OldEffectNodePtr node = OldEffectNode::copy(c); static_cast(node.get())->set_length(get_true_length()); @@ -67,7 +67,7 @@ NodePtr Transition::copy(Clip *c) { void Transition::save(QXmlStreamWriter &stream) { stream.writeAttribute("length", QString::number(get_true_length())); - Node::save(stream); + OldEffectNode::save(stream); } void Transition::set_length(int l) { diff --git a/effects/transition.h b/effects/transition.h index 7be393c5c..d17c1fdcb 100644 --- a/effects/transition.h +++ b/effects/transition.h @@ -21,7 +21,7 @@ #ifndef TRANSITION_H #define TRANSITION_H -#include "nodes/node.h" +#include "nodes/oldeffectnode.h" #include "nodes/inputs.h" enum TransitionType { @@ -33,12 +33,12 @@ enum TransitionType { class Transition; using TransitionPtr = std::shared_ptr; -class Transition : public Node { +class Transition : public OldEffectNode { Q_OBJECT public: Transition(Clip* c); - virtual NodePtr copy(Clip* c) override; + virtual OldEffectNodePtr copy(Clip* c) override; Clip* secondary_clip; diff --git a/global/clipboard.cpp b/global/clipboard.cpp index 22d1c4bfc..24fd1346f 100644 --- a/global/clipboard.cpp +++ b/global/clipboard.cpp @@ -21,7 +21,7 @@ #include "clipboard.h" #include "timeline/clip.h" -#include "nodes/node.h" +#include "nodes/oldeffectnode.h" #include "effects/transition.h" #include "undo/undo.h" diff --git a/global/global.cpp b/global/global.cpp index cad59f386..b86719fe5 100644 --- a/global/global.cpp +++ b/global/global.cpp @@ -69,7 +69,7 @@ OliveGlobal::OliveGlobal() : version_id = QString(" | %1").arg(GITHASH); #endif - olive::AppName = QString("Olive (April 2019 | Alpha%1)").arg(version_id); + olive::AppName = QString("Olive (May 2019 | Alpha%1)").arg(version_id); // set the file filter used in all file dialogs pertaining to Olive project files. project_file_filter = tr("Olive Project %1").arg("(*.ove)"); @@ -391,7 +391,7 @@ void OliveGlobal::PasteInternal(Sequence *s, bool insert) Clip* c = selected_clips.at(i); for (int j=0;j(olive::clipboard.Get(j)); + OldEffectNodePtr e = std::static_pointer_cast(olive::clipboard.Get(j)); if (c->type() == e->subtype()) { int found = -1; if (ask_conflict) { @@ -457,7 +457,7 @@ void OliveGlobal::EffectMenuAction(QAction *q) ComboAction* ca = new ComboAction(); NodeType node_type = static_cast(q->data().toInt()); - Node* n = olive::node_library[node_type].get(); + OldEffectNode* n = olive::node_library[node_type].get(); for (int i=0;itype() == type && node->subtype() == subtype) { QAction* action = new QAction(&effects_menu); diff --git a/nodes/inputs/boolinput.cpp b/nodes/inputs/boolinput.cpp index aa98181d6..a9b1d38a2 100644 --- a/nodes/inputs/boolinput.cpp +++ b/nodes/inputs/boolinput.cpp @@ -1,7 +1,7 @@ #include "boolinput.h" -BoolInput::BoolInput(Node* parent, const QString& id, const QString& name, bool savable, bool keyframable) : - EffectRow(parent, id, name, savable, keyframable) +BoolInput::BoolInput(OldEffectNode* parent, const QString& id, const QString& name, bool savable, bool keyframable) : + NodeIO(parent, id, name, savable, keyframable) { BoolField* bool_field = new BoolField(this); connect(bool_field, SIGNAL(Toggled(bool)), this, SIGNAL(Toggled(bool))); diff --git a/nodes/inputs/boolinput.h b/nodes/inputs/boolinput.h index e10660fb3..1291f3e24 100644 --- a/nodes/inputs/boolinput.h +++ b/nodes/inputs/boolinput.h @@ -1,13 +1,13 @@ #ifndef BOOLINPUT_H #define BOOLINPUT_H -#include "effects/effectrow.h" +#include "nodes/nodeio.h" -class BoolInput : public EffectRow +class BoolInput : public NodeIO { Q_OBJECT public: - BoolInput(Node* parent, const QString& id, const QString& name, bool savable = true, bool keyframable = true); + BoolInput(OldEffectNode* parent, const QString& id, const QString& name, bool savable = true, bool keyframable = true); /** * @brief Get the boolean value at a given timecode diff --git a/nodes/inputs/colorinput.cpp b/nodes/inputs/colorinput.cpp index ade47dbd2..fcfb5d62f 100644 --- a/nodes/inputs/colorinput.cpp +++ b/nodes/inputs/colorinput.cpp @@ -1,7 +1,7 @@ #include "colorinput.h" -ColorInput::ColorInput(Node* parent, const QString& id, const QString& name, bool savable, bool keyframable) : - EffectRow(parent, id, name, savable, keyframable) +ColorInput::ColorInput(OldEffectNode* parent, const QString& id, const QString& name, bool savable, bool keyframable) : + NodeIO(parent, id, name, savable, keyframable) { AddField(new ColorField(this)); diff --git a/nodes/inputs/colorinput.h b/nodes/inputs/colorinput.h index 486f18e2e..69a87fd28 100644 --- a/nodes/inputs/colorinput.h +++ b/nodes/inputs/colorinput.h @@ -1,13 +1,13 @@ #ifndef COLORINPUT_H #define COLORINPUT_H -#include "effects/effectrow.h" +#include "nodes/nodeio.h" -class ColorInput : public EffectRow +class ColorInput : public NodeIO { Q_OBJECT public: - ColorInput(Node* parent, const QString& id, const QString& name, bool savable = true, bool keyframable = true); + ColorInput(OldEffectNode* parent, const QString& id, const QString& name, bool savable = true, bool keyframable = true); /** * @brief Get the color value at a given timecode diff --git a/nodes/inputs/comboinput.cpp b/nodes/inputs/comboinput.cpp index 395ff6ebf..c178ce5c4 100644 --- a/nodes/inputs/comboinput.cpp +++ b/nodes/inputs/comboinput.cpp @@ -1,7 +1,7 @@ #include "comboinput.h" -ComboInput::ComboInput(Node* parent, const QString& id, const QString& name, bool savable, bool keyframable) : - EffectRow(parent, id, name, savable, keyframable) +ComboInput::ComboInput(OldEffectNode* parent, const QString& id, const QString& name, bool savable, bool keyframable) : + NodeIO(parent, id, name, savable, keyframable) { ComboField* combo_field = new ComboField(this); connect(combo_field, SIGNAL(DataChanged(const QVariant&)), this, SIGNAL(DataChanged(const QVariant&))); diff --git a/nodes/inputs/comboinput.h b/nodes/inputs/comboinput.h index 25dbc4e91..a0d6ddfb0 100644 --- a/nodes/inputs/comboinput.h +++ b/nodes/inputs/comboinput.h @@ -1,13 +1,13 @@ #ifndef COMBOINPUT_H #define COMBOINPUT_H -#include "effects/effectrow.h" +#include "nodes/nodeio.h" -class ComboInput : public EffectRow +class ComboInput : public NodeIO { Q_OBJECT public: - ComboInput(Node* parent, const QString& id, const QString& name, bool savable = true, bool keyframable = true); + ComboInput(OldEffectNode* parent, const QString& id, const QString& name, bool savable = true, bool keyframable = true); /** * @brief Add an item to this ComboInput diff --git a/nodes/inputs/fileinput.cpp b/nodes/inputs/fileinput.cpp index 4f8d5c808..04c0633d4 100644 --- a/nodes/inputs/fileinput.cpp +++ b/nodes/inputs/fileinput.cpp @@ -1,7 +1,7 @@ #include "fileinput.h" -FileInput::FileInput(Node* parent, const QString& id, const QString& name, bool savable, bool keyframable) : - EffectRow(parent, id, name, savable, keyframable) +FileInput::FileInput(OldEffectNode* parent, const QString& id, const QString& name, bool savable, bool keyframable) : + NodeIO(parent, id, name, savable, keyframable) { AddField(new FileField(this)); diff --git a/nodes/inputs/fileinput.h b/nodes/inputs/fileinput.h index 1793e5b97..dc089affb 100644 --- a/nodes/inputs/fileinput.h +++ b/nodes/inputs/fileinput.h @@ -1,13 +1,13 @@ #ifndef FILEINPUT_H #define FILEINPUT_H -#include "effects/effectrow.h" +#include "nodes/nodeio.h" -class FileInput : public EffectRow +class FileInput : public NodeIO { Q_OBJECT public: - FileInput(Node* parent, const QString& id, const QString& name, bool savable = true, bool keyframable = true); + FileInput(OldEffectNode* parent, const QString& id, const QString& name, bool savable = true, bool keyframable = true); /** * @brief Get the filename at the given timecode diff --git a/nodes/inputs/fontinput.cpp b/nodes/inputs/fontinput.cpp index ec9ba7077..daadb0d1f 100644 --- a/nodes/inputs/fontinput.cpp +++ b/nodes/inputs/fontinput.cpp @@ -1,7 +1,7 @@ #include "fontinput.h" -FontInput::FontInput(Node* parent, const QString& id, const QString& name, bool savable, bool keyframable) : - EffectRow(parent, id, name, savable, keyframable) +FontInput::FontInput(OldEffectNode* parent, const QString& id, const QString& name, bool savable, bool keyframable) : + NodeIO(parent, id, name, savable, keyframable) { AddField(new FontField(this)); diff --git a/nodes/inputs/fontinput.h b/nodes/inputs/fontinput.h index cfcb34c55..f2a67468f 100644 --- a/nodes/inputs/fontinput.h +++ b/nodes/inputs/fontinput.h @@ -1,13 +1,13 @@ #ifndef FONTINPUT_H #define FONTINPUT_H -#include "effects/effectrow.h" +#include "nodes/nodeio.h" -class FontInput : public EffectRow +class FontInput : public NodeIO { Q_OBJECT public: - FontInput(Node* parent, const QString& id, const QString& name, bool savable = true, bool keyframable = true); + FontInput(OldEffectNode* parent, const QString& id, const QString& name, bool savable = true, bool keyframable = true); /** * @brief Get the font family name at the given timecode diff --git a/nodes/inputs/stringinput.cpp b/nodes/inputs/stringinput.cpp index 121051ea8..1e78d5190 100644 --- a/nodes/inputs/stringinput.cpp +++ b/nodes/inputs/stringinput.cpp @@ -1,7 +1,7 @@ #include "stringinput.h" -StringInput::StringInput(Node* parent, const QString& id, const QString& name, bool rich_text, bool savable, bool keyframable) : - EffectRow(parent, id, name, savable, keyframable) +StringInput::StringInput(OldEffectNode* parent, const QString& id, const QString& name, bool rich_text, bool savable, bool keyframable) : + NodeIO(parent, id, name, savable, keyframable) { AddField(new StringField(this, rich_text)); diff --git a/nodes/inputs/stringinput.h b/nodes/inputs/stringinput.h index d738d2fe3..ad6b01d8e 100644 --- a/nodes/inputs/stringinput.h +++ b/nodes/inputs/stringinput.h @@ -1,13 +1,13 @@ #ifndef STRINGINPUT_H #define STRINGINPUT_H -#include "effects/effectrow.h" +#include "nodes/nodeio.h" -class StringInput : public EffectRow +class StringInput : public NodeIO { Q_OBJECT public: - StringInput(Node* parent, + StringInput(OldEffectNode* parent, const QString& id, const QString& name, bool rich_text = true, diff --git a/nodes/inputs/vecinput.cpp b/nodes/inputs/vecinput.cpp index f99666c6b..050e208ce 100644 --- a/nodes/inputs/vecinput.cpp +++ b/nodes/inputs/vecinput.cpp @@ -4,8 +4,8 @@ #include #include -VecInput::VecInput(Node* parent, const QString& id, const QString& name, int values, bool savable, bool keyframable) : - EffectRow(parent, id, name, savable, keyframable), +VecInput::VecInput(OldEffectNode* parent, const QString& id, const QString& name, int values, bool savable, bool keyframable) : + NodeIO(parent, id, name, savable, keyframable), single_value_mode_(false), values_(values) { @@ -79,7 +79,7 @@ void VecInput::SetSingleValueMode(bool on) } } -DoubleInput::DoubleInput(Node *parent, const QString &id, const QString &name, bool savable, bool keyframable) : +DoubleInput::DoubleInput(OldEffectNode *parent, const QString &id, const QString &name, bool savable, bool keyframable) : VecInput(parent, id, name, 1, savable, keyframable) { } @@ -89,7 +89,7 @@ double DoubleInput::GetDoubleAt(double timecode) return static_cast(Field(0))->GetDoubleAt(timecode); } -Vec2Input::Vec2Input(Node *parent, const QString &id, const QString &name, bool savable, bool keyframable) : +Vec2Input::Vec2Input(OldEffectNode *parent, const QString &id, const QString &name, bool savable, bool keyframable) : VecInput(parent, id, name, 2, savable, keyframable) { } @@ -121,7 +121,7 @@ void Vec2Input::SetValueAt(double timecode, const QVariant &value) static_cast(Field(1))->SetValueAt(timecode, vec2.y()); } -Vec3Input::Vec3Input(Node *parent, const QString &id, const QString &name, bool savable, bool keyframable) : +Vec3Input::Vec3Input(OldEffectNode *parent, const QString &id, const QString &name, bool savable, bool keyframable) : VecInput(parent, id, name, 3, savable, keyframable) { } @@ -156,7 +156,7 @@ void Vec3Input::SetValueAt(double timecode, const QVariant &value) static_cast(Field(2))->SetValueAt(timecode, vec3.z()); } -Vec4Input::Vec4Input(Node *parent, const QString &id, const QString &name, bool savable, bool keyframable) : +Vec4Input::Vec4Input(OldEffectNode *parent, const QString &id, const QString &name, bool savable, bool keyframable) : VecInput(parent, id, name, 4, savable, keyframable) { } diff --git a/nodes/inputs/vecinput.h b/nodes/inputs/vecinput.h index 7fda0aaca..d1149d235 100644 --- a/nodes/inputs/vecinput.h +++ b/nodes/inputs/vecinput.h @@ -3,13 +3,13 @@ #include -#include "effects/effectrow.h" +#include "nodes/nodeio.h" -class VecInput : public EffectRow +class VecInput : public NodeIO { Q_OBJECT public: - VecInput(Node* parent, const QString& id, const QString& name, int values, bool savable = true, bool keyframable = true); + VecInput(OldEffectNode* parent, const QString& id, const QString& name, int values, bool savable = true, bool keyframable = true); void SetMinimum(double minimum); void SetMaximum(double maximum); @@ -43,14 +43,14 @@ private: class DoubleInput : public VecInput { public: - DoubleInput(Node* parent, const QString& id, const QString& name, bool savable = true, bool keyframable = true); + DoubleInput(OldEffectNode* parent, const QString& id, const QString& name, bool savable = true, bool keyframable = true); double GetDoubleAt(double timecode); }; class Vec2Input : public VecInput { public: - Vec2Input(Node* parent, const QString& id, const QString& name, bool savable = true, bool keyframable = true); + Vec2Input(OldEffectNode* parent, const QString& id, const QString& name, bool savable = true, bool keyframable = true); QVector2D GetVector2DAt(double timecode); virtual QVariant GetValueAt(double timecode) override; @@ -59,7 +59,7 @@ public: class Vec3Input : public VecInput { public: - Vec3Input(Node* parent, const QString& id, const QString& name, bool savable = true, bool keyframable = true); + Vec3Input(OldEffectNode* parent, const QString& id, const QString& name, bool savable = true, bool keyframable = true); QVector3D GetVector3DAt(double timecode); virtual QVariant GetValueAt(double timecode) override; @@ -68,7 +68,7 @@ public: class Vec4Input : public VecInput { public: - Vec4Input(Node* parent, const QString& id, const QString& name, bool savable = true, bool keyframable = true); + Vec4Input(OldEffectNode* parent, const QString& id, const QString& name, bool savable = true, bool keyframable = true); QVector4D GetVector4DAt(double timecode); virtual QVariant GetValueAt(double timecode) override; diff --git a/nodes/node.cpp b/nodes/node.cpp index 17c11c6c6..a42738023 100644 --- a/nodes/node.cpp +++ b/nodes/node.cpp @@ -1,943 +1,6 @@ -/*** - - 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 . - -***/ - -#include "node.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "panels/panels.h" -#include "panels/viewer.h" -#include "ui/viewerwidget.h" -#include "ui/collapsiblewidget.h" -#include "panels/project.h" -#include "undo/undo.h" -#include "timeline/sequence.h" -#include "timeline/clip.h" -#include "panels/timeline.h" -#include "panels/effectcontrols.h" -#include "panels/grapheditor.h" -#include "global/debug.h" -#include "global/path.h" -#include "ui/mainwindow.h" -#include "ui/menu.h" -#include "global/math.h" -#include "global/clipboard.h" -#include "global/config.h" -#include "effects/transition.h" -#include "undo/undostack.h" -#include "rendering/shadergenerators.h" -#include "global/timing.h" -#include "nodes/nodes.h" -#include "effects/effectloaders.h" - -QVector olive::node_library; - -Node::Node(Clip* c) : - parent_clip(c), - flags_(0), - shader_program_(nullptr), - texture(0), - tex_width_(0), - tex_height_(0), - isOpen(false), - bound(false), - iterations(1), - enabled_(true), - expanded_(true), - texture_ctx(nullptr) -{ -} - -Node::~Node() { - if (isOpen) { - close(); - } - - // Clear graph editor if it's using one of these rows - if (panel_graph_editor != nullptr) { - for (int i=0;iget_row()) { - panel_graph_editor->set_row(nullptr); - break; - } - } - } -} - -QString Node::category() -{ - return QString(); -} - -bool Node::IsCreatable() -{ - return true; -} - -void Node::AddRow(EffectRow *row) -{ - row->setParent(this); - rows.append(row); -} - -int Node::IndexOfRow(EffectRow *row) -{ - return rows.indexOf(row); -} - -void Node::copy_field_keyframes(NodePtr e) { - for (int i=0;irows.at(i); - copy_row->SetKeyframingInternal(row->IsKeyframing()); - for (int j=0;jFieldCount();j++) { - // Get field from this (the source) effect - EffectField* field = row->Field(j); - - // Get field from the destination effect - EffectField* copy_field = copy_row->Field(j); - - // Copy keyframes between effects - copy_field->keyframes = field->keyframes; - - // Copy persistet data between effects - copy_field->persistent_data_ = field->persistent_data_; - } - } -} - -EffectRow* Node::row(int i) { - return rows.at(i); -} - -int Node::row_count() { - return rows.size(); -} - -EffectGizmo *Node::add_gizmo(int type) { - EffectGizmo* gizmo = new EffectGizmo(this, type); - gizmos.append(gizmo); - return gizmo; -} - -EffectGizmo *Node::gizmo(int i) { - return gizmos.at(i); -} - -int Node::gizmo_count() { - return gizmos.size(); -} - -QVector Node::GetAllEdges() -{ - QVector edges; - - for (int i=0;iedges()); - } - - return edges; -} - -void Node::refresh() {} - -void Node::FieldChanged() { - // Update the UI if a field has been modified, but don't both if this effect is inactive - if (parent_clip != nullptr) { - update_ui(false); - } -} - -void Node::delete_self() { - olive::undo_stack.push(new EffectDeleteCommand(this)); - update_ui(true); -} - -void Node::move_up() { - int index_of_effect = parent_clip->IndexOfEffect(this); - if (index_of_effect == 0) { - return; - } - - MoveEffectCommand* command = new MoveEffectCommand(); - command->clip = parent_clip; - command->from = index_of_effect; - command->to = command->from - 1; - olive::undo_stack.push(command); - panel_effect_controls->Reload(); - panel_sequence_viewer->viewer_widget()->frame_update(); -} - -void Node::move_down() { - int index_of_effect = parent_clip->IndexOfEffect(this); - if (index_of_effect == parent_clip->effects.size()-1) { - return; - } - - MoveEffectCommand* command = new MoveEffectCommand(); - command->clip = parent_clip; - command->from = index_of_effect; - command->to = command->from + 1; - olive::undo_stack.push(command); - panel_effect_controls->Reload(); - panel_sequence_viewer->viewer_widget()->frame_update(); -} - -void Node::save_to_file() { - // save effect settings to file - QString file = QFileDialog::getSaveFileName(olive::MainWindow, - tr("Save Effect Settings"), - QString(), - tr("Effect XML Settings %1").arg("(*.xml)")); - - // if the user picked a file - if (!file.isEmpty()) { - - // ensure file ends with .xml extension - if (!file.endsWith(".xml", Qt::CaseInsensitive)) { - file.append(".xml"); - } - - QFile file_handle(file); - if (file_handle.open(QFile::WriteOnly)) { - - file_handle.write(save_to_string()); - - file_handle.close(); - } else { - QMessageBox::critical(olive::MainWindow, - tr("Save Settings Failed"), - tr("Failed to open \"%1\" for writing.").arg(file), - QMessageBox::Ok); - } - } -} - -void Node::load_from_file() { - // load effect settings from file - QString file = QFileDialog::getOpenFileName(olive::MainWindow, - tr("Load Effect Settings"), - QString(), - tr("Effect XML Settings %1").arg("(*.xml)")); - - // if the user picked a file - if (!file.isEmpty()) { - QFile file_handle(file); - if (file_handle.open(QFile::ReadOnly)) { - - olive::undo_stack.push(new SetEffectData(this, file_handle.readAll())); - - file_handle.close(); - - update_ui(false); - } else { - QMessageBox::critical(olive::MainWindow, - tr("Load Settings Failed"), - tr("Failed to open \"%1\" for reading.").arg(file), - QMessageBox::Ok); - } - } -} - -bool Node::AlwaysUpdate() -{ - return false; -} - -bool Node::IsEnabled() { - return enabled_; -} - -bool Node::IsExpanded() -{ - return expanded_; -} - -void Node::SetExpanded(bool e) -{ - expanded_ = e; -} - -void Node::SetPos(const QPointF &pos) -{ - pos_ = pos; -} - -void Node::SetEnabled(bool b) { - enabled_ = b; - emit EnabledChanged(b); -} - -void Node::load(QXmlStreamReader& stream) { - /* - int row_count = 0; - - QString tag = stream.name().toString(); - - while (!stream.atEnd() && !(stream.name() == tag && stream.isEndElement())) { - stream.readNext(); - if (stream.name() == "row" && stream.isStartElement()) { - if (row_count < rows.size()) { - EffectRow* row = rows.at(row_count); - - while (!stream.atEnd() && !(stream.name() == "row" && stream.isEndElement())) { - stream.readNext(); - - // read field - if (stream.name() == "field" && stream.isStartElement()) { - int field_number = -1; - - // match field using ID - for (int k=0;kFieldCount();l++) { - if (row->Field(l)->id() == attr.value()) { - field_number = l; - break; - } - } - break; - } - } - - if (field_number > -1) { - EffectField* field = row->Field(field_number); - - // get current field value - for (int k=0;kpersistent_data_ = field->ConvertStringToValue(attr.value().toString()); - break; - } - } - - while (!stream.atEnd() && !(stream.name() == "field" && stream.isEndElement())) { - stream.readNext(); - - // read keyframes - if (stream.name() == "key" && stream.isStartElement()) { - row->SetKeyframingInternal(true); - - EffectKeyframe key; - for (int k=0;kConvertStringToValue(attr.value().toString()); - } else if (attr.name() == "frame") { - key.time = attr.value().toLong(); - } else if (attr.name() == "type") { - key.type = attr.value().toInt(); - } else if (attr.name() == "prehx") { - key.pre_handle_x = attr.value().toDouble(); - } else if (attr.name() == "prehy") { - key.pre_handle_y = attr.value().toDouble(); - } else if (attr.name() == "posthx") { - key.post_handle_x = attr.value().toDouble(); - } else if (attr.name() == "posthy") { - key.post_handle_y = attr.value().toDouble(); - } - } - field->keyframes.append(key); - } - } - - field->Changed(); - - } - } - } - - } else { - qCritical() << "Too many rows for effect" << id << ". Project might be corrupt. (Got" << row_count << ", expected <" << rows.size()-1 << ")"; - } - row_count++; - } else if (stream.isStartElement()) { - custom_load(stream); - } - } - */ -} - -void Node::custom_load(QXmlStreamReader &) {} - -void Node::save(QXmlStreamWriter& stream) { - /* - stream.writeAttribute("name", meta->category + "/" + meta->name); - stream.writeAttribute("enabled", QString::number(IsEnabled())); - - for (int i=0;iIsSavable()) { - stream.writeStartElement("row"); // row - for (int j=0;jFieldCount();j++) { - EffectField* field = row->Field(j); - - if (!field->id().isEmpty()) { - stream.writeStartElement("field"); // field - stream.writeAttribute("id", field->id()); - stream.writeAttribute("value", field->ConvertValueToString(field->persistent_data_)); - for (int k=0;kkeyframes.size();k++) { - const EffectKeyframe& key = field->keyframes.at(k); - stream.writeStartElement("key"); - stream.writeAttribute("value", field->ConvertValueToString(key.data)); - stream.writeAttribute("frame", QString::number(key.time)); - stream.writeAttribute("type", QString::number(key.type)); - stream.writeAttribute("prehx", QString::number(key.pre_handle_x)); - stream.writeAttribute("prehy", QString::number(key.pre_handle_y)); - stream.writeAttribute("posthx", QString::number(key.post_handle_x)); - stream.writeAttribute("posthy", QString::number(key.post_handle_y)); - stream.writeEndElement(); // key - } - stream.writeEndElement(); // field - } - } - stream.writeEndElement(); // row - } - } - */ -} - -void Node::load_from_string(const QByteArray &s) { - // clear existing keyframe data - for (int i=0;iSetKeyframingInternal(false); - for (int j=0;jFieldCount();j++) { - EffectField* field = row->Field(j); - field->keyframes.clear(); - } - } - - // write settings with xml writer - QXmlStreamReader stream(s); - - bool found_id = false; - - while (!stream.atEnd()) { - stream.readNext(); - - // find the effect opening tag - if (stream.name() == "effect" && stream.isStartElement()) { - - // check the name to see if it matches this effect - const QXmlStreamAttributes& attributes = stream.attributes(); - for (int i=0;ipath.isEmpty() || (shader_vert_path_.isEmpty() && shader_frag_path_.isEmpty())) return; - QList effects_paths = get_effects_paths(); - const QString& test_fn = shader_vert_path_.isEmpty() ? shader_frag_path_ : shader_vert_path_; - for (int i=0;iisLinked(); -} - -QOpenGLShaderProgram *Node::GetShaderPipeline() -{ - return shader_program_.get(); -} - -int Node::Flags() -{ - return flags_; -} - -void Node::SetFlags(int flags) -{ - flags_ = flags; -} - -int Node::getIterations() { - return iterations; -} - -void Node::setIterations(int i) { - iterations = i; -} - -const QPointF &Node::pos() -{ - return pos_; -} - -void Node::process_image(double, uint8_t *, uint8_t *, int){} - -NodePtr Node::copy(Clip *c) { - NodePtr copy = Create(c); - copy->SetEnabled(IsEnabled()); - copy_field_keyframes(copy); - return copy; -} - -void Node::process_shader(double timecode, GLTextureCoords&, int iteration) { - /* - shader_program_->bind(); - - shader_program_->setUniformValue("resolution", parent_clip->media_width(), parent_clip->media_height()); - shader_program_->setUniformValue("time", GLfloat(timecode)); - shader_program_->setUniformValue("iteration", iteration); - - for (int i=0;iFieldCount();j++) { - EffectField* field = row->Field(j); - if (!field->id().isEmpty()) { - switch (field->type()) { - case EffectField::EFFECT_FIELD_DOUBLE: - { - DoubleField* double_field = static_cast(field); - shader_program_->setUniformValue(double_field->id().toUtf8().constData(), - GLfloat(double_field->GetDoubleAt(timecode))); - } - break; - case EffectField::EFFECT_FIELD_COLOR: - { - ColorField* color_field = static_cast(field); - shader_program_->setUniformValue( - color_field->id().toUtf8().constData(), - GLfloat(color_field->GetColorAt(timecode).redF()), - GLfloat(color_field->GetColorAt(timecode).greenF()), - GLfloat(color_field->GetColorAt(timecode).blueF()) - ); - } - break; - case EffectField::EFFECT_FIELD_BOOL: - shader_program_->setUniformValue(field->id().toUtf8().constData(), field->GetValueAt(timecode).toBool()); - break; - case EffectField::EFFECT_FIELD_COMBO: - shader_program_->setUniformValue(field->id().toUtf8().constData(), field->GetValueAt(timecode).toInt()); - break; - - // can you even send a string to a uniform value? - case EffectField::EFFECT_FIELD_STRING: - case EffectField::EFFECT_FIELD_FONT: - case EffectField::EFFECT_FIELD_FILE: - case EffectField::EFFECT_FIELD_UI: - break; - } - } - } - } - - shader_program_->release(); - */ -} - -void Node::process_coords(double, GLTextureCoords&, int) {} - -GLuint Node::process_superimpose(QOpenGLContext* ctx, double timecode) { - bool dimensions_changed = false; - bool redrew_image = false; - - int width = parent_clip->media_width(); - int height = parent_clip->media_height(); - - if (width != img.width() || height != img.height()) { - img = QImage(width, height, QImage::Format_RGBA8888_Premultiplied); - dimensions_changed = true; - } - - if (valueHasChanged(timecode) || dimensions_changed || AlwaysUpdate()) { - redraw(timecode); - redrew_image = true; - } - - QOpenGLFunctions* f = ctx->functions(); - - if (texture == 0 || tex_width_ != img.width() || tex_height_ != img.height()) { - delete_texture(); - - tex_width_ = img.width(); - tex_height_ = img.height(); - - // create texture object - f->glGenTextures(1, &texture); - - f->glBindTexture(GL_TEXTURE_2D, texture); - - // set texture filtering to bilinear - f->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - f->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - - f->glTexImage2D( - GL_TEXTURE_2D, 0, GL_RGBA8, tex_width_, tex_height_, 0, GL_RGBA, GL_UNSIGNED_BYTE, img.constBits() - ); - - f->glBindTexture(GL_TEXTURE_2D, 0); - - redrew_image = false; - } - - if (redrew_image) { - f->glBindTexture(GL_TEXTURE_2D, texture); - - f->glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, tex_width_, tex_height_, GL_RGBA, GL_UNSIGNED_BYTE, img.constBits()); - - f->glBindTexture(GL_TEXTURE_2D, 0); - } - - return texture; -} - -void Node::process_audio(double, double, float **, int, int, int) {} - -void Node::gizmo_draw(double, GLTextureCoords &) {} - -void Node::gizmo_move(EffectGizmo* gizmo, int x_movement, int y_movement, double timecode, bool done) { - // Loop through each gizmo to find `gizmo` - for (int i=0;ix_field1 != nullptr) { - gizmo_dragging_actions_.append(new KeyframeDataChange(gizmo->x_field1)); - } - if (gizmo->y_field1 != nullptr) { - gizmo_dragging_actions_.append(new KeyframeDataChange(gizmo->y_field1)); - } - if (gizmo->x_field2 != nullptr) { - gizmo_dragging_actions_.append(new KeyframeDataChange(gizmo->x_field2)); - } - if (gizmo->y_field2 != nullptr) { - gizmo_dragging_actions_.append(new KeyframeDataChange(gizmo->y_field2)); - } - } - - // Update the field values - if (gizmo->x_field1 != nullptr) { - gizmo->x_field1->SetValueAt(timecode, - gizmo->x_field1->GetDoubleAt(timecode) + x_movement*gizmo->x_field_multi1); - } - if (gizmo->y_field1 != nullptr) { - gizmo->y_field1->SetValueAt(timecode, - gizmo->y_field1->GetDoubleAt(timecode) + y_movement*gizmo->y_field_multi1); - } - if (gizmo->x_field2 != nullptr) { - gizmo->x_field2->SetValueAt(timecode, - gizmo->x_field2->GetDoubleAt(timecode) + x_movement*gizmo->x_field_multi2); - } - if (gizmo->y_field2 != nullptr) { - gizmo->y_field2->SetValueAt(timecode, - gizmo->y_field2->GetDoubleAt(timecode) + y_movement*gizmo->y_field_multi2); - } - - // If (done && !gizmo_dragging_actions_.isEmpty()), that means the drag just ended and we're going to save - // the new state of the attach fields' keyframes in KeyframeDataChange objects to make the changes undoable - // by the user later. - if (done && !gizmo_dragging_actions_.isEmpty()) { - - // Store all the KeyframeDataChange objects into a ComboAction to send to the undo stack (makes them all - // undoable together rather than having to be undone individually). - ComboAction* ca = new ComboAction(); - - for (int j=0;jSetNewKeyframes(); - - // Add this KeyframeDataChange object to the ComboAction - ca->append(gizmo_dragging_actions_.at(j)); - } - - olive::undo_stack.push(ca); - - gizmo_dragging_actions_.clear(); - } - break; - } - } -} - -void Node::gizmo_world_to_screen(const QMatrix4x4& matrix, const QMatrix4x4& projection) { - for (int i=0;iget_point_count();j++) { - - // Convert the world point from the gizmo into a screen point relative to the sequence's dimensions - - QVector3D screen_pos = g->world_pos.at(j).project(matrix, - projection, - QRect(0, - 0, - parent_clip->track()->sequence()->width, - parent_clip->track()->sequence()->height)); - - g->screen_pos[j] = QPoint(screen_pos.x(), parent_clip->track()->sequence()->height-screen_pos.y()); - - } - } -} - -bool Node::are_gizmos_enabled() { - return (gizmos.size() > 0); -} - -double Node::Now() -{ - return playhead_to_clip_seconds(parent_clip, parent_clip->track()->sequence()->playhead); -} - -long Node::NowInFrames() -{ - return playhead_to_clip_frame(parent_clip, parent_clip->track()->sequence()->playhead); -} - -void Node::redraw(double) { - /* - // run javascript - QPainter p(&img); - painter_wrapper.img = &img; - painter_wrapper.painter = &p; - - jsEngine.globalObject().setProperty("painter", wrapper_obj); - jsEngine.globalObject().setProperty("width", parent_clip->media_width()); - jsEngine.globalObject().setProperty("height", parent_clip->media_height()); - - for (int i=0;ifieldCount();j++) { - EffectField* field = row->field(j); - if (!field->id.isEmpty()) { - switch (field->type) { - case EffectField::EFFECT_FIELD_DOUBLE: - jsEngine.globalObject().setProperty(field->id, field->get_double_value(timecode)); - break; - case EffectField::EFFECT_FIELD_COLOR: - jsEngine.globalObject().setProperty(field->id, field->get_color_value(timecode).name()); - break; - case EffectField::EFFECT_FIELD_STRING: - jsEngine.globalObject().setProperty(field->id, field->get_string_value(timecode)); - break; - case EffectField::EFFECT_FIELD_BOOL: - jsEngine.globalObject().setProperty(field->id, field->get_bool_value(timecode)); - break; - case EffectField::EFFECT_FIELD_COMBO: - jsEngine.globalObject().setProperty(field->id, field->get_combo_index(timecode)); - break; - case EffectField::EFFECT_FIELD_FONT: - jsEngine.globalObject().setProperty(field->id, field->get_font_name(timecode)); - break; - } - } - } - } - - jsEngine.evaluate(script); - */ -} - -bool Node::valueHasChanged(double timecode) { - if (cachedValues.isEmpty()) { - - for (int i=0;iFieldCount();j++) { - cachedValues.append(crow->Field(j)->GetValueAt(timecode)); - } - } - return true; - - } else { - - bool changed = false; - int index = 0; - for (int i=0;iFieldCount();j++) { - EffectField* field = crow->Field(j); - if (cachedValues.at(index) != field->GetValueAt(timecode)) { - changed = true; - } - cachedValues[index] = field->GetValueAt(timecode); - index++; - } - } - return changed; - - } -} - -void Node::delete_texture() { - if (texture_ctx != nullptr) { - texture_ctx->functions()->glDeleteTextures(1, &texture); - texture = 0; - texture_ctx = nullptr; - } -} - -int GetNodeLibraryIndexFromId(const QString& id) { - for (int i=0;iid() == id) { - return i; - } - } - - return -1; -} - -/* -const EffectMeta* Node::GetMetaFromName(const QString& input) { - int split_index = input.indexOf('/'); - QString category; - if (split_index > -1) { - category = input.left(split_index); - } - QString name = input.mid(split_index + 1); - - for (int j=0;j. - -***/ - -#ifndef EFFECT_H -#define EFFECT_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "timeline/tracktypes.h" -#include "rendering/qopenglshaderprogramptr.h" -#include "inputs.h" -#include "effects/effectgizmo.h" - -class EffectGizmo; -class KeyframeDataChange; - -class Clip; -using ClipPtr = std::shared_ptr; - -class Node; -using NodePtr = std::shared_ptr; - -enum NodeType { - kTransformEffect, - kTextInput, - kSolidInput, - kNoiseInput, - kVolumeEffect, - kPanEffect, - kToneInput, - kShakeEffect, - kTimecodeEffect, - kMaskEffect, - kFillLeftRightEffect, - kVstEffect, - kCornerPinEffect, - kRichTextInput, - kMediaInput, - kShaderEffect, - kImageOutput, - kCrossDissolveTransition, - kLinearFadeTransition, - kExponentialFadeTransition, - kLogarithmicFadeTransition, - kInvalidNode -}; - -double log_volume(double linear); - -enum EffectType { - EFFECT_TYPE_INVALID, - EFFECT_TYPE_EFFECT, - EFFECT_TYPE_TRANSITION -}; - -enum EffectKeyframeType { - EFFECT_KEYFRAME_LINEAR, - EFFECT_KEYFRAME_BEZIER, - EFFECT_KEYFRAME_HOLD -}; - -struct GLTextureCoords { - QMatrix4x4 matrix; - - QVector3D vertex_top_left; - QVector3D vertex_top_right; - QVector3D vertex_bottom_left; - QVector3D vertex_bottom_right; - - QVector2D texture_top_left; - QVector2D texture_top_right; - QVector2D texture_bottom_left; - QVector2D texture_bottom_right; - - float opacity; -}; - -class Node : public QObject { - Q_OBJECT -public: - Node(Clip *c); - ~Node(); - - Clip* parent_clip; - - virtual QString name() = 0; - virtual QString id() = 0; - virtual QString category(); - virtual QString description() = 0; - virtual EffectType type() = 0; - virtual olive::TrackType subtype() = 0; - virtual bool IsCreatable(); - virtual NodePtr Create(Clip *c) = 0; - - void AddRow(EffectRow* row); - int IndexOfRow(EffectRow* row); - EffectRow* row(int i); - int row_count(); - - EffectGizmo* add_gizmo(int type); - EffectGizmo* gizmo(int i); - int gizmo_count(); - - QVector GetAllEdges(); - - bool IsEnabled(); - bool IsExpanded(); - - virtual void refresh(); - - virtual NodePtr copy(Clip* c); - void copy_field_keyframes(NodePtr e); - - virtual void load(QXmlStreamReader& stream); - virtual void custom_load(QXmlStreamReader& stream); - virtual void save(QXmlStreamWriter& stream); - - void load_from_string(const QByteArray &s); - QByteArray save_to_string(); - - // glsl handling - bool is_open(); - void open(); - void close(); - bool is_shader_linked(); - QOpenGLShaderProgram* GetShaderPipeline(); - - enum VideoEffectFlags { - ShaderFlag = 0x1, - CoordsFlag = 0x2, - SuperimposeFlag = 0x4 - }; - int Flags(); - void SetFlags(int flags); - - int getIterations(); - void setIterations(int i); - - const QPointF& pos(); - - virtual void process_image(double timecode, uint8_t* input, uint8_t* output, int size); - virtual void process_shader(double timecode, GLTextureCoords&, int iteration); - virtual void process_coords(double timecode, GLTextureCoords& coords, int data); - virtual GLuint process_superimpose(QOpenGLContext *ctx, double timecode); - virtual void process_audio(double timecode_start, double timecode_end, float **samples, int nb_samples, int nb_channels, int type); - - virtual void gizmo_draw(double timecode, GLTextureCoords& coords); - void gizmo_move(EffectGizmo* sender, int x_movement, int y_movement, double timecode, bool done); - 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 - T randomNumber() - { - static std::random_device device; - static std::mt19937 generator(device()); - static std::uniform_int_distribution<> distribution(std::numeric_limits::min(), std::numeric_limits::max()); - return distribution(generator); - } - - template - T randomFloat() - { - static std::random_device device; - static std::mt19937 generator(device()); - static std::uniform_int_distribution<> distribution(-1.0, 1.0); - return distribution(generator); - } - -public slots: - void FieldChanged(); - void SetEnabled(bool b); - void SetExpanded(bool e); - void SetPos(const QPointF& pos); -signals: - void EnabledChanged(bool); -private slots: - void delete_self(); - void move_up(); - void move_down(); - void save_to_file(); - void load_from_file(); -protected: - // glsl effect - QOpenGLShaderProgramPtr shader_program_; - QString shader_vert_path_; - QString shader_frag_path_; - QString shader_function_name_; - - // superimpose effect - QImage img; - GLuint texture; - QOpenGLContext* texture_ctx; - int tex_width_; - int tex_height_; - - // enable effect to update constantly - virtual bool AlwaysUpdate(); - -private: - bool isOpen; - QVector rows; - QVector gizmos; - bool bound; - int iterations; - - bool enabled_; - bool expanded_; - - int flags_; - - QVector gizmo_dragging_actions_; - - QPointF pos_; - - // superimpose functions - virtual void redraw(double timecode); - bool valueHasChanged(double timecode); - QVector cachedValues; - void delete_texture(); - void validate_meta_path(); -}; - -namespace olive { - extern QVector node_library; -} - -#endif // EFFECT_H +#ifndef NODE_H +#define NODE_H + +#include + +class NodeGraph; + +class Node; +using NodePtr = std::shared_ptr; + +class Node +{ +public: + Node(NodeGraph* parent); + +private: + NodeGraph* parent_; +}; + +#endif // NODE_H diff --git a/nodes/nodeedge.cpp b/nodes/nodeedge.cpp index da21eaac8..83f597a21 100644 --- a/nodes/nodeedge.cpp +++ b/nodes/nodeedge.cpp @@ -2,20 +2,20 @@ #include -#include "effects/effectrow.h" +#include "nodes/nodeio.h" -NodeEdge::NodeEdge(EffectRow *output, EffectRow *input) : +NodeEdge::NodeEdge(NodeIO *output, NodeIO *input) : output_(output), input_(input) { } -EffectRow *NodeEdge::output() +NodeIO *NodeEdge::output() { return output_; } -EffectRow *NodeEdge::input() +NodeIO *NodeEdge::input() { return input_; } diff --git a/nodes/nodeedge.h b/nodes/nodeedge.h index a6b49581d..fb18b8326 100644 --- a/nodes/nodeedge.h +++ b/nodes/nodeedge.h @@ -3,7 +3,7 @@ #include -class EffectRow; +class NodeIO; class NodeEdge; using NodeEdgePtr = std::shared_ptr; @@ -26,14 +26,14 @@ public: * * Input/to EffectRow that this edge "ends" at */ - NodeEdge(EffectRow* output, EffectRow* input); + NodeEdge(NodeIO* output, NodeIO* input); - EffectRow* output(); - EffectRow* input(); + NodeIO* output(); + NodeIO* input(); private: - EffectRow* output_; - EffectRow* input_; + NodeIO* output_; + NodeIO* input_; }; #endif // NODEEDGE_H diff --git a/nodes/nodegraph.h b/nodes/nodegraph.h index 4ce08b030..818758e33 100644 --- a/nodes/nodegraph.h +++ b/nodes/nodegraph.h @@ -1,6 +1,8 @@ #ifndef NODEGRAPH_H #define NODEGRAPH_H +#include + #include "nodes/node.h" class NodeGraph @@ -48,6 +50,8 @@ public: private: NodePtr output_node_; + + QVector nodes_; }; #endif // NODEGRAPH_H diff --git a/effects/effectrow.cpp b/nodes/nodeio.cpp similarity index 81% rename from effects/effectrow.cpp rename to nodes/nodeio.cpp index 274ce3479..e215777f8 100644 --- a/effects/effectrow.cpp +++ b/nodes/nodeio.cpp @@ -18,7 +18,7 @@ ***/ -#include "effectrow.h" +#include "nodeio.h" #include #include @@ -32,12 +32,12 @@ #include "panels/effectcontrols.h" #include "panels/viewer.h" #include "panels/grapheditor.h" -#include "nodes/node.h" +#include "nodes/oldeffectnode.h" #include "ui/viewerwidget.h" #include "ui/keyframenavigator.h" #include "ui/clickablelabel.h" -EffectRow::EffectRow(Node *parent, +NodeIO::NodeIO(OldEffectNode *parent, const QString &id, const QString &name, bool savable, @@ -55,7 +55,7 @@ EffectRow::EffectRow(Node *parent, parent->AddRow(this); } -void EffectRow::AddField(EffectField *field) +void NodeIO::AddField(EffectField *field) { field->setParent(this); @@ -65,21 +65,21 @@ void EffectRow::AddField(EffectField *field) fields_.append(field); } -void EffectRow::AddAcceptedNodeInput(olive::nodes::DataType type) +void NodeIO::AddAcceptedNodeInput(olive::nodes::DataType type) { Q_ASSERT(output_type_ == olive::nodes::kInvalid); accepted_inputs_.append(type); } -void EffectRow::ConnectEdge(EffectRow *output, EffectRow *input) +void NodeIO::ConnectEdge(NodeIO *output, NodeIO *input) { // Make sure one is an output and one is an input Q_ASSERT(output->IsNodeInput() != input->IsNodeInput()); // Swap them if necessary if (input->IsNodeOutput()) { - EffectRow* temp = output; + NodeIO* temp = output; output = input; input = temp; } @@ -97,10 +97,10 @@ void EffectRow::ConnectEdge(EffectRow *output, EffectRow *input) emit output->EdgesChanged(); } -void EffectRow::DisconnectEdge(NodeEdgePtr edge) +void NodeIO::DisconnectEdge(NodeEdgePtr edge) { - EffectRow* output = edge->output(); - EffectRow* input = edge->input(); + NodeIO* output = edge->output(); + NodeIO* input = edge->input(); output->node_edges_.removeAll(edge); input->node_edges_.removeAll(edge); @@ -108,61 +108,61 @@ void EffectRow::DisconnectEdge(NodeEdgePtr edge) emit output->EdgesChanged(); } -QVector EffectRow::edges() +QVector NodeIO::edges() { return node_edges_; } -bool EffectRow::IsKeyframing() { +bool NodeIO::IsKeyframing() { return keyframing_; } -void EffectRow::SetKeyframingInternal(bool b) { +void NodeIO::SetKeyframingInternal(bool b) { if (GetParentEffect()->type() != EFFECT_TYPE_TRANSITION) { keyframing_ = b; emit KeyframingSetChanged(keyframing_); } } -bool EffectRow::IsSavable() +bool NodeIO::IsSavable() { return savable_; } -bool EffectRow::IsKeyframable() +bool NodeIO::IsKeyframable() { return keyframable_; } -QVariant EffectRow::GetValueAt(double timecode) +QVariant NodeIO::GetValueAt(double timecode) { Q_ASSERT(FieldCount() == 1); return Field(0)->GetValueAt(timecode); } -void EffectRow::SetValueAt(double timecode, const QVariant &value) +void NodeIO::SetValueAt(double timecode, const QVariant &value) { Q_ASSERT(FieldCount() == 1); Field(0)->SetValueAt(timecode, value); } -void EffectRow::SetEnabled(bool enabled) +void NodeIO::SetEnabled(bool enabled) { for (int i=0;iSetEnabled(enabled); } } -void EffectRow::SetOutputDataType(olive::nodes::DataType type) +void NodeIO::SetOutputDataType(olive::nodes::DataType type) { Q_ASSERT(accepted_inputs_.isEmpty()); output_type_ = type; } -bool EffectRow::CanAcceptDataType(olive::nodes::DataType type) +bool NodeIO::CanAcceptDataType(olive::nodes::DataType type) { if (!IsNodeInput()) { return false; @@ -171,22 +171,22 @@ bool EffectRow::CanAcceptDataType(olive::nodes::DataType type) return accepted_inputs_.contains(type); } -olive::nodes::DataType EffectRow::OutputDataType() +olive::nodes::DataType NodeIO::OutputDataType() { return output_type_; } -bool EffectRow::IsNodeInput() +bool NodeIO::IsNodeInput() { return !accepted_inputs_.isEmpty(); } -bool EffectRow::IsNodeOutput() +bool NodeIO::IsNodeOutput() { return output_type_ != olive::nodes::kInvalid; } -void EffectRow::SetKeyframingEnabled(bool enabled) { +void NodeIO::SetKeyframingEnabled(bool enabled) { if (enabled == keyframing_) { return; } @@ -238,7 +238,7 @@ void EffectRow::SetKeyframingEnabled(bool enabled) { } } -void EffectRow::GoToPreviousKeyframe() { +void NodeIO::GoToPreviousKeyframe() { long key = LONG_MIN; Clip* c = GetParentEffect()->parent_clip; long sequence_playhead = c->track()->sequence()->playhead; @@ -266,7 +266,7 @@ void EffectRow::GoToPreviousKeyframe() { if (key != LONG_MIN) panel_sequence_viewer->seek(key); } -void EffectRow::ToggleKeyframe() { +void NodeIO::ToggleKeyframe() { Clip* c = GetParentEffect()->parent_clip; long sequence_playhead = c->track()->sequence()->playhead; @@ -336,7 +336,7 @@ void EffectRow::ToggleKeyframe() { update_ui(false); } -void EffectRow::GoToNextKeyframe() { +void NodeIO::GoToNextKeyframe() { long key = LONG_MAX; Clip* c = GetParentEffect()->parent_clip; for (int i=0;iseek(key); } -void EffectRow::FocusRow() { +void NodeIO::FocusRow() { panel_graph_editor->set_row(this); } -void EffectRow::SetKeyframeOnAllFields(ComboAction* ca) { +void NodeIO::SetKeyframeOnAllFields(ComboAction* ca) { for (int i=0;iupdate_keyframes(); } -Node *EffectRow::GetParentEffect() +OldEffectNode *NodeIO::GetParentEffect() { - return static_cast(parent()); + return static_cast(parent()); } -const QString &EffectRow::name() { +const QString &NodeIO::name() { return name_; } -EffectField* EffectRow::Field(int i) { +EffectField* NodeIO::Field(int i) { return fields_.at(i); } -int EffectRow::FieldCount() { +int NodeIO::FieldCount() { return fields_.size(); } diff --git a/effects/effectrow.h b/nodes/nodeio.h similarity index 95% rename from effects/effectrow.h rename to nodes/nodeio.h index 5288cd08e..9c79c3957 100644 --- a/effects/effectrow.h +++ b/nodes/nodeio.h @@ -24,7 +24,7 @@ #include #include -class Node; +class OldEffectNode; class QGridLayout; class EffectField; class QLabel; @@ -34,7 +34,7 @@ class QHBoxLayout; class KeyframeNavigator; class ClickableLabel; -#include "effectfields.h" +#include "effects/effectfields.h" #include "nodes/nodeedge.h" /** @@ -49,7 +49,7 @@ class ClickableLabel; * Unlike EffectField, there's no reason to derive from EffectRow as it's simply a container of fields and a few * keyframe functions. */ -class EffectRow : public QObject { +class NodeIO : public QObject { Q_OBJECT public: @@ -84,7 +84,7 @@ public: * Whether keyframing can be enabled on this row or not. This is true by default. Some values you may want to prevent * the user from keyframing (e.g. the filename of a VST plugin), which can be done by setting this to false. */ - EffectRow(Node* parent, + NodeIO(OldEffectNode* parent, const QString& id, const QString& name, bool savable = true, @@ -127,7 +127,7 @@ public: * * @return The parent Effect object that this row is attached to. */ - Node* GetParentEffect(); + OldEffectNode* GetParentEffect(); /** * @brief Return the row's name @@ -286,7 +286,7 @@ public: * * The edge to add (output) or replace the current edge (input). */ - static void ConnectEdge(EffectRow* output, EffectRow* input); + static void ConnectEdge(NodeIO* output, NodeIO* input); /** * @brief Disconnect an edge diff --git a/nodes/nodes/nodeclip.cpp b/nodes/nodes/nodeclip.cpp new file mode 100644 index 000000000..b68d4edd6 --- /dev/null +++ b/nodes/nodes/nodeclip.cpp @@ -0,0 +1,7 @@ +#include "nodeclip.h" + +NodeClip::NodeClip(NodeGraph *graph) : + Node(graph) +{ + +} diff --git a/nodes/nodes/nodeclip.h b/nodes/nodes/nodeclip.h new file mode 100644 index 000000000..242cb88b2 --- /dev/null +++ b/nodes/nodes/nodeclip.h @@ -0,0 +1,25 @@ +#ifndef NODECLIP_H +#define NODECLIP_H + +#include "nodes/node.h" + +class NodeClip : public Node +{ +public: + NodeClip(NodeGraph* graph); + + long in(); + long out(); + long clip_in(); + + void set_in(long in); + void set_out(long out); + void set_clip_in(long clip_in); + +private: + long in_; + long out_; + long clip_in_; +}; + +#endif // NODECLIP_H diff --git a/nodes/nodes/nodeimageoutput.cpp b/nodes/nodes/nodeimageoutput.cpp index 994fa181a..8824a28ac 100644 --- a/nodes/nodes/nodeimageoutput.cpp +++ b/nodes/nodes/nodeimageoutput.cpp @@ -1,9 +1,9 @@ #include "nodeimageoutput.h" NodeImageOutput::NodeImageOutput(Clip *c) : - Node(c) + OldEffectNode(c) { - EffectRow* input_texture = new EffectRow(this, "texture", tr("Texture"), true, false); + NodeIO* input_texture = new NodeIO(this, "texture", tr("Texture"), true, false); input_texture->AddAcceptedNodeInput(olive::nodes::kTexture); } @@ -37,7 +37,7 @@ olive::TrackType NodeImageOutput::subtype() return olive::kTypeVideo; } -NodePtr NodeImageOutput::Create(Clip *c) +OldEffectNodePtr NodeImageOutput::Create(Clip *c) { return std::make_shared(c); } diff --git a/nodes/nodes/nodeimageoutput.h b/nodes/nodes/nodeimageoutput.h index c4ebd2798..5620ae280 100644 --- a/nodes/nodes/nodeimageoutput.h +++ b/nodes/nodes/nodeimageoutput.h @@ -1,9 +1,9 @@ #ifndef NODEIMAGEOUTPUT_H #define NODEIMAGEOUTPUT_H -#include "nodes/node.h" +#include "nodes/oldeffectnode.h" -class NodeImageOutput : public Node +class NodeImageOutput : public OldEffectNode { public: NodeImageOutput(Clip* c); @@ -14,7 +14,7 @@ public: virtual QString description() override; virtual EffectType type() override; virtual olive::TrackType subtype() override; - virtual NodePtr Create(Clip *c) override; + virtual OldEffectNodePtr Create(Clip *c) override; }; #endif // NODEIMAGEOUTPUT_H diff --git a/nodes/nodes/nodemedia.cpp b/nodes/nodes/nodemedia.cpp index f5b3e3272..5304c5626 100644 --- a/nodes/nodes/nodemedia.cpp +++ b/nodes/nodes/nodemedia.cpp @@ -1,12 +1,12 @@ #include "nodemedia.h" NodeMedia::NodeMedia(Clip* c) : - Node(c) + OldEffectNode(c) { - EffectRow* matrix_input = new EffectRow(this, "matrix", tr("Matrix"), true, false); + NodeIO* matrix_input = new NodeIO(this, "matrix", tr("Matrix"), true, false); matrix_input->AddAcceptedNodeInput(olive::nodes::kMatrix); - EffectRow* texture_output = new EffectRow(this, "texture", tr("Texture"), true, false); + NodeIO* texture_output = new NodeIO(this, "texture", tr("Texture"), true, false); texture_output->SetOutputDataType(olive::nodes::kTexture); } @@ -40,7 +40,7 @@ olive::TrackType NodeMedia::subtype() return olive::kTypeVideo; } -NodePtr NodeMedia::Create(Clip *c) +OldEffectNodePtr NodeMedia::Create(Clip *c) { return std::make_shared(c); } diff --git a/nodes/nodes/nodemedia.h b/nodes/nodes/nodemedia.h index 4d97716ca..f0be0c345 100644 --- a/nodes/nodes/nodemedia.h +++ b/nodes/nodes/nodemedia.h @@ -1,9 +1,9 @@ #ifndef MEDIANODE_H #define MEDIANODE_H -#include "nodes/node.h" +#include "nodes/oldeffectnode.h" -class NodeMedia : public Node +class NodeMedia : public OldEffectNode { public: NodeMedia(Clip *c); @@ -14,7 +14,7 @@ public: virtual QString description() override; virtual EffectType type() override; virtual olive::TrackType subtype() override; - virtual NodePtr Create(Clip *c) override; + virtual OldEffectNodePtr Create(Clip *c) override; }; #endif // MEDIANODE_H diff --git a/nodes/nodes/nodeshader.cpp b/nodes/nodes/nodeshader.cpp index d5d924e7c..b68f41b01 100644 --- a/nodes/nodes/nodeshader.cpp +++ b/nodes/nodes/nodeshader.cpp @@ -5,7 +5,7 @@ NodeShader::NodeShader(Clip* c, const QString &id, const QString &category, const QString &filename) : - Node(c), + OldEffectNode(c), name_(name), id_(id), category_(category), @@ -39,7 +39,7 @@ NodeShader::NodeShader(Clip* c, if (id.isEmpty() || name.isEmpty() || type == olive::nodes::kInvalid) { qCritical() << "Couldn't load field from" << filename_ << "- ID, type, and name cannot be empty."; } else { - EffectRow* field = nullptr; + NodeIO* field = nullptr; switch (type) { case olive::nodes::kFloat: @@ -215,7 +215,7 @@ bool NodeShader::IsCreatable() return !filename_.isEmpty(); } -NodePtr NodeShader::Create(Clip *) +OldEffectNodePtr NodeShader::Create(Clip *) { Q_ASSERT(false); return nullptr; diff --git a/nodes/nodes/nodeshader.h b/nodes/nodes/nodeshader.h index a9f401bbd..6925611b7 100644 --- a/nodes/nodes/nodeshader.h +++ b/nodes/nodes/nodeshader.h @@ -1,9 +1,9 @@ #ifndef NODESHADER_H #define NODESHADER_H -#include "nodes/node.h" +#include "nodes/oldeffectnode.h" -class NodeShader : public Node { +class NodeShader : public OldEffectNode { Q_OBJECT public: NodeShader(Clip *c, @@ -19,7 +19,7 @@ public: virtual EffectType type() override; virtual olive::TrackType subtype() override; virtual bool IsCreatable() override; - virtual NodePtr Create(Clip *c) override; + virtual OldEffectNodePtr Create(Clip *c) override; private: QString name_; diff --git a/nodes/oldeffectnode.cpp b/nodes/oldeffectnode.cpp new file mode 100644 index 000000000..dfaddbf86 --- /dev/null +++ b/nodes/oldeffectnode.cpp @@ -0,0 +1,948 @@ +/*** + + 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 . + +***/ + +#include "oldeffectnode.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "panels/panels.h" +#include "panels/viewer.h" +#include "ui/viewerwidget.h" +#include "ui/collapsiblewidget.h" +#include "panels/project.h" +#include "undo/undo.h" +#include "timeline/sequence.h" +#include "timeline/clip.h" +#include "panels/timeline.h" +#include "panels/effectcontrols.h" +#include "panels/grapheditor.h" +#include "global/debug.h" +#include "global/path.h" +#include "ui/mainwindow.h" +#include "ui/menu.h" +#include "global/math.h" +#include "global/clipboard.h" +#include "global/config.h" +#include "effects/transition.h" +#include "undo/undostack.h" +#include "rendering/shadergenerators.h" +#include "global/timing.h" +#include "nodes/nodes.h" +#include "effects/effectloaders.h" + +QVector olive::node_library; + +OldEffectNode::OldEffectNode(Clip* c) : + parent_clip(c), + flags_(0), + shader_program_(nullptr), + texture(0), + tex_width_(0), + tex_height_(0), + isOpen(false), + bound(false), + iterations(1), + enabled_(true), + expanded_(true), + texture_ctx(nullptr) +{ +} + +OldEffectNode::~OldEffectNode() { + if (isOpen) { + close(); + } + + // Clear graph editor if it's using one of these rows + if (panel_graph_editor != nullptr) { + for (int i=0;iget_row()) { + panel_graph_editor->set_row(nullptr); + break; + } + } + } +} + +QString OldEffectNode::category() +{ + return QString(); +} + +QString OldEffectNode::description() +{ + return QString(); +} + +bool OldEffectNode::IsCreatable() +{ + return true; +} + +void OldEffectNode::AddRow(NodeIO *row) +{ + row->setParent(this); + rows.append(row); +} + +int OldEffectNode::IndexOfRow(NodeIO *row) +{ + return rows.indexOf(row); +} + +void OldEffectNode::copy_field_keyframes(OldEffectNodePtr e) { + for (int i=0;irows.at(i); + copy_row->SetKeyframingInternal(row->IsKeyframing()); + for (int j=0;jFieldCount();j++) { + // Get field from this (the source) effect + EffectField* field = row->Field(j); + + // Get field from the destination effect + EffectField* copy_field = copy_row->Field(j); + + // Copy keyframes between effects + copy_field->keyframes = field->keyframes; + + // Copy persistet data between effects + copy_field->persistent_data_ = field->persistent_data_; + } + } +} + +NodeIO* OldEffectNode::row(int i) { + return rows.at(i); +} + +int OldEffectNode::row_count() { + return rows.size(); +} + +EffectGizmo *OldEffectNode::add_gizmo(int type) { + EffectGizmo* gizmo = new EffectGizmo(this, type); + gizmos.append(gizmo); + return gizmo; +} + +EffectGizmo *OldEffectNode::gizmo(int i) { + return gizmos.at(i); +} + +int OldEffectNode::gizmo_count() { + return gizmos.size(); +} + +QVector OldEffectNode::GetAllEdges() +{ + QVector edges; + + for (int i=0;iedges()); + } + + return edges; +} + +void OldEffectNode::refresh() {} + +void OldEffectNode::FieldChanged() { + // Update the UI if a field has been modified, but don't both if this effect is inactive + if (parent_clip != nullptr) { + update_ui(false); + } +} + +void OldEffectNode::delete_self() { + olive::undo_stack.push(new EffectDeleteCommand(this)); + update_ui(true); +} + +void OldEffectNode::move_up() { + int index_of_effect = parent_clip->IndexOfEffect(this); + if (index_of_effect == 0) { + return; + } + + MoveEffectCommand* command = new MoveEffectCommand(); + command->clip = parent_clip; + command->from = index_of_effect; + command->to = command->from - 1; + olive::undo_stack.push(command); + panel_effect_controls->Reload(); + panel_sequence_viewer->viewer_widget()->frame_update(); +} + +void OldEffectNode::move_down() { + int index_of_effect = parent_clip->IndexOfEffect(this); + if (index_of_effect == parent_clip->effects.size()-1) { + return; + } + + MoveEffectCommand* command = new MoveEffectCommand(); + command->clip = parent_clip; + command->from = index_of_effect; + command->to = command->from + 1; + olive::undo_stack.push(command); + panel_effect_controls->Reload(); + panel_sequence_viewer->viewer_widget()->frame_update(); +} + +void OldEffectNode::save_to_file() { + // save effect settings to file + QString file = QFileDialog::getSaveFileName(olive::MainWindow, + tr("Save Effect Settings"), + QString(), + tr("Effect XML Settings %1").arg("(*.xml)")); + + // if the user picked a file + if (!file.isEmpty()) { + + // ensure file ends with .xml extension + if (!file.endsWith(".xml", Qt::CaseInsensitive)) { + file.append(".xml"); + } + + QFile file_handle(file); + if (file_handle.open(QFile::WriteOnly)) { + + file_handle.write(save_to_string()); + + file_handle.close(); + } else { + QMessageBox::critical(olive::MainWindow, + tr("Save Settings Failed"), + tr("Failed to open \"%1\" for writing.").arg(file), + QMessageBox::Ok); + } + } +} + +void OldEffectNode::load_from_file() { + // load effect settings from file + QString file = QFileDialog::getOpenFileName(olive::MainWindow, + tr("Load Effect Settings"), + QString(), + tr("Effect XML Settings %1").arg("(*.xml)")); + + // if the user picked a file + if (!file.isEmpty()) { + QFile file_handle(file); + if (file_handle.open(QFile::ReadOnly)) { + + olive::undo_stack.push(new SetEffectData(this, file_handle.readAll())); + + file_handle.close(); + + update_ui(false); + } else { + QMessageBox::critical(olive::MainWindow, + tr("Load Settings Failed"), + tr("Failed to open \"%1\" for reading.").arg(file), + QMessageBox::Ok); + } + } +} + +bool OldEffectNode::AlwaysUpdate() +{ + return false; +} + +bool OldEffectNode::IsEnabled() { + return enabled_; +} + +bool OldEffectNode::IsExpanded() +{ + return expanded_; +} + +void OldEffectNode::SetExpanded(bool e) +{ + expanded_ = e; +} + +void OldEffectNode::SetPos(const QPointF &pos) +{ + pos_ = pos; +} + +void OldEffectNode::SetEnabled(bool b) { + enabled_ = b; + emit EnabledChanged(b); +} + +void OldEffectNode::load(QXmlStreamReader& stream) { + /* + int row_count = 0; + + QString tag = stream.name().toString(); + + while (!stream.atEnd() && !(stream.name() == tag && stream.isEndElement())) { + stream.readNext(); + if (stream.name() == "row" && stream.isStartElement()) { + if (row_count < rows.size()) { + EffectRow* row = rows.at(row_count); + + while (!stream.atEnd() && !(stream.name() == "row" && stream.isEndElement())) { + stream.readNext(); + + // read field + if (stream.name() == "field" && stream.isStartElement()) { + int field_number = -1; + + // match field using ID + for (int k=0;kFieldCount();l++) { + if (row->Field(l)->id() == attr.value()) { + field_number = l; + break; + } + } + break; + } + } + + if (field_number > -1) { + EffectField* field = row->Field(field_number); + + // get current field value + for (int k=0;kpersistent_data_ = field->ConvertStringToValue(attr.value().toString()); + break; + } + } + + while (!stream.atEnd() && !(stream.name() == "field" && stream.isEndElement())) { + stream.readNext(); + + // read keyframes + if (stream.name() == "key" && stream.isStartElement()) { + row->SetKeyframingInternal(true); + + EffectKeyframe key; + for (int k=0;kConvertStringToValue(attr.value().toString()); + } else if (attr.name() == "frame") { + key.time = attr.value().toLong(); + } else if (attr.name() == "type") { + key.type = attr.value().toInt(); + } else if (attr.name() == "prehx") { + key.pre_handle_x = attr.value().toDouble(); + } else if (attr.name() == "prehy") { + key.pre_handle_y = attr.value().toDouble(); + } else if (attr.name() == "posthx") { + key.post_handle_x = attr.value().toDouble(); + } else if (attr.name() == "posthy") { + key.post_handle_y = attr.value().toDouble(); + } + } + field->keyframes.append(key); + } + } + + field->Changed(); + + } + } + } + + } else { + qCritical() << "Too many rows for effect" << id << ". Project might be corrupt. (Got" << row_count << ", expected <" << rows.size()-1 << ")"; + } + row_count++; + } else if (stream.isStartElement()) { + custom_load(stream); + } + } + */ +} + +void OldEffectNode::custom_load(QXmlStreamReader &) {} + +void OldEffectNode::save(QXmlStreamWriter& stream) { + /* + stream.writeAttribute("name", meta->category + "/" + meta->name); + stream.writeAttribute("enabled", QString::number(IsEnabled())); + + for (int i=0;iIsSavable()) { + stream.writeStartElement("row"); // row + for (int j=0;jFieldCount();j++) { + EffectField* field = row->Field(j); + + if (!field->id().isEmpty()) { + stream.writeStartElement("field"); // field + stream.writeAttribute("id", field->id()); + stream.writeAttribute("value", field->ConvertValueToString(field->persistent_data_)); + for (int k=0;kkeyframes.size();k++) { + const EffectKeyframe& key = field->keyframes.at(k); + stream.writeStartElement("key"); + stream.writeAttribute("value", field->ConvertValueToString(key.data)); + stream.writeAttribute("frame", QString::number(key.time)); + stream.writeAttribute("type", QString::number(key.type)); + stream.writeAttribute("prehx", QString::number(key.pre_handle_x)); + stream.writeAttribute("prehy", QString::number(key.pre_handle_y)); + stream.writeAttribute("posthx", QString::number(key.post_handle_x)); + stream.writeAttribute("posthy", QString::number(key.post_handle_y)); + stream.writeEndElement(); // key + } + stream.writeEndElement(); // field + } + } + stream.writeEndElement(); // row + } + } + */ +} + +void OldEffectNode::load_from_string(const QByteArray &s) { + // clear existing keyframe data + for (int i=0;iSetKeyframingInternal(false); + for (int j=0;jFieldCount();j++) { + EffectField* field = row->Field(j); + field->keyframes.clear(); + } + } + + // write settings with xml writer + QXmlStreamReader stream(s); + + bool found_id = false; + + while (!stream.atEnd()) { + stream.readNext(); + + // find the effect opening tag + if (stream.name() == "effect" && stream.isStartElement()) { + + // check the name to see if it matches this effect + const QXmlStreamAttributes& attributes = stream.attributes(); + for (int i=0;ipath.isEmpty() || (shader_vert_path_.isEmpty() && shader_frag_path_.isEmpty())) return; + QList effects_paths = get_effects_paths(); + const QString& test_fn = shader_vert_path_.isEmpty() ? shader_frag_path_ : shader_vert_path_; + for (int i=0;iisLinked(); +} + +QOpenGLShaderProgram *OldEffectNode::GetShaderPipeline() +{ + return shader_program_.get(); +} + +int OldEffectNode::Flags() +{ + return flags_; +} + +void OldEffectNode::SetFlags(int flags) +{ + flags_ = flags; +} + +int OldEffectNode::getIterations() { + return iterations; +} + +void OldEffectNode::setIterations(int i) { + iterations = i; +} + +const QPointF &OldEffectNode::pos() +{ + return pos_; +} + +void OldEffectNode::process_image(double, uint8_t *, uint8_t *, int){} + +OldEffectNodePtr OldEffectNode::copy(Clip *c) { + OldEffectNodePtr copy = Create(c); + copy->SetEnabled(IsEnabled()); + copy_field_keyframes(copy); + return copy; +} + +void OldEffectNode::process_shader(double timecode, GLTextureCoords&, int iteration) { + /* + shader_program_->bind(); + + shader_program_->setUniformValue("resolution", parent_clip->media_width(), parent_clip->media_height()); + shader_program_->setUniformValue("time", GLfloat(timecode)); + shader_program_->setUniformValue("iteration", iteration); + + for (int i=0;iFieldCount();j++) { + EffectField* field = row->Field(j); + if (!field->id().isEmpty()) { + switch (field->type()) { + case EffectField::EFFECT_FIELD_DOUBLE: + { + DoubleField* double_field = static_cast(field); + shader_program_->setUniformValue(double_field->id().toUtf8().constData(), + GLfloat(double_field->GetDoubleAt(timecode))); + } + break; + case EffectField::EFFECT_FIELD_COLOR: + { + ColorField* color_field = static_cast(field); + shader_program_->setUniformValue( + color_field->id().toUtf8().constData(), + GLfloat(color_field->GetColorAt(timecode).redF()), + GLfloat(color_field->GetColorAt(timecode).greenF()), + GLfloat(color_field->GetColorAt(timecode).blueF()) + ); + } + break; + case EffectField::EFFECT_FIELD_BOOL: + shader_program_->setUniformValue(field->id().toUtf8().constData(), field->GetValueAt(timecode).toBool()); + break; + case EffectField::EFFECT_FIELD_COMBO: + shader_program_->setUniformValue(field->id().toUtf8().constData(), field->GetValueAt(timecode).toInt()); + break; + + // can you even send a string to a uniform value? + case EffectField::EFFECT_FIELD_STRING: + case EffectField::EFFECT_FIELD_FONT: + case EffectField::EFFECT_FIELD_FILE: + case EffectField::EFFECT_FIELD_UI: + break; + } + } + } + } + + shader_program_->release(); + */ +} + +void OldEffectNode::process_coords(double, GLTextureCoords&, int) {} + +GLuint OldEffectNode::process_superimpose(QOpenGLContext* ctx, double timecode) { + bool dimensions_changed = false; + bool redrew_image = false; + + int width = parent_clip->media_width(); + int height = parent_clip->media_height(); + + if (width != img.width() || height != img.height()) { + img = QImage(width, height, QImage::Format_RGBA8888_Premultiplied); + dimensions_changed = true; + } + + if (valueHasChanged(timecode) || dimensions_changed || AlwaysUpdate()) { + redraw(timecode); + redrew_image = true; + } + + QOpenGLFunctions* f = ctx->functions(); + + if (texture == 0 || tex_width_ != img.width() || tex_height_ != img.height()) { + delete_texture(); + + tex_width_ = img.width(); + tex_height_ = img.height(); + + // create texture object + f->glGenTextures(1, &texture); + + f->glBindTexture(GL_TEXTURE_2D, texture); + + // set texture filtering to bilinear + f->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + f->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + + f->glTexImage2D( + GL_TEXTURE_2D, 0, GL_RGBA8, tex_width_, tex_height_, 0, GL_RGBA, GL_UNSIGNED_BYTE, img.constBits() + ); + + f->glBindTexture(GL_TEXTURE_2D, 0); + + redrew_image = false; + } + + if (redrew_image) { + f->glBindTexture(GL_TEXTURE_2D, texture); + + f->glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, tex_width_, tex_height_, GL_RGBA, GL_UNSIGNED_BYTE, img.constBits()); + + f->glBindTexture(GL_TEXTURE_2D, 0); + } + + return texture; +} + +void OldEffectNode::process_audio(double, double, float **, int, int, int) {} + +void OldEffectNode::gizmo_draw(double, GLTextureCoords &) {} + +void OldEffectNode::gizmo_move(EffectGizmo* gizmo, int x_movement, int y_movement, double timecode, bool done) { + // Loop through each gizmo to find `gizmo` + for (int i=0;ix_field1 != nullptr) { + gizmo_dragging_actions_.append(new KeyframeDataChange(gizmo->x_field1)); + } + if (gizmo->y_field1 != nullptr) { + gizmo_dragging_actions_.append(new KeyframeDataChange(gizmo->y_field1)); + } + if (gizmo->x_field2 != nullptr) { + gizmo_dragging_actions_.append(new KeyframeDataChange(gizmo->x_field2)); + } + if (gizmo->y_field2 != nullptr) { + gizmo_dragging_actions_.append(new KeyframeDataChange(gizmo->y_field2)); + } + } + + // Update the field values + if (gizmo->x_field1 != nullptr) { + gizmo->x_field1->SetValueAt(timecode, + gizmo->x_field1->GetDoubleAt(timecode) + x_movement*gizmo->x_field_multi1); + } + if (gizmo->y_field1 != nullptr) { + gizmo->y_field1->SetValueAt(timecode, + gizmo->y_field1->GetDoubleAt(timecode) + y_movement*gizmo->y_field_multi1); + } + if (gizmo->x_field2 != nullptr) { + gizmo->x_field2->SetValueAt(timecode, + gizmo->x_field2->GetDoubleAt(timecode) + x_movement*gizmo->x_field_multi2); + } + if (gizmo->y_field2 != nullptr) { + gizmo->y_field2->SetValueAt(timecode, + gizmo->y_field2->GetDoubleAt(timecode) + y_movement*gizmo->y_field_multi2); + } + + // If (done && !gizmo_dragging_actions_.isEmpty()), that means the drag just ended and we're going to save + // the new state of the attach fields' keyframes in KeyframeDataChange objects to make the changes undoable + // by the user later. + if (done && !gizmo_dragging_actions_.isEmpty()) { + + // Store all the KeyframeDataChange objects into a ComboAction to send to the undo stack (makes them all + // undoable together rather than having to be undone individually). + ComboAction* ca = new ComboAction(); + + for (int j=0;jSetNewKeyframes(); + + // Add this KeyframeDataChange object to the ComboAction + ca->append(gizmo_dragging_actions_.at(j)); + } + + olive::undo_stack.push(ca); + + gizmo_dragging_actions_.clear(); + } + break; + } + } +} + +void OldEffectNode::gizmo_world_to_screen(const QMatrix4x4& matrix, const QMatrix4x4& projection) { + for (int i=0;iget_point_count();j++) { + + // Convert the world point from the gizmo into a screen point relative to the sequence's dimensions + + QVector3D screen_pos = g->world_pos.at(j).project(matrix, + projection, + QRect(0, + 0, + parent_clip->track()->sequence()->width, + parent_clip->track()->sequence()->height)); + + g->screen_pos[j] = QPoint(screen_pos.x(), parent_clip->track()->sequence()->height-screen_pos.y()); + + } + } +} + +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) { + /* + // run javascript + QPainter p(&img); + painter_wrapper.img = &img; + painter_wrapper.painter = &p; + + jsEngine.globalObject().setProperty("painter", wrapper_obj); + jsEngine.globalObject().setProperty("width", parent_clip->media_width()); + jsEngine.globalObject().setProperty("height", parent_clip->media_height()); + + for (int i=0;ifieldCount();j++) { + EffectField* field = row->field(j); + if (!field->id.isEmpty()) { + switch (field->type) { + case EffectField::EFFECT_FIELD_DOUBLE: + jsEngine.globalObject().setProperty(field->id, field->get_double_value(timecode)); + break; + case EffectField::EFFECT_FIELD_COLOR: + jsEngine.globalObject().setProperty(field->id, field->get_color_value(timecode).name()); + break; + case EffectField::EFFECT_FIELD_STRING: + jsEngine.globalObject().setProperty(field->id, field->get_string_value(timecode)); + break; + case EffectField::EFFECT_FIELD_BOOL: + jsEngine.globalObject().setProperty(field->id, field->get_bool_value(timecode)); + break; + case EffectField::EFFECT_FIELD_COMBO: + jsEngine.globalObject().setProperty(field->id, field->get_combo_index(timecode)); + break; + case EffectField::EFFECT_FIELD_FONT: + jsEngine.globalObject().setProperty(field->id, field->get_font_name(timecode)); + break; + } + } + } + } + + jsEngine.evaluate(script); + */ +} + +bool OldEffectNode::valueHasChanged(double timecode) { + if (cachedValues.isEmpty()) { + + for (int i=0;iFieldCount();j++) { + cachedValues.append(crow->Field(j)->GetValueAt(timecode)); + } + } + return true; + + } else { + + bool changed = false; + int index = 0; + for (int i=0;iFieldCount();j++) { + EffectField* field = crow->Field(j); + if (cachedValues.at(index) != field->GetValueAt(timecode)) { + changed = true; + } + cachedValues[index] = field->GetValueAt(timecode); + index++; + } + } + return changed; + + } +} + +void OldEffectNode::delete_texture() { + if (texture_ctx != nullptr) { + texture_ctx->functions()->glDeleteTextures(1, &texture); + texture = 0; + texture_ctx = nullptr; + } +} + +int GetNodeLibraryIndexFromId(const QString& id) { + for (int i=0;iid() == id) { + return i; + } + } + + return -1; +} + +/* +const EffectMeta* Node::GetMetaFromName(const QString& input) { + int split_index = input.indexOf('/'); + QString category; + if (split_index > -1) { + category = input.left(split_index); + } + QString name = input.mid(split_index + 1); + + for (int j=0;j. + +***/ + +#ifndef EFFECT_H +#define EFFECT_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "timeline/tracktypes.h" +#include "rendering/qopenglshaderprogramptr.h" +#include "inputs.h" +#include "effects/effectgizmo.h" + +class EffectGizmo; +class KeyframeDataChange; + +class Clip; +using ClipPtr = std::shared_ptr; + +class OldEffectNode; +using OldEffectNodePtr = std::shared_ptr; + +enum NodeType { + kTransformEffect, + kTextInput, + kSolidInput, + kNoiseInput, + kVolumeEffect, + kPanEffect, + kToneInput, + kShakeEffect, + kTimecodeEffect, + kMaskEffect, + kFillLeftRightEffect, + kVstEffect, + kCornerPinEffect, + kRichTextInput, + kMediaInput, + kShaderEffect, + kImageOutput, + kCrossDissolveTransition, + kLinearFadeTransition, + kExponentialFadeTransition, + kLogarithmicFadeTransition, + kInvalidNode +}; + +double log_volume(double linear); + +enum EffectType { + EFFECT_TYPE_INVALID, + EFFECT_TYPE_EFFECT, + EFFECT_TYPE_TRANSITION +}; + +enum EffectKeyframeType { + EFFECT_KEYFRAME_LINEAR, + EFFECT_KEYFRAME_BEZIER, + EFFECT_KEYFRAME_HOLD +}; + +struct GLTextureCoords { + QMatrix4x4 matrix; + + QVector3D vertex_top_left; + QVector3D vertex_top_right; + QVector3D vertex_bottom_left; + QVector3D vertex_bottom_right; + + QVector2D texture_top_left; + QVector2D texture_top_right; + QVector2D texture_bottom_left; + QVector2D texture_bottom_right; + + float opacity; +}; + +class OldEffectNode : public QObject { + Q_OBJECT +public: + OldEffectNode(Clip *c); + ~OldEffectNode(); + + Clip* parent_clip; + + virtual QString name() = 0; + virtual QString id() = 0; + virtual QString category(); + virtual QString description(); + virtual EffectType type() = 0; + virtual olive::TrackType subtype() = 0; + virtual bool IsCreatable(); + virtual OldEffectNodePtr Create(Clip *c) = 0; + + void AddRow(NodeIO* row); + int IndexOfRow(NodeIO* row); + NodeIO* row(int i); + int row_count(); + + EffectGizmo* add_gizmo(int type); + EffectGizmo* gizmo(int i); + int gizmo_count(); + + QVector GetAllEdges(); + + bool IsEnabled(); + bool IsExpanded(); + + virtual void refresh(); + + virtual OldEffectNodePtr copy(Clip* c); + void copy_field_keyframes(OldEffectNodePtr e); + + virtual void load(QXmlStreamReader& stream); + virtual void custom_load(QXmlStreamReader& stream); + virtual void save(QXmlStreamWriter& stream); + + void load_from_string(const QByteArray &s); + QByteArray save_to_string(); + + // glsl handling + bool is_open(); + void open(); + void close(); + bool is_shader_linked(); + QOpenGLShaderProgram* GetShaderPipeline(); + + enum VideoEffectFlags { + ShaderFlag = 0x1, + CoordsFlag = 0x2, + SuperimposeFlag = 0x4 + }; + int Flags(); + void SetFlags(int flags); + + int getIterations(); + void setIterations(int i); + + const QPointF& pos(); + + virtual void process_image(double timecode, uint8_t* input, uint8_t* output, int size); + virtual void process_shader(double timecode, GLTextureCoords&, int iteration); + virtual void process_coords(double timecode, GLTextureCoords& coords, int data); + virtual GLuint process_superimpose(QOpenGLContext *ctx, double timecode); + virtual void process_audio(double timecode_start, double timecode_end, float **samples, int nb_samples, int nb_channels, int type); + + virtual void gizmo_draw(double timecode, GLTextureCoords& coords); + void gizmo_move(EffectGizmo* sender, int x_movement, int y_movement, double timecode, bool done); + 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 + T randomNumber() + { + static std::random_device device; + static std::mt19937 generator(device()); + static std::uniform_int_distribution<> distribution(std::numeric_limits::min(), std::numeric_limits::max()); + return distribution(generator); + } + + template + T randomFloat() + { + static std::random_device device; + static std::mt19937 generator(device()); + static std::uniform_int_distribution<> distribution(-1.0, 1.0); + return distribution(generator); + } + +public slots: + void FieldChanged(); + void SetEnabled(bool b); + void SetExpanded(bool e); + void SetPos(const QPointF& pos); +signals: + void EnabledChanged(bool); +private slots: + void delete_self(); + void move_up(); + void move_down(); + void save_to_file(); + void load_from_file(); +protected: + // glsl effect + QOpenGLShaderProgramPtr shader_program_; + QString shader_vert_path_; + QString shader_frag_path_; + QString shader_function_name_; + + // superimpose effect + QImage img; + GLuint texture; + QOpenGLContext* texture_ctx; + int tex_width_; + int tex_height_; + + // enable effect to update constantly + virtual bool AlwaysUpdate(); + +private: + bool isOpen; + QVector rows; + QVector gizmos; + bool bound; + int iterations; + + bool enabled_; + bool expanded_; + + int flags_; + + QVector gizmo_dragging_actions_; + + QPointF pos_; + + // superimpose functions + virtual void redraw(double timecode); + bool valueHasChanged(double timecode); + QVector cachedValues; + void delete_texture(); + void validate_meta_path(); +}; + +namespace olive { + extern QVector node_library; +} + +#endif // EFFECT_H diff --git a/nodes/widgets/buttonwidget.cpp b/nodes/widgets/buttonwidget.cpp index c4e8f3690..184b21ff1 100644 --- a/nodes/widgets/buttonwidget.cpp +++ b/nodes/widgets/buttonwidget.cpp @@ -1,7 +1,7 @@ #include "buttonwidget.h" -ButtonWidget::ButtonWidget(Node* parent, const QString& name, const QString& text) : - EffectRow(parent, nullptr, name, false, false) +ButtonWidget::ButtonWidget(OldEffectNode* parent, const QString& name, const QString& text) : + NodeIO(parent, nullptr, name, false, false) { ButtonField* button_field = new ButtonField(this, text); diff --git a/nodes/widgets/buttonwidget.h b/nodes/widgets/buttonwidget.h index cd35ba7a9..2a1e9b707 100644 --- a/nodes/widgets/buttonwidget.h +++ b/nodes/widgets/buttonwidget.h @@ -1,12 +1,12 @@ #ifndef BUTTONWIDGET_H #define BUTTONWIDGET_H -#include "effects/effectrow.h" +#include "nodes/nodeio.h" -class ButtonWidget : public EffectRow +class ButtonWidget : public NodeIO { public: - ButtonWidget(Node* parent, const QString& name, const QString& text); + ButtonWidget(OldEffectNode* parent, const QString& name, const QString& text); /** * @brief Wrapper for ButtonField::SetCheckable. diff --git a/nodes/widgets/labelwidget.cpp b/nodes/widgets/labelwidget.cpp index 6d22601c8..a5c0acb3b 100644 --- a/nodes/widgets/labelwidget.cpp +++ b/nodes/widgets/labelwidget.cpp @@ -1,7 +1,7 @@ #include "labelwidget.h" -LabelWidget::LabelWidget(Node *parent, const QString &name, const QString &text) : - EffectRow(parent, nullptr, name, false, false) +LabelWidget::LabelWidget(OldEffectNode *parent, const QString &name, const QString &text) : + NodeIO(parent, nullptr, name, false, false) { AddField(new LabelField(this, text)); } diff --git a/nodes/widgets/labelwidget.h b/nodes/widgets/labelwidget.h index 97e86d158..b3d59776e 100644 --- a/nodes/widgets/labelwidget.h +++ b/nodes/widgets/labelwidget.h @@ -1,12 +1,12 @@ #ifndef LABELWIDGET_H #define LABELWIDGET_H -#include "effects/effectrow.h" +#include "nodes/nodeio.h" -class LabelWidget : public EffectRow +class LabelWidget : public NodeIO { public: - LabelWidget(Node* parent, const QString& name, const QString& text); + LabelWidget(OldEffectNode* parent, const QString& name, const QString& text); }; #endif // LABELWIDGET_H diff --git a/olive.pro b/olive.pro index 34edcce5d..2546af3ae 100644 --- a/olive.pro +++ b/olive.pro @@ -52,6 +52,10 @@ gcc:QMAKE_CXXFLAGS += -Wno-reorder SOURCES += \ main.cpp \ + nodes/node.cpp \ + nodes/nodeio.cpp \ + nodes/nodes/nodeclip.cpp \ + nodes/oldeffectnode.cpp \ ui/mainwindow.cpp \ panels/project.cpp \ panels/effectcontrols.cpp \ @@ -106,7 +110,6 @@ SOURCES += \ effects/internal/logarithmicfadetransition.cpp \ effects/internal/cornerpineffect.cpp \ global/math.cpp \ - effects/effectrow.cpp \ effects/effectgizmo.cpp \ ui/resizablescrollbar.cpp \ ui/sourceiconview.cpp \ @@ -206,11 +209,14 @@ SOURCES += \ nodes/nodes/nodeshader.cpp \ decoders/ffmpegdecoder.cpp \ decoders/decoder.cpp \ - nodes/node.cpp \ nodes/nodeedge.cpp \ ui/nodeedgeui.cpp HEADERS += \ + nodes/node.h \ + nodes/nodeio.h \ + nodes/nodes/nodeclip.h \ + nodes/oldeffectnode.h \ ui/mainwindow.h \ panels/project.h \ panels/effectcontrols.h \ @@ -266,7 +272,6 @@ HEADERS += \ effects/internal/logarithmicfadetransition.h \ effects/internal/cornerpineffect.h \ global/math.h \ - effects/effectrow.h \ effects/internal/cubetransition.h \ effects/effectgizmo.h \ ui/resizablescrollbar.h \ @@ -371,7 +376,6 @@ HEADERS += \ nodes/nodes.h \ decoders/ffmpegdecoder.h \ decoders/decoder.h \ - nodes/node.h \ timeline/tracktypes.h \ nodes/nodeedge.h \ ui/nodeedgeui.h diff --git a/panels/effectcontrols.cpp b/panels/effectcontrols.cpp index b06716e8b..71a1a099e 100644 --- a/panels/effectcontrols.cpp +++ b/panels/effectcontrols.cpp @@ -32,7 +32,7 @@ #include #include "panels/panels.h" -#include "nodes/node.h" +#include "nodes/oldeffectnode.h" #include "effects/effectloaders.h" #include "effects/transition.h" #include "timeline/clip.h" @@ -392,7 +392,7 @@ void EffectControls::LoadEvent() QVBoxLayout* layout = nullptr; EffectUI* container = open_effects_.at(i); - Node* e = open_effects_.at(i)->GetEffect(); + OldEffectNode* e = open_effects_.at(i)->GetEffect(); if (e->subtype() == olive::kTypeVideo) { vcontainer->setVisible(true); diff --git a/panels/effectspanel.cpp b/panels/effectspanel.cpp index fab4f34ef..a400b6ba5 100644 --- a/panels/effectspanel.cpp +++ b/panels/effectspanel.cpp @@ -78,7 +78,7 @@ void EffectsPanel::Load() { Clip* c = selected_clips_.at(i); // Create a list of the effects we'll open - QVector effects_to_open; + QVector effects_to_open; // Determine based on the current selections whether to load all effects or just the transitions bool whole_clip_is_selected = c->IsSelected(); @@ -121,7 +121,7 @@ void EffectsPanel::Load() { // to clear the graph editor later. if (!graph_editor_row_is_still_active) { for (int k=0;krow_count();k++) { - EffectRow* row = effects_to_open.at(j)->row(k); + NodeIO* row = effects_to_open.at(j)->row(k); if (row == panel_graph_editor->get_row()) { graph_editor_row_is_still_active = true; break; @@ -139,7 +139,7 @@ void EffectsPanel::Load() { LoadEvent(); } -bool EffectsPanel::IsEffectSelected(Node *e) +bool EffectsPanel::IsEffectSelected(OldEffectNode *e) { for (int i=0;iGetEffect() == e && open_effects_.at(i)->IsSelected()) { @@ -176,7 +176,7 @@ void EffectsPanel::copy(bool del) { for (int i=0;iIsSelected()) { - Node* e = open_effects_.at(i)->GetEffect(); + OldEffectNode* e = open_effects_.at(i)->GetEffect(); if (e->type() == EFFECT_TYPE_EFFECT) { @@ -211,7 +211,7 @@ void EffectsPanel::AboutToClearEvent() { } -void EffectsPanel::DeleteEffect(ComboAction* ca, Node* effect_ref) { +void EffectsPanel::DeleteEffect(ComboAction* ca, OldEffectNode* effect_ref) { if (effect_ref->type() == EFFECT_TYPE_EFFECT) { ca->append(new EffectDeleteCommand(effect_ref)); @@ -264,7 +264,7 @@ void EffectsPanel::DeleteSelectedEffects() { } } -void EffectsPanel::open_effect(Node* e) { +void EffectsPanel::open_effect(OldEffectNode* e) { EffectUI* container = new EffectUI(e); connect(container, SIGNAL(CutRequested()), this, SLOT(cut())); diff --git a/panels/effectspanel.h b/panels/effectspanel.h index 1100dd94f..ce1105541 100644 --- a/panels/effectspanel.h +++ b/panels/effectspanel.h @@ -18,7 +18,7 @@ public: virtual bool focused() override; - bool IsEffectSelected(Node* e); + bool IsEffectSelected(OldEffectNode* e); void DeleteSelectedEffects(); public slots: @@ -33,8 +33,8 @@ protected: QVector open_effects_; private: void Load(); - void open_effect(Node *e); - void DeleteEffect(ComboAction* ca, Node* effect_ref); + void open_effect(OldEffectNode *e); + void DeleteEffect(ComboAction* ca, OldEffectNode* effect_ref); private slots: void deselect_all_effects(QWidget*); }; diff --git a/panels/grapheditor.cpp b/panels/grapheditor.cpp index 9622a5831..f53e0984d 100644 --- a/panels/grapheditor.cpp +++ b/panels/grapheditor.cpp @@ -30,9 +30,9 @@ #include "timeline/timelinetools.h" #include "ui/labelslider.h" #include "ui/graphview.h" -#include "nodes/node.h" +#include "nodes/oldeffectnode.h" #include "effects/effectfields.h" -#include "effects/effectrow.h" +#include "nodes/nodeio.h" #include "timeline/clip.h" #include "rendering/renderfunctions.h" #include "panels.h" @@ -131,7 +131,7 @@ GraphEditor::GraphEditor(QWidget* parent) : Panel(parent), row(nullptr) { Retranslate(); } -EffectRow *GraphEditor::get_row() +NodeIO *GraphEditor::get_row() { return row; } @@ -166,7 +166,7 @@ bool GraphEditor::focused() return hasFocus() || view->hasFocus() || header->hasFocus(); } -void GraphEditor::set_row(EffectRow *r) { +void GraphEditor::set_row(NodeIO *r) { for (int i=0;i field_sliders_; QVector field_enable_buttons; QLabel* current_row_desc; - EffectRow* row; + NodeIO* row; KeyframeNavigator* keyframe_nav; QPushButton* linear_button; QPushButton* bezier_button; diff --git a/panels/nodeeditor.cpp b/panels/nodeeditor.cpp index 2d632ff5d..4d7c0df29 100644 --- a/panels/nodeeditor.cpp +++ b/panels/nodeeditor.cpp @@ -66,7 +66,7 @@ void NodeEditor::LoadEvent() for (int i=0;iGetEffect(); + OldEffectNode* node = effect_ui->GetEffect(); if (node->parent_clip == first_clip) { NodeUI* node_ui = new NodeUI(); @@ -120,7 +120,7 @@ void NodeEditor::LoadEdges() for (int i=0;iGetEffect(); + OldEffectNode* n = open_effects_.at(i)->GetEffect(); if (n->parent_clip == first_clip) { @@ -150,7 +150,7 @@ void NodeEditor::LoadEdges() } } -void NodeEditor::ConnectRow(EffectRow *row) +void NodeEditor::ConnectRow(NodeIO *row) { if (!connected_rows_.contains(row)) { connect(row, SIGNAL(EdgesChanged()), this, SLOT(ReloadEdges())); diff --git a/panels/nodeeditor.h b/panels/nodeeditor.h index f38ff4ee9..6742dccaa 100644 --- a/panels/nodeeditor.h +++ b/panels/nodeeditor.h @@ -26,14 +26,14 @@ private: QWidget props_; QVector nodes_; QVector edges_; - QVector connected_rows_; + QVector connected_rows_; QVBoxLayout* prop_layout_; QVector nodes_open_in_props_; void ClearEdges(); void LoadEdges(); - void ConnectRow(EffectRow* row); + void ConnectRow(NodeIO* row); void DisconnectAllRows(); private slots: diff --git a/panels/timeline.cpp b/panels/timeline.cpp index 4833a288a..516112508 100644 --- a/panels/timeline.cpp +++ b/panels/timeline.cpp @@ -876,7 +876,7 @@ void Timeline::transition_tool_click() { transition_menu.addAction(tr("Video Transitions"))->setEnabled(false); for (int i=0;itype() == EFFECT_TYPE_TRANSITION && node->subtype() == olive::kTypeVideo) { QAction* a = transition_menu.addAction(node->name()); a->setData(i); @@ -888,7 +888,7 @@ void Timeline::transition_tool_click() { transition_menu.addAction(tr("Audio Transitions"))->setEnabled(false); for (int i=0;itype() == EFFECT_TYPE_TRANSITION && node->subtype() == olive::kTypeAudio) { QAction* a = transition_menu.addAction(node->name()); a->setData(i); diff --git a/project/loadthread.cpp b/project/loadthread.cpp index dee719ecc..50a70e029 100644 --- a/project/loadthread.cpp +++ b/project/loadthread.cpp @@ -144,7 +144,7 @@ void LoadThread::load_effect(QXmlStreamReader& stream, Clip* c) { if (ttype == kTransitionNone) { if (type == kInvalidNode) { // create void effect - NodePtr ve = std::make_shared(c, effect_name, effect_id); + OldEffectNodePtr ve = std::make_shared(c, effect_name, effect_id); ve->SetEnabled(effect_enabled); ve->load(stream); @@ -152,7 +152,7 @@ void LoadThread::load_effect(QXmlStreamReader& stream, Clip* c) { c->effects.append(ve); } else { - NodePtr e = olive::node_library[type]->Create(c); + OldEffectNodePtr e = olive::node_library[type]->Create(c); e->SetEnabled(effect_enabled); e->load(stream); diff --git a/rendering/cacher.cpp b/rendering/cacher.cpp index 173edb467..27f803021 100644 --- a/rendering/cacher.cpp +++ b/rendering/cacher.cpp @@ -62,7 +62,7 @@ void apply_audio_effects(Clip* clip, double timecode_start, AVFrame* frame, int timecode_end = timecode_start + samples_to_seconds(nb_samples, frame->channels, frame->sample_rate); for (int j=0;jeffects.size();j++) { - Node* e = clip->effects.at(j).get(); + OldEffectNode* e = clip->effects.at(j).get(); if (e->IsEnabled()) { e->process_audio(timecode_start, timecode_end, reinterpret_cast(frame->data), nb_samples, nb_channels, kTransitionNone); } diff --git a/rendering/renderfunctions.cpp b/rendering/renderfunctions.cpp index f2f1a2f7c..acdbcf8fb 100644 --- a/rendering/renderfunctions.cpp +++ b/rendering/renderfunctions.cpp @@ -34,7 +34,7 @@ extern "C" { #include "timeline/clip.h" #include "timeline/sequence.h" #include "project/media.h" -#include "nodes/node.h" +#include "nodes/oldeffectnode.h" #include "project/footage.h" #include "effects/transition.h" #include "ui/collapsiblewidget.h" @@ -175,7 +175,7 @@ GLuint draw_clip(QOpenGLContext* ctx, void process_effect(QOpenGLContext* ctx, QOpenGLShaderProgram* pipeline, Clip* c, - Node* e, + OldEffectNode* e, double timecode, GLTextureCoords& coords, GLuint& composite_texture, @@ -183,11 +183,11 @@ void process_effect(QOpenGLContext* ctx, bool& texture_failed, int data) { if (e->IsEnabled()) { - if (e->Flags() & Node::CoordsFlag) { + if (e->Flags() & OldEffectNode::CoordsFlag) { e->process_coords(timecode, coords, data); } - bool can_process_shaders = ((e->Flags() & Node::ShaderFlag) && olive::runtime_config.shaders_are_enabled); - if (can_process_shaders || (e->Flags() & Node::SuperimposeFlag)) { + bool can_process_shaders = ((e->Flags() & OldEffectNode::ShaderFlag) && olive::runtime_config.shaders_are_enabled); + if (can_process_shaders || (e->Flags() & OldEffectNode::SuperimposeFlag)) { if (!e->is_open()) { e->open(); @@ -200,7 +200,7 @@ void process_effect(QOpenGLContext* ctx, fbo_switcher = !fbo_switcher; } } - if (e->Flags() & Node::SuperimposeFlag) { + if (e->Flags() & OldEffectNode::SuperimposeFlag) { GLuint superimpose_texture = e->process_superimpose(ctx, timecode); if (superimpose_texture == 0) { @@ -514,7 +514,7 @@ GLuint olive::rendering::compose_sequence(ComposeSequenceParams ¶ms) { // run through all of the clip's effects for (int j=0;jeffects.size();j++) { - Node* e = c->effects.at(j).get(); + OldEffectNode* e = c->effects.at(j).get(); process_effect(params.ctx, params.pipeline, c, e, timecode, coords, textureID, fbo_switcher, params.texture_failed, kTransitionNone); } diff --git a/rendering/renderfunctions.h b/rendering/renderfunctions.h index 658ecc422..0c5d0426a 100644 --- a/rendering/renderfunctions.h +++ b/rendering/renderfunctions.h @@ -28,7 +28,7 @@ namespace OCIO = OCIO_NAMESPACE::v1; #include "timeline/sequence.h" -#include "nodes/node.h" +#include "nodes/oldeffectnode.h" #include "panels/viewer.h" /** @@ -89,7 +89,7 @@ struct ComposeSequenceParams { * * The currently active Effect that compose_sequence() will update the gizmos of. */ - Node* gizmos; + OldEffectNode* gizmos; /** * @brief A variable that compose_sequence() will set to **TRUE** if any of the clips couldn't be shown. diff --git a/rendering/renderthread.h b/rendering/renderthread.h index cea0a7099..689fa9113 100644 --- a/rendering/renderthread.h +++ b/rendering/renderthread.h @@ -30,7 +30,7 @@ #include #include "timeline/sequence.h" -#include "nodes/node.h" +#include "nodes/oldeffectnode.h" #include "rendering/framebufferobject.h" #include "qopenglshaderprogramptr.h" @@ -44,7 +44,7 @@ public: QMutex* get_texture_mutex(); const GLuint& get_texture(); - Node* gizmos; + OldEffectNode* gizmos; void paint(); void start_render(QOpenGLContext* share, Sequence *s, diff --git a/timeline/clip.cpp b/timeline/clip.cpp index e25291ccc..c0de31654 100644 --- a/timeline/clip.cpp +++ b/timeline/clip.cpp @@ -22,7 +22,7 @@ #include -#include "nodes/node.h" +#include "nodes/oldeffectnode.h" #include "effects/transition.h" #include "project/footage.h" #include "global/config.h" @@ -220,7 +220,7 @@ QVector &Clip::get_markers() { return markers; } -int Clip::IndexOfEffect(Node *e) +int Clip::IndexOfEffect(OldEffectNode *e) { for (int i=0;irow_count();j++) { - EffectRow* r = e->row(j); + NodeIO* r = e->row(j); for (int l=0;lFieldCount();l++) { EffectField* f = r->Field(l); for (int k=0;kkeyframes.size();k++) { diff --git a/timeline/clip.h b/timeline/clip.h index 30ea217ce..553308f36 100644 --- a/timeline/clip.h +++ b/timeline/clip.h @@ -30,7 +30,7 @@ #include "rendering/cacher.h" -#include "nodes/node.h" +#include "nodes/oldeffectnode.h" #include "effects/transition.h" #include "undo/comboaction.h" #include "project/media.h" @@ -129,8 +129,8 @@ public: QVector& get_markers(); // other variables (should be deep copied/duplicated in copy()) - int IndexOfEffect(Node* e); - QList effects; + int IndexOfEffect(OldEffectNode* e); + QList effects; QVector linked; TransitionPtr opening_transition; TransitionPtr closing_transition; diff --git a/timeline/sequence.cpp b/timeline/sequence.cpp index 75340e974..c5cea6677 100644 --- a/timeline/sequence.cpp +++ b/timeline/sequence.cpp @@ -905,9 +905,9 @@ void Sequence::RippleDeleteArea(ComboAction* ca, long ripple_point, long ripple_ } -Node *Sequence::GetSelectedGizmo() +OldEffectNode *Sequence::GetSelectedGizmo() { - Node* gizmo_ptr = nullptr; + OldEffectNode* gizmo_ptr = nullptr; QVector clips = GetAllClips(); @@ -923,7 +923,7 @@ Node *Sequence::GetSelectedGizmo() // none selected for (int j=0;jeffects.size();j++) { - Node* e = c->effects.at(j).get(); + OldEffectNode* e = c->effects.at(j).get(); // retrieve gizmo data from effect if (e->are_gizmos_enabled()) { diff --git a/timeline/sequence.h b/timeline/sequence.h index 94051ae83..e07bfd846 100644 --- a/timeline/sequence.h +++ b/timeline/sequence.h @@ -97,7 +97,7 @@ public: void RippleDeleteEmptySpace(ComboAction *ca, Track *track, long point); void RippleDeleteArea(ComboAction* ca, long ripple_point, long ripple_length); - Node* GetSelectedGizmo(); + OldEffectNode* GetSelectedGizmo(); bool IsClipSelected(Clip* clip, bool containing = true); bool IsTransitionSelected(Transition* t); diff --git a/timeline/track.h b/timeline/track.h index 310cd69e9..29a80e31c 100644 --- a/timeline/track.h +++ b/timeline/track.h @@ -4,7 +4,7 @@ #include #include -#include "nodes/node.h" +#include "nodes/oldeffectnode.h" #include "tracktypes.h" #include "undo/comboaction.h" #include "timeline/selection.h" @@ -112,7 +112,7 @@ private: olive::TrackType type_; int height_; QVector clips_; - QVector effects_; + QVector effects_; QVector selections_; bool muted_; diff --git a/ui/effectui.cpp b/ui/effectui.cpp index 63e6c2420..3d0a03d68 100644 --- a/ui/effectui.cpp +++ b/ui/effectui.cpp @@ -29,7 +29,7 @@ #include "ui/menu.h" #include "panels/panels.h" -EffectUI::EffectUI(Node* e) : +EffectUI::EffectUI(OldEffectNode* e) : effect_(e) { Q_ASSERT(e != nullptr); @@ -107,7 +107,7 @@ EffectUI::EffectUI(Node* e) : keyframe_navigators_.resize(e->row_count()); for (int i=0;irow_count();i++) { - EffectRow* row = e->row(i); + NodeIO* row = e->row(i); ClickableLabel* row_label = new ClickableLabel(row->name()); connect(row_label, SIGNAL(clicked()), row, SLOT(FocusRow())); @@ -165,7 +165,7 @@ EffectUI::EffectUI(Node* e) : connect(enabled_check, SIGNAL(toggled(bool)), e, SLOT(FieldChanged())); } -void EffectUI::AddAdditionalEffect(Node *e) +void EffectUI::AddAdditionalEffect(OldEffectNode *e) { // Ensure this is the same kind of effect and will be fully compatible Q_ASSERT(e->id() == effect_->id()); @@ -183,7 +183,7 @@ void EffectUI::AddAdditionalEffect(Node *e) // Attach this UI's widgets to the additional effect for (int i=0;irow_count();i++) { - EffectRow* row = effect_->row(i); + NodeIO* row = effect_->row(i); // Attach existing keyframe navigator to this effect's row AttachKeyframeNavigationToRow(e->row(i), keyframe_navigators_.at(i)); @@ -198,7 +198,7 @@ void EffectUI::AddAdditionalEffect(Node *e) } } -Node *EffectUI::GetEffect() +OldEffectNode *EffectUI::GetEffect() { return effect_; } @@ -227,11 +227,11 @@ int EffectUI::GetRowY(int row, QWidget* mapToWidget) { void EffectUI::UpdateFromEffect() { - Node* effect = GetEffect(); + OldEffectNode* effect = GetEffect(); for (int j=0;jrow_count();j++) { - EffectRow* row = effect->row(j); + NodeIO* row = effect->row(j); for (int k=0;kFieldCount();k++) { EffectField* field = row->Field(k); @@ -286,7 +286,7 @@ QWidget *EffectUI::Widget(int row, int field) return widgets_.at(row).at(field); } -void EffectUI::AttachKeyframeNavigationToRow(EffectRow *row, KeyframeNavigator *nav) +void EffectUI::AttachKeyframeNavigationToRow(NodeIO *row, KeyframeNavigator *nav) { if (nav == nullptr) { return; diff --git a/ui/effectui.h b/ui/effectui.h index 45f0a95d9..332c2ea84 100644 --- a/ui/effectui.h +++ b/ui/effectui.h @@ -22,7 +22,7 @@ #define EFFECTUI_H #include "collapsiblewidget.h" -#include "nodes/node.h" +#include "nodes/oldeffectnode.h" #include "ui/nodeui.h" #include "ui/keyframenavigator.h" @@ -50,7 +50,7 @@ public: * * The Effect to make a UI of. It must be a valid object. */ - EffectUI(Node* e); + EffectUI(OldEffectNode* e); /** * @brief Attach additional effects to this UI @@ -63,7 +63,7 @@ public: * * The Effect to add to this UI object. */ - void AddAdditionalEffect(Node* e); + void AddAdditionalEffect(OldEffectNode* e); /** * @brief Get the primary Effect that this UI object was created for @@ -72,7 +72,7 @@ public: * * The Effect object passed to the constructor when creating this EffectUI. */ - Node* GetEffect(); + OldEffectNode* GetEffect(); /** * @brief Get the Y position of a given row @@ -172,12 +172,12 @@ private: /** * @brief Internal reference to the Effect this object was constructed around. */ - Node* effect_; + OldEffectNode* effect_; /** * @brief Internal array of additional Effect objects attached to this UI. */ - QVector additional_effects_; + QVector additional_effects_; /** * @brief Layout for UI widgets @@ -212,7 +212,7 @@ private: * * The KeyframeNavigator object. */ - void AttachKeyframeNavigationToRow(EffectRow* row, KeyframeNavigator* nav); + void AttachKeyframeNavigationToRow(NodeIO* row, KeyframeNavigator* nav); private slots: /** * @brief Slot for titlebar's right-click signal to show a context menu for extra Effect functions. diff --git a/ui/graphview.cpp b/ui/graphview.cpp index 637bf3e3e..68280c3cc 100644 --- a/ui/graphview.cpp +++ b/ui/graphview.cpp @@ -33,7 +33,7 @@ #include "ui/keyframedrawing.h" #include "undo/undo.h" #include "undo/undostack.h" -#include "nodes/node.h" +#include "nodes/oldeffectnode.h" #include "timeline/clip.h" #include "ui/rectangleselect.h" #include "ui/menu.h" @@ -821,7 +821,7 @@ void GraphView::wheelEvent(QWheelEvent *event) { } } -void GraphView::set_row(EffectRow *r) { +void GraphView::set_row(NodeIO *r) { if (row != r) { selected_keys.clear(); selected_keys_fields.clear(); diff --git a/ui/graphview.h b/ui/graphview.h index da1bf77ae..51f49a059 100644 --- a/ui/graphview.h +++ b/ui/graphview.h @@ -24,7 +24,7 @@ #include #include -#include "effects/effectrow.h" +#include "nodes/nodeio.h" #include "effects/effectfields.h" QColor get_curve_color(int index, int length); @@ -40,7 +40,7 @@ public: void mouseReleaseEvent(QMouseEvent *event); void wheelEvent(QWheelEvent *event); - void set_row(EffectRow* r); + void set_row(NodeIO* r); void set_selected_keyframe_type(int type); void set_field_visibility(int field, bool b); @@ -95,7 +95,7 @@ private: void draw_lines(QPainter &p, bool vert); void draw_line_text(QPainter &p, bool vert, int line_no, int line_pos, int next_line_pos); - EffectRow* row; + NodeIO* row; bool rect_select; int rect_select_x; diff --git a/ui/keyframedrawing.cpp b/ui/keyframedrawing.cpp index ce4a49f24..006751782 100644 --- a/ui/keyframedrawing.cpp +++ b/ui/keyframedrawing.cpp @@ -20,7 +20,7 @@ #include "keyframedrawing.h" -#include "nodes/node.h" +#include "nodes/oldeffectnode.h" #include "timeline/clip.h" #define KEYFRAME_POINT_COUNT 4 @@ -54,7 +54,7 @@ void draw_keyframe(QPainter &p, int type, int x, int y, bool darker, int r, int } // adjusts keyframe's internal time (in clip time) to timeline time -long adjust_row_keyframe(EffectRow* row, long time, long visible_in) { +long adjust_row_keyframe(NodeIO* row, long time, long visible_in) { return time - row->GetParentEffect()->parent_clip->clip_in() + (row->GetParentEffect()->parent_clip->timeline_in() - visible_in); diff --git a/ui/keyframedrawing.h b/ui/keyframedrawing.h index f94103532..9d5eff617 100644 --- a/ui/keyframedrawing.h +++ b/ui/keyframedrawing.h @@ -26,9 +26,9 @@ #define KEYFRAME_SIZE 6 #define KEYFRAME_COLOR 160 -class EffectRow; +class NodeIO; void draw_keyframe(QPainter &p, int type, int x, int y, bool darker, int r = KEYFRAME_COLOR, int g = KEYFRAME_COLOR, int b = KEYFRAME_COLOR); -long adjust_row_keyframe(EffectRow* row, long time, long visible_in); +long adjust_row_keyframe(NodeIO* row, long time, long visible_in); #endif // KEYFRAMEDRAWING_H diff --git a/ui/keyframeview.cpp b/ui/keyframeview.cpp index 44c122fc1..01395eb8f 100644 --- a/ui/keyframeview.cpp +++ b/ui/keyframeview.cpp @@ -23,7 +23,7 @@ #include #include -#include "nodes/node.h" +#include "nodes/oldeffectnode.h" #include "ui/collapsiblewidget.h" #include "panels/panels.h" #include "timeline/clip.h" @@ -120,11 +120,11 @@ void KeyframeView::paintEvent(QPaintEvent*) { for (int j=0;jGetEffect(); + OldEffectNode* e = container->GetEffect(); if (container->IsExpanded()) { for (int j=0;jrow_count();j++) { - EffectRow* row = e->row(j); + NodeIO* row = e->row(j); int keyframe_y = container->GetRowY(j, this); @@ -254,7 +254,7 @@ void KeyframeView::mousePressEvent(QMouseEvent *event) { long frame_max = getFrameFromScreenPoint(panel_effect_controls->zoom, mouse_x+KEYFRAME_SIZE); for (int i=0;i rowY.at(i)-KEYFRAME_SIZE-KEYFRAME_SIZE && mouse_y < rowY.at(i)+KEYFRAME_SIZE+KEYFRAME_SIZE) { - EffectRow* row = rows.at(i); + NodeIO* row = rows.at(i); row->FocusRow(); @@ -358,7 +358,7 @@ void KeyframeView::mouseMoveEvent(QMouseEvent* event) { for (int i=0;i= min_row && rowY.at(i) <= max_row) { - EffectRow* row = rows.at(i); + NodeIO* row = rows.at(i); for (int k=0;kFieldCount();k++) { EffectField* field = row->Field(k); for (int j=0;jkeyframes.size();j++) { diff --git a/ui/keyframeview.h b/ui/keyframeview.h index 918b40ee3..783e17d22 100644 --- a/ui/keyframeview.h +++ b/ui/keyframeview.h @@ -27,8 +27,8 @@ #include "ui/effectui.h" class Clip; -class Node; -class EffectRow; +class OldEffectNode; +class NodeIO; class EffectField; class TimelineHeader; @@ -57,7 +57,7 @@ private: QVector selected_fields; QVector selected_keyframes; QVector rowY; - QVector rows; + QVector rows; QVector old_key_vals; void mousePressEvent(QMouseEvent* event); void mouseMoveEvent(QMouseEvent* event); diff --git a/ui/nodeui.cpp b/ui/nodeui.cpp index 14808ce3e..208cc4428 100644 --- a/ui/nodeui.cpp +++ b/ui/nodeui.cpp @@ -32,7 +32,7 @@ void NodeUI::AddToScene(QGraphicsScene *scene) scene->addItem(this); } -void NodeUI::SetNode(Node *n) +void NodeUI::SetNode(OldEffectNode *n) { node_ = n; @@ -51,7 +51,7 @@ void NodeUI::SetNode(Node *n) setRect(rectangle); } -Node *NodeUI::GetNode() +OldEffectNode *NodeUI::GetNode() { return node_; } @@ -135,9 +135,9 @@ void NodeUI::mousePressEvent(QGraphicsSceneMouseEvent *event) // If this node is the edge's "input", then we'll drag that instead of creating a new edge - EffectRow* other_row = e->output(); + NodeIO* other_row = e->output(); - Node* other_node = other_row->GetParentEffect(); + OldEffectNode* other_node = other_row->GetParentEffect(); int other_row_index = other_node->IndexOfRow(other_row); @@ -149,7 +149,7 @@ void NodeUI::mousePressEvent(QGraphicsSceneMouseEvent *event) drag_source_ = other_row; // Disconnect the existing edge, and treat our dynamic one as an edit of that one - EffectRow::DisconnectEdge(edges.last()); + NodeIO::DisconnectEdge(edges.last()); @@ -202,15 +202,15 @@ void NodeUI::mouseMoveEvent(QGraphicsSceneMouseEvent *event) // If so, see if the two rows can be connected - EffectRow* local_row = drag_source_; - EffectRow* remote_row = mouse_node->GetRowFromIndex(i); + NodeIO* local_row = drag_source_; + NodeIO* remote_row = mouse_node->GetRowFromIndex(i); // Ensure one is an input and one is an output and whether their data types are compatible if (local_row->IsNodeInput() != remote_row->IsNodeInput()) { // Determine which row is the input and which row is the output - EffectRow* input_row = (local_row->IsNodeInput()) ? local_row : remote_row; - EffectRow* output_row = (local_row->IsNodeInput()) ? remote_row : local_row; + NodeIO* input_row = (local_row->IsNodeInput()) ? local_row : remote_row; + NodeIO* output_row = (local_row->IsNodeInput()) ? remote_row : local_row; if (input_row->CanAcceptDataType(output_row->OutputDataType())) { // This is a valid connection @@ -257,7 +257,7 @@ void NodeUI::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) event->accept(); if (drag_destination_ != nullptr) { - EffectRow::ConnectEdge(drag_source_, drag_destination_); + NodeIO::ConnectEdge(drag_source_, drag_destination_); } } else { QGraphicsItem::mouseReleaseEvent(event); @@ -269,11 +269,11 @@ QVector NodeUI::GetNodeSocketRects() QVector rects; if (node_ != nullptr) { - Node* e = node_; + OldEffectNode* e = node_; for (int i=0;irow_count();i++) { - EffectRow* row = e->row(i); + NodeIO* row = e->row(i); if (row->IsNodeInput() || row->IsNodeOutput()) { qreal x = (row->IsNodeOutput()) ? rect().right() - kNodePlugSize : rect().x(); @@ -290,7 +290,7 @@ QVector NodeUI::GetNodeSocketRects() return rects; } -EffectRow *NodeUI::GetRowFromIndex(int i) +NodeIO *NodeUI::GetRowFromIndex(int i) { if (node_ != nullptr && i < node_->row_count()) { return node_->row(i); @@ -298,7 +298,7 @@ EffectRow *NodeUI::GetRowFromIndex(int i) return nullptr; } -NodeUI *NodeUI::FindUIFromNode(Node* n) +NodeUI *NodeUI::FindUIFromNode(OldEffectNode* n) { QList all_items = scene()->items(); diff --git a/ui/nodeui.h b/ui/nodeui.h index 0558bbe01..0ab291ca3 100644 --- a/ui/nodeui.h +++ b/ui/nodeui.h @@ -5,9 +5,9 @@ #include class EffectUI; -class EffectRow; +class NodeIO; class NodeEdge; -class Node; +class OldEffectNode; class NodeUI : public QGraphicsRectItem { public: @@ -15,8 +15,8 @@ public: void AddToScene(QGraphicsScene* scene); //void Resize(const QSize& s); - void SetNode(Node* n); - Node* GetNode(); + void SetNode(OldEffectNode* n); + OldEffectNode* GetNode(); QVector GetNodeSocketRects(); @@ -28,16 +28,16 @@ protected: virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override; private: - EffectRow *GetRowFromIndex(int i); - NodeUI* FindUIFromNode(Node* n); + NodeIO *GetRowFromIndex(int i); + NodeUI* FindUIFromNode(OldEffectNode* n); int GetRowY(int index); - Node* node_; + OldEffectNode* node_; QGraphicsPathItem* drag_line_; QPointF drag_line_start_; - EffectRow* drag_source_; - EffectRow* drag_destination_; + NodeIO* drag_source_; + NodeIO* drag_destination_; QPainterPath drag_path_; int clicked_socket_; diff --git a/ui/nodeview.cpp b/ui/nodeview.cpp index b3c33f413..5a3f6ed52 100644 --- a/ui/nodeview.cpp +++ b/ui/nodeview.cpp @@ -5,7 +5,7 @@ #include #include "ui/menu.h" -#include "nodes/node.h" +#include "nodes/oldeffectnode.h" NodeView::NodeView(QGraphicsScene *scene, QWidget *parent) : QGraphicsView(scene, parent), diff --git a/ui/timelineview.cpp b/ui/timelineview.cpp index 25351529d..297fa596b 100644 --- a/ui/timelineview.cpp +++ b/ui/timelineview.cpp @@ -56,7 +56,7 @@ #include "ui/focusfilter.h" #include "dialogs/clippropertiesdialog.h" #include "global/debug.h" -#include "nodes/node.h" +#include "nodes/oldeffectnode.h" #include "effects/internal/solideffect.h" #include "timeline/track.h" #include "global/math.h" @@ -1042,7 +1042,7 @@ void TimelineView::mouseReleaseEvent(QMouseEvent *event) { case olive::timeline::ADD_OBJ_BARS: { c->set_name(tr("Bars")); - NodePtr e = olive::node_library[kSolidInput]->Create(c.get()); + OldEffectNodePtr e = olive::node_library[kSolidInput]->Create(c.get()); // Auto-select bars SolidEffect* solid_effect = static_cast(e.get()); diff --git a/ui/viewerwidget.h b/ui/viewerwidget.h index f2d0fc7f5..2b16bf96b 100644 --- a/ui/viewerwidget.h +++ b/ui/viewerwidget.h @@ -34,7 +34,7 @@ #include "timeline/clip.h" #include "project/footage.h" -#include "nodes/node.h" +#include "nodes/oldeffectnode.h" #include "ui/viewerwindow.h" #include "ui/viewercontainer.h" #include "rendering/renderthread.h" @@ -84,7 +84,7 @@ private: bool dragging; void seek_from_click(int x); QMatrix4x4 get_matrix(); - Node* gizmos; + OldEffectNode* gizmos; int drag_start_x; int drag_start_y; int gizmo_x_mvmt; diff --git a/undo/undo.cpp b/undo/undo.cpp index f9140cc5b..08c2adb38 100644 --- a/undo/undo.cpp +++ b/undo/undo.cpp @@ -189,7 +189,7 @@ void SetTimelineInOutCommand::doRedo() { } } -AddEffectCommand::AddEffectCommand(Clip* c, NodePtr e, NodeType m, int insert_pos) { +AddEffectCommand::AddEffectCommand(Clip* c, OldEffectNodePtr e, NodeType m, int insert_pos) { clip = c; ref = e; meta = m; @@ -545,7 +545,7 @@ void ReplaceClipMediaCommand::doRedo() { update_ui(true); } -EffectDeleteCommand::EffectDeleteCommand(Node *e) : +EffectDeleteCommand::EffectDeleteCommand(OldEffectNode *e) : effect_(e) {} @@ -1086,7 +1086,7 @@ void KeyframeAdd::doRedo() { } } -SetIsKeyframing::SetIsKeyframing(EffectRow *irow, bool ib) { +SetIsKeyframing::SetIsKeyframing(NodeIO *irow, bool ib) { row = irow; b = ib; } @@ -1133,7 +1133,7 @@ void UpdateViewer::doRedo() { panel_sequence_viewer->viewer_widget()->frame_update(); } -SetEffectData::SetEffectData(Node *e, const QByteArray &s) { +SetEffectData::SetEffectData(OldEffectNode *e, const QByteArray &s) { effect = e; data = s; } diff --git a/undo/undo.h b/undo/undo.h index 9ce89d493..123441064 100644 --- a/undo/undo.h +++ b/undo/undo.h @@ -30,7 +30,7 @@ #include "comboaction.h" -#include "nodes/node.h" +#include "nodes/oldeffectnode.h" #include "timeline/marker.h" #include "timeline/selection.h" #include "effects/keyframe.h" @@ -44,13 +44,13 @@ using SequencePtr = std::shared_ptr; class Media; using MediaPtr = std::shared_ptr; -class Node; -using NodePtr = std::shared_ptr; +class OldEffectNode; +using OldEffectNodePtr = std::shared_ptr; class Transition; using TransitionPtr = std::shared_ptr; -class EffectRow; +class NodeIO; class EffectField; class OliveAction : public QUndoCommand { @@ -124,13 +124,13 @@ private: class AddEffectCommand : public OliveAction { public: - AddEffectCommand(Clip* c, NodePtr e, NodeType m, int insert_pos = -1); + AddEffectCommand(Clip* c, OldEffectNodePtr e, NodeType m, int insert_pos = -1); virtual void doUndo() override; virtual void doRedo() override; private: Clip* clip; NodeType meta; - NodePtr ref; + OldEffectNodePtr ref; int pos; bool done; }; @@ -273,12 +273,12 @@ private: class EffectDeleteCommand : public OliveAction { public: - EffectDeleteCommand(Node* e); + EffectDeleteCommand(OldEffectNode* e); virtual void doUndo() override; virtual void doRedo() override; private: - Node* effect_; - NodePtr deleted_obj_; + OldEffectNode* effect_; + OldEffectNodePtr deleted_obj_; Clip* parent_clip_; int index_; }; @@ -568,11 +568,11 @@ private: class SetIsKeyframing : public OliveAction { public: - SetIsKeyframing(EffectRow* irow, bool ib); + SetIsKeyframing(NodeIO* irow, bool ib); virtual void doUndo() override; virtual void doRedo() override; private: - EffectRow* row; + NodeIO* row; bool b; }; @@ -593,11 +593,11 @@ public: class SetEffectData : public OliveAction { public: - SetEffectData(Node* e, const QByteArray &s); + SetEffectData(OldEffectNode* e, const QByteArray &s); virtual void doUndo() override; virtual void doRedo() override; private: - Node* effect; + OldEffectNode* effect; QByteArray data; QByteArray old_data; };