nodes can now be connected through the node editor

This commit is contained in:
itsmattkc
2019-04-13 02:40:58 +10:00
parent 6b67727bd8
commit 8cd96eae64
24 changed files with 480 additions and 85 deletions
+1 -1
View File
@@ -7,7 +7,7 @@ BoolInput::BoolInput(Node* parent, const QString& id, const QString& name, bool
connect(bool_field, SIGNAL(Toggled(bool)), this, SIGNAL(Toggled(bool)));
AddField(bool_field);
AddNodeInput(olive::nodes::kBoolean);
AddAcceptedNodeInput(olive::nodes::kBoolean);
}
bool BoolInput::GetBoolAt(double timecode)
+1 -1
View File
@@ -5,7 +5,7 @@ ColorInput::ColorInput(Node* parent, const QString& id, const QString& name, boo
{
AddField(new ColorField(this));
AddNodeInput(olive::nodes::kColor);
AddAcceptedNodeInput(olive::nodes::kColor);
}
QColor ColorInput::GetColorAt(double timecode)
+1 -1
View File
@@ -7,7 +7,7 @@ ComboInput::ComboInput(Node* parent, const QString& id, const QString& name, boo
connect(combo_field, SIGNAL(DataChanged(const QVariant&)), this, SIGNAL(DataChanged(const QVariant&)));
AddField(combo_field);
AddNodeInput(olive::nodes::kCombo);
AddAcceptedNodeInput(olive::nodes::kCombo);
}
void ComboInput::AddItem(const QString &text, const QVariant &data)
+1 -1
View File
@@ -5,7 +5,7 @@ FileInput::FileInput(Node* parent, const QString& id, const QString& name, bool
{
AddField(new FileField(this));
AddNodeInput(olive::nodes::kFile);
AddAcceptedNodeInput(olive::nodes::kFile);
}
QString FileInput::GetFileAt(double timecode)
+1 -1
View File
@@ -5,7 +5,7 @@ FontInput::FontInput(Node* parent, const QString& id, const QString& name, bool
{
AddField(new FontField(this));
AddNodeInput(olive::nodes::kFont);
AddAcceptedNodeInput(olive::nodes::kFont);
}
QString FontInput::GetFontAt(double timecode)
+1 -1
View File
@@ -5,7 +5,7 @@ StringInput::StringInput(Node* parent, const QString& id, const QString& name, b
{
AddField(new StringField(this, rich_text));
AddNodeInput(olive::nodes::kString);
AddAcceptedNodeInput(olive::nodes::kString);
}
QString StringInput::GetStringAt(double timecode)
+4 -4
View File
@@ -15,15 +15,15 @@ VecInput::VecInput(Node* parent, const QString& id, const QString& name, int val
AddField(new DoubleField(this));
}
AddNodeInput(olive::nodes::kFloat);
AddAcceptedNodeInput(olive::nodes::kFloat);
if (values > 1) {
AddNodeInput(olive::nodes::kVec2);
AddAcceptedNodeInput(olive::nodes::kVec2);
}
if (values > 2) {
AddNodeInput(olive::nodes::kVec3);
AddAcceptedNodeInput(olive::nodes::kVec3);
}
if (values > 3) {
AddNodeInput(olive::nodes::kVec4);
AddAcceptedNodeInput(olive::nodes::kVec4);
}
}
+26
View File
@@ -148,6 +148,11 @@ void Node::AddRow(EffectRow *row)
rows.append(row);
}
int Node::IndexOfRow(EffectRow *row)
{
return rows.indexOf(row);
}
void Node::copy_field_keyframes(NodePtr e) {
for (int i=0;i<rows.size();i++) {
EffectRow* row = rows.at(i);
@@ -191,6 +196,17 @@ int Node::gizmo_count() {
return gizmos.size();
}
QVector<NodeEdge *> Node::GetAllEdges()
{
QVector<NodeEdge*> edges;
for (int i=0;i<row_count();i++) {
edges.append(row(i)->edges());
}
return edges;
}
void Node::refresh() {}
void Node::FieldChanged() {
@@ -310,6 +326,11 @@ 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);
@@ -615,6 +636,11 @@ 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) {
+8 -1
View File
@@ -127,7 +127,7 @@ public:
virtual NodePtr Create(Clip *c) = 0;
void AddRow(EffectRow* row);
int IndexOfRow(EffectRow* row);
EffectRow* row(int i);
int row_count();
@@ -135,6 +135,8 @@ public:
EffectGizmo* gizmo(int i);
int gizmo_count();
QVector<NodeEdge*> GetAllEdges();
bool IsEnabled();
bool IsExpanded();
@@ -168,6 +170,8 @@ public:
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);
@@ -225,6 +229,7 @@ public slots:
void FieldChanged();
void SetEnabled(bool b);
void SetExpanded(bool e);
void SetPos(const QPointF& pos);
signals:
void EnabledChanged(bool);
private slots:
@@ -264,6 +269,8 @@ private:
QVector<KeyframeDataChange*> gizmo_dragging_actions_;
QPointF pos_;
// superimpose functions
virtual void redraw(double timecode);
bool valueHasChanged(double timecode);
+21
View File
@@ -0,0 +1,21 @@
#include "nodeedge.h"
#include <QDebug>
#include "effects/effectrow.h"
NodeEdge::NodeEdge(EffectRow *output, EffectRow *input) :
output_(output),
input_(input)
{
}
EffectRow *NodeEdge::output()
{
return output_;
}
EffectRow *NodeEdge::input()
{
return input_;
}
+39
View File
@@ -0,0 +1,39 @@
#ifndef NODEEDGE_H
#define NODEEDGE_H
#include <memory>
class EffectRow;
class NodeEdge;
using NodeEdgePtr = std::shared_ptr<NodeEdge>;
class NodeEdge
{
public:
/**
* @brief NodeEdge Constructor
*
* Creates a node edge and stores its two connections.
*
* This should not be used directly. Use the static function EffectRow::ConnectEdge instead.
*
* @param output
*
* Output/from EffectRow that this edge "starts" at
*
* @param input
*
* Input/to EffectRow that this edge "ends" at
*/
NodeEdge(EffectRow* output, EffectRow* input);
EffectRow* output();
EffectRow* input();
private:
EffectRow* output_;
EffectRow* input_;
};
#endif // NODEEDGE_H
-11
View File
@@ -1,11 +0,0 @@
#include "nodeplug.h"
NodePlug::NodePlug()
{
}
bool NodePlug::IsConnected()
{
}
-13
View File
@@ -1,13 +0,0 @@
#ifndef NODEPLUG_H
#define NODEPLUG_H
class NodePlug
{
public:
NodePlug();
bool IsConnected();
};
#endif // NODEPLUG_H
+2
View File
@@ -3,6 +3,8 @@
NodeMedia::NodeMedia(Clip* c) :
Node(c)
{
EffectRow* matrix_input = new EffectRow(this, "matrix", tr("Matrix"), true, false);
matrix_input->AddAcceptedNodeInput(olive::nodes::kMatrix);
}
QString NodeMedia::name()