fixed node removals
This commit is contained in:
@@ -31,7 +31,7 @@ void NodeConnectable::ConnectEdge(Node *output, NodeInput *input, int element)
|
||||
|
||||
// Connection exists
|
||||
if (std::find(output->output_connections_.begin(), output->output_connections_.end(), conn_to_in) != output->output_connections_.end()) {
|
||||
qDebug() << "Ignored connect that already exists";
|
||||
qDebug() << "Ignored connect that already exists:" << output << input->parent() << input->id() << element;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ void NodeConnectable::DisconnectEdge(Node *output, NodeInput *input, int element
|
||||
|
||||
// Connection exists
|
||||
if (std::find(output->output_connections_.begin(), output->output_connections_.end(), conn_to_in) == output->output_connections_.end()) {
|
||||
qDebug() << "Ignored disconnect that doesn't exist";
|
||||
qDebug() << "Ignored disconnect that doesn't exist:" << output << input->parent() << input->id() << element;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -193,35 +193,6 @@ QBrush Node::brush(qreal top, qreal bottom) const
|
||||
}
|
||||
}
|
||||
|
||||
void Node::RemoveNodesAndExclusiveDependencies(Node *node, QUndoCommand *command)
|
||||
{
|
||||
// Remove main node
|
||||
RemoveNodeAndDisconnect(node, command);
|
||||
|
||||
// Remove exclusive dependencies
|
||||
QVector<Node*> deps = node->GetExclusiveDependencies();
|
||||
foreach (Node* d, deps) {
|
||||
RemoveNodeAndDisconnect(d, command);
|
||||
}
|
||||
}
|
||||
|
||||
void Node::RemoveNodeAndDisconnect(Node *node, QUndoCommand *command)
|
||||
{
|
||||
// Disconnect everything
|
||||
foreach (const InputConnection& conn, node->output_connections()) {
|
||||
new NodeEdgeRemoveCommand(node, conn.input, conn.element, command);
|
||||
}
|
||||
|
||||
foreach (NodeInput* input, node->inputs_) {
|
||||
for (auto it=input->edges().cbegin(); it!=input->edges().cend(); it++) {
|
||||
new NodeEdgeRemoveCommand(it->second, input, it->first, command);
|
||||
}
|
||||
}
|
||||
|
||||
// Remove node
|
||||
new NodeRemoveCommand(node, command);
|
||||
}
|
||||
|
||||
NodeValueTable Node::Value(NodeValueDatabase &value) const
|
||||
{
|
||||
return value.Merge();
|
||||
|
||||
@@ -193,10 +193,6 @@ public:
|
||||
return inputs_;
|
||||
}
|
||||
|
||||
static void RemoveNodesAndExclusiveDependencies(Node* node, QUndoCommand* command);
|
||||
|
||||
static void RemoveNodeAndDisconnect(Node* node, QUndoCommand* command);
|
||||
|
||||
/**
|
||||
* @brief Return the index of a parameter
|
||||
* @return Parameter index or -1 if this parameter is not part of this Node
|
||||
|
||||
Reference in New Issue
Block a user