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
+16 -7
View File
@@ -20,22 +20,31 @@
#include "edge.h"
#include "input.h"
#include "node.h"
#include "output.h"
OLIVE_NAMESPACE_ENTER
NodeEdge::NodeEdge(NodeOutput *output, NodeInput *input) :
output_(output),
input_(input)
NodeEdge::NodeEdge(NodeOutput *output, NodeInput *input)
{
output_ = ParamToConnection(output);
input_ = ParamToConnection(input);
}
NodeOutput *NodeEdge::output()
NodeOutput *NodeEdge::output() const
{
return output_;
return output_.node->GetOutputWithID(output_.id);
}
NodeInput *NodeEdge::input()
NodeInput *NodeEdge::input() const
{
return input_;
return input_.node->GetInputWithID(input_.id);
}
NodeEdge::Connection NodeEdge::ParamToConnection(NodeParam *param)
{
return {param->parentNode(), param->id()};
}
OLIVE_NAMESPACE_EXIT