group: when adding input passthrough, return unique ID

This commit is contained in:
itsmattkc
2022-01-21 10:08:06 -08:00
parent bc14b0454d
commit 75691e8bea
2 changed files with 5 additions and 3 deletions
+4 -2
View File
@@ -58,14 +58,14 @@ void NodeGroup::Retranslate()
} }
} }
void NodeGroup::AddInputPassthrough(const NodeInput &input) QString NodeGroup::AddInputPassthrough(const NodeInput &input)
{ {
Q_ASSERT(ContextContainsNode(input.node())); Q_ASSERT(ContextContainsNode(input.node()));
for (auto it=input_passthroughs_.cbegin(); it!=input_passthroughs_.cend(); it++) { for (auto it=input_passthroughs_.cbegin(); it!=input_passthroughs_.cend(); it++) {
if (it.value() == input) { if (it.value() == input) {
// Already passing this input through // Already passing this input through
return; return it.key();
} }
} }
@@ -77,6 +77,8 @@ void NodeGroup::AddInputPassthrough(const NodeInput &input)
input_passthroughs_.insert(id, input); input_passthroughs_.insert(id, input);
emit InputPassthroughAdded(this, input); emit InputPassthroughAdded(this, input);
return id;
} }
void NodeGroup::RemoveInputPassthrough(const NodeInput &input) void NodeGroup::RemoveInputPassthrough(const NodeInput &input)
+1 -1
View File
@@ -41,7 +41,7 @@ public:
virtual void Retranslate() override; virtual void Retranslate() override;
void AddInputPassthrough(const NodeInput &input); QString AddInputPassthrough(const NodeInput &input);
void RemoveInputPassthrough(const NodeInput &input); void RemoveInputPassthrough(const NodeInput &input);