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:
+26
-5
@@ -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>;
|
||||
|
||||
Reference in New Issue
Block a user