Skip to content

Commit

Permalink
Fix various EmptyProcessor issues in ProcessorGraph and EditorViewport
Browse files Browse the repository at this point in the history
  • Loading branch information
anjaldoshi committed Nov 10, 2023
1 parent d4bc31d commit 284acda
Show file tree
Hide file tree
Showing 8 changed files with 305 additions and 162 deletions.
12 changes: 5 additions & 7 deletions Source/Processors/Merger/Merger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@ void Merger::setMergerSourceNode(GenericProcessor* sn)
void Merger::switchIO(int sourceNum)
{

static_cast<MergerEditor*>(getEditor())->switchSource(sourceNum, false);
LOGDD("Merger switching source path to ", sourceNum);

if (!headlessMode)
static_cast<MergerEditor*>(getEditor())->switchSource(sourceNum, false);

activePath = sourceNum;

Expand Down Expand Up @@ -143,7 +146,7 @@ bool Merger::stillHasSource() const
void Merger::switchIO()
{

LOGDD("Merger switching source.");
LOGDD("Merger switching source. New path: ", 1 - activePath);

if (activePath == 0)
{
Expand Down Expand Up @@ -347,11 +350,6 @@ void Merger::restoreConnections()
ProcessorGraph* gr = AccessClass::getProcessorGraph();
Array<GenericProcessor*> p = gr->getListOfProcessors();

sourceNode = nullptr;
sourceNodeA = nullptr;
sourceNodeB = nullptr;


for (int k = 0; k < p.size(); k++)
{
if (p[k]->getNodeId() == nodeIdA)
Expand Down
20 changes: 10 additions & 10 deletions Source/Processors/Merger/MergerEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ void MergerEditor::mouseDown(const MouseEvent& e)

Array<GenericProcessor*> selectableProcessors = getSelectableProcessors();

if (merger->sourceNodeA != 0)
if (merger->sourceNodeA != 0 && !merger->sourceNodeA->isEmpty())
{
menu.addItem(++menuItemIndex, // index
"Input A: ", // message
Expand Down Expand Up @@ -198,7 +198,7 @@ void MergerEditor::mouseDown(const MouseEvent& e)
" ",
false);

if (merger->sourceNodeB != 0)
if (merger->sourceNodeB != 0 && !merger->sourceNodeB->isEmpty())
{
menu.addItem(++menuItemIndex, // index
"Input B: ", // message
Expand Down Expand Up @@ -262,11 +262,11 @@ void MergerEditor::mouseDown(const MouseEvent& e)
if (result >= inputSelectionIndexA
&& result < inputSelectionIndexA + selectableProcessors.size())
{
switchSource(0);
merger->setMergerSourceNode(selectableProcessors[result - inputSelectionIndexA]);
selectableProcessors[result-inputSelectionIndexA]->setDestNode(merger);
// switchSource(0);
// merger->setMergerSourceNode(selectableProcessors[result - inputSelectionIndexA]);
// selectableProcessors[result-inputSelectionIndexA]->setDestNode(merger);

AccessClass::getProcessorGraph()->updateSettings(getProcessor());
AccessClass::getProcessorGraph()->connectMergerSource(getProcessor(), selectableProcessors[result - inputSelectionIndexA], 0);
return;
}
}
Expand All @@ -276,11 +276,11 @@ void MergerEditor::mouseDown(const MouseEvent& e)
if (result >= inputSelectionIndexB
&& result < inputSelectionIndexB + selectableProcessors.size())
{
switchSource(1);
merger->setMergerSourceNode(selectableProcessors[result - inputSelectionIndexB]);
selectableProcessors[result-inputSelectionIndexB]->setDestNode(merger);
// switchSource(1);
// merger->setMergerSourceNode(selectableProcessors[result - inputSelectionIndexB]);
// selectableProcessors[result-inputSelectionIndexB]->setDestNode(merger);

AccessClass::getProcessorGraph()->updateSettings(getProcessor());
AccessClass::getProcessorGraph()->connectMergerSource(getProcessor(), selectableProcessors[result - inputSelectionIndexB], 1);
return;
}
}
Expand Down
Loading

0 comments on commit 284acda

Please sign in to comment.