diff --git a/Source/Processors/ProcessorGraph/ProcessorGraph.cpp b/Source/Processors/ProcessorGraph/ProcessorGraph.cpp index 5af7e44ff..f1fca30a4 100644 --- a/Source/Processors/ProcessorGraph/ProcessorGraph.cpp +++ b/Source/Processors/ProcessorGraph/ProcessorGraph.cpp @@ -446,7 +446,7 @@ bool ProcessorGraph::checkForNewRootNodes (GenericProcessor* processor, { LOGDD (" Didn't find dest node in root nodes; adding a new root."); - if (!isLoadingSignalChain && rootNodes.size() == 8) + if (! isLoadingSignalChain && rootNodes.size() == 8) { AlertWindow::showMessageBoxAsync (AlertWindow::WarningIcon, "Signal chain error", "Maximum of 8 signal chains."); return false; @@ -482,7 +482,7 @@ bool ProcessorGraph::checkForNewRootNodes (GenericProcessor* processor, { LOGDD (" Has no dest node; adding."); - if (!isLoadingSignalChain && rootNodes.size() == 8) + if (! isLoadingSignalChain && rootNodes.size() == 8) { AlertWindow::showMessageBoxAsync (AlertWindow::WarningIcon, "Signal chain error", "Maximum of 8 signal chains."); return false; @@ -993,6 +993,8 @@ void ProcessorGraph::clearSignalChain() AccessClass::getGraphViewer()->removeAllNodes(); updateViews (nullptr); + + LOGC ("Signal chain cleared."); } void ProcessorGraph::changeListenerCallback (ChangeBroadcaster* source) diff --git a/Source/Processors/ProcessorGraph/ProcessorGraphActions.cpp b/Source/Processors/ProcessorGraph/ProcessorGraphActions.cpp index 0271479bf..bf33a93f4 100644 --- a/Source/Processors/ProcessorGraph/ProcessorGraphActions.cpp +++ b/Source/Processors/ProcessorGraph/ProcessorGraphActions.cpp @@ -312,19 +312,9 @@ MoveProcessor::MoveProcessor (GenericProcessor* processor, originalSourceNodeId = -1; if (processor->getDestNode() != nullptr) - { originalDestNodeId = processor->getDestNode()->getNodeId(); - - if (processor->getDestNode()->getDestNode() != nullptr) - originalDestNodeDestNodeId = processor->getDestNode()->getDestNode()->getNodeId(); - else - originalDestNodeDestNodeId = -1; - } else - { originalDestNodeId = -1; - originalDestNodeDestNodeId = -1; - } if (sourceNode != nullptr) newSourceNodeId = sourceNode->getNodeId(); @@ -332,9 +322,19 @@ MoveProcessor::MoveProcessor (GenericProcessor* processor, newSourceNodeId = -1; if (destNode != nullptr) + { newDestNodeId = destNode->getNodeId(); + + if (destNode->getSourceNode() != nullptr) + newDestNodeSourceNodeId = destNode->getSourceNode()->getNodeId(); + else + newDestNodeSourceNodeId = -1; + } else + { newDestNodeId = -1; + newDestNodeSourceNodeId = -1; + } } MoveProcessor::~MoveProcessor() @@ -372,16 +372,14 @@ bool MoveProcessor::undo() processorGraph->moveProcessor (processor, sourceProcessor, destProcessor, - moveDownstream); + ! moveDownstream); - if (processor->isSource() && originalDestNodeDestNodeId > -1) + if (processor->isSource() && newDestNodeSourceNodeId > -1) { - GenericProcessor* originalDest = processorGraph->getProcessorWithNodeId (originalDestNodeDestNodeId); + GenericProcessor* newDest = processorGraph->getProcessorWithNodeId (newDestNodeId); + GenericProcessor* newDestOrigSource = processorGraph->getProcessorWithNodeId (newDestNodeSourceNodeId); - processorGraph->moveProcessor (originalDest, - destProcessor, - originalDest->getDestNode(), - moveDownstream); + processorGraph->reconnectProcessors (newDestNodeSourceNodeId, newDestNodeId); } return true; diff --git a/Source/Processors/ProcessorGraph/ProcessorGraphActions.h b/Source/Processors/ProcessorGraph/ProcessorGraphActions.h index 9360d8225..c75ab9542 100644 --- a/Source/Processors/ProcessorGraph/ProcessorGraphActions.h +++ b/Source/Processors/ProcessorGraph/ProcessorGraphActions.h @@ -176,8 +176,7 @@ class MoveProcessor : public UndoableAction int originalDestNodeId; int newSourceNodeId; int newDestNodeId; - - int originalDestNodeDestNodeId; + int newDestNodeSourceNodeId; bool moveDownstream;