nodes: link edges to IDs rather than objects

Allows code to know whether the connected parameters has been removed or
not.
This commit is contained in:
itsmattkc
2020-10-02 16:04:50 +10:00
parent 2fb7066155
commit 4204910796
16 changed files with 112 additions and 38 deletions
+26 -5
View File
@@ -22,13 +22,16 @@
#define EDGE_H
#include <memory>
#include <QString>
#include "common/define.h"
OLIVE_NAMESPACE_ENTER
class NodeOutput;
class Node;
class NodeInput;
class NodeOutput;
class NodeParam;
/**
* @brief A connection between two node parameters (a NodeOutput and a NodeInput)
@@ -44,19 +47,37 @@ public:
*/
NodeEdge(NodeOutput* output, NodeInput* input);
Node* output_node() const
{
return output_.node;
}
Node* input_node() const
{
return input_.node;
}
/**
* @brief Return the output parameter this edge is connected to
*/
NodeOutput* output();
NodeOutput* output() const;
/**
* @brief Return the input parameter this edge is connected to
*/
NodeInput* input();
NodeInput* input() const;
private:
NodeOutput* output_;
NodeInput* input_;
struct Connection {
Node* node;
QString id;
};
static Connection ParamToConnection(NodeParam* param);
Connection output_;
Connection input_;
};
using NodeEdgePtr = std::shared_ptr<NodeEdge>;