diff --git a/currentGitHash.txt b/currentGitHash.txt index 58a093131..ff15d9054 100644 --- a/currentGitHash.txt +++ b/currentGitHash.txt @@ -1 +1 @@ -bd3dbddf93bcd4c1f9edaacd9ccba7d398c6d0e0 +73072e0f0f0cb10acde81852bca6877866ccf5f0 diff --git a/hi_backend/backend/currentGit.h b/hi_backend/backend/currentGit.h index 50cfbcf77..fc44f6246 100644 --- a/hi_backend/backend/currentGit.h +++ b/hi_backend/backend/currentGit.h @@ -1 +1 @@ -#define PREVIOUS_HISE_COMMIT "bd3dbddf93bcd4c1f9edaacd9ccba7d398c6d0e0" +#define PREVIOUS_HISE_COMMIT "73072e0f0f0cb10acde81852bca6877866ccf5f0" diff --git a/hi_scripting/scripting/scriptnode/ui/DspNetworkComponents.cpp b/hi_scripting/scripting/scriptnode/ui/DspNetworkComponents.cpp index d27a1cd81..401212b43 100644 --- a/hi_scripting/scripting/scriptnode/ui/DspNetworkComponents.cpp +++ b/hi_scripting/scripting/scriptnode/ui/DspNetworkComponents.cpp @@ -571,6 +571,8 @@ void DspNetworkGraph::paintOverChildren(Graphics& g) float alpha = showCables ? 1.0f : 0.1f; Array sliderList; + Array connectedSliders; + fillChildComponentList(sliderList, this); Array multiOutputList; @@ -699,6 +701,8 @@ void DspNetworkGraph::paintOverChildren(Graphics& g) auto start = getCircle(sourceSlider); auto end = getCircle(targetSlider); + connectedSliders.add(targetSlider); + Colour hc = targetSlider->isMouseOver(true) ? Colours::red : Colour(0xFFAAAAAA); float thisAlpha = alpha; @@ -757,6 +761,8 @@ void DspNetworkGraph::paintOverChildren(Graphics& g) thisAlpha = HoverAlpha; } + connectedSliders.add(s); + auto start = getCircle(multiSource->asComponent(), false); auto end = getCircle(s); @@ -829,6 +835,8 @@ void DspNetworkGraph::paintOverChildren(Graphics& g) addModSource(s); } + connectedSliders.add(s); + auto end = getCircle(s); bool shouldPrintLabel = false; @@ -956,7 +964,7 @@ void DspNetworkGraph::paintOverChildren(Graphics& g) { auto start = getCircle(sourceSlider); auto end = getCircle(&b->powerButton).translated(0.0, -60.0f); - + Colour hc = sourceSlider->isMouseOver(true) ? Colours::red : Colour(0xFFAAAAAA); GlobalHiseLookAndFeel::paintCable(g, start, end, c, alpha, hc); @@ -967,6 +975,80 @@ void DspNetworkGraph::paintOverChildren(Graphics& g) } } + for(auto s: sliderList) + { + if(!s->pTree[PropertyIds::Automated]) + continue; + + if(connectedSliders.contains(s)) + continue; + + auto area = getCircle(s); + + auto hover = s->isMouseOver(true); + + g.setColour(hover ? Colours::red : Colours::white); + g.fillEllipse(area); + + if(hover) + { + auto ct = s->getConnectionSourceTree(); + + auto nt = valuetree::Helpers::findParentWithType(ct, PropertyIds::Node); + + if(auto sn = network->getNodeForValueTree(nt)) + { + for(auto b: bypassList) + { + if(b->parent.node == sn) + { + NodeComponent* nb = &b->parent; + + auto notFolded = true; + + while(notFolded) + { + auto nt = nb->node->getValueTree().getParent(); + + valuetree::Helpers::forEachParent(nt, [&](const ValueTree& p) + { + if(p.getType() == PropertyIds::Node) + { + notFolded &= !(bool)p[PropertyIds::Folded]; + } + + return false; + }); + + if(notFolded) + break; + + nb = nb->findParentComponentOfClass(); + + if(nb == nullptr) + break; + } + + if(nb != nullptr) + { + auto h = &nb->header; + + auto sourceRect = getLocalArea(h, h->getLocalBounds()); + + g.setColour(Colours::red.withAlpha(0.2f)); + g.fillRect(sourceRect); + + } + + break; + } + } + } + } + + + } + Array sendList; fillChildComponentList(sendList, this); @@ -2465,13 +2547,12 @@ void KeyboardPopup::addNodeAndClose(String path) newNode = network->createFromValueTree(true, newTree, true); - network->runPostInitFunctions(); - auto as = dynamic_cast(container); as->assign(ap, newNode); network->deselectAll(); network->addToSelection(dynamic_cast(newNode.getObject()), ModifierKeys()); + network->runPostInitFunctions(); } sp->setCurrentModalWindow(nullptr, {}); diff --git a/hi_scripting/scripting/scriptnode/ui/NodeComponent.cpp b/hi_scripting/scripting/scriptnode/ui/NodeComponent.cpp index da70d15c5..3e6b800a6 100644 --- a/hi_scripting/scripting/scriptnode/ui/NodeComponent.cpp +++ b/hi_scripting/scripting/scriptnode/ui/NodeComponent.cpp @@ -96,9 +96,16 @@ NodeComponent::Header::Header(NodeComponent& parent_) : freezeButton.setToggleModeWithColourChange(true); + auto isContainer = dynamic_cast(parent.node.get()) != nullptr; + parameterButton.setToggleModeWithColourChange(true); parameterButton.setToggleStateAndUpdateIcon(parent.dataReference[PropertyIds::ShowParameters]); - parameterButton.setVisible(dynamic_cast(parent.node.get()) != nullptr); + parameterButton.setVisible(isContainer); + + if(isContainer) + { + parameterUpdater.setCallback(parent.node->getValueTree(), {PropertyIds::ShowParameters}, valuetree::AsyncMode::Asynchronously, BIND_MEMBER_FUNCTION_2(Header::updateConnectionButton)); + } freezeButton.setEnabled(parent.node->getRootNetwork()->canBeFrozen()); @@ -142,6 +149,11 @@ void NodeComponent::Header::updatePowerButtonState(Identifier id, var newValue) repaint(); } +void NodeComponent::Header::updateConnectionButton(Identifier id, var newValue) +{ + parameterButton.setToggleStateAndUpdateIcon((bool)newValue); +} + void NodeComponent::Header::mouseDoubleClick(const MouseEvent& e) { if (powerButton.getBoundsInParent().expanded(2).contains(e.getPosition())) diff --git a/hi_scripting/scripting/scriptnode/ui/NodeComponent.h b/hi_scripting/scripting/scriptnode/ui/NodeComponent.h index 18f53bd1b..34d9bcf5e 100644 --- a/hi_scripting/scripting/scriptnode/ui/NodeComponent.h +++ b/hi_scripting/scripting/scriptnode/ui/NodeComponent.h @@ -88,6 +88,7 @@ class NodeComponent : public ComponentWithMiddleMouseDrag, String getPowerButtonId(bool getOff) const; void updatePowerButtonState(Identifier id, var newValue); + void updateConnectionButton(Identifier id, var newValue); void paint(Graphics& g) override; void resized() override; @@ -151,6 +152,7 @@ class NodeComponent : public ComponentWithMiddleMouseDrag, valuetree::RecursiveTypedChildListener dynamicPowerUpdater; valuetree::PropertyListener powerButtonUpdater; + valuetree::PropertyListener parameterUpdater; valuetree::PropertyListener colourUpdater; HiseShapeButton powerButton; HiseShapeButton deleteButton; diff --git a/hi_scripting/scripting/scriptnode/ui/ParameterSlider.cpp b/hi_scripting/scripting/scriptnode/ui/ParameterSlider.cpp index aa9a58604..bffd6ad5b 100644 --- a/hi_scripting/scripting/scriptnode/ui/ParameterSlider.cpp +++ b/hi_scripting/scripting/scriptnode/ui/ParameterSlider.cpp @@ -962,6 +962,20 @@ void ParameterSlider::checkEnabledState() modulationActive = parameterToControl != nullptr && parameterToControl->isModulated(); setEnabled(!modulationActive); + String tt; + + tt << node->getId() + "." + getName(); + + if(modulationActive) + { + auto ct = getConnectionSourceTree(); + auto nt = valuetree::Helpers::findParentWithType(ct, PropertyIds::Node); + + tt << " - modulated by " << nt[PropertyIds::Name].toString(); + } + + setTooltip(tt); + if (modulationActive) start(); else @@ -1338,12 +1352,59 @@ void ParameterSlider::mouseDoubleClick(const MouseEvent&) } } - parameterToControl->addConnectionFrom({}); + auto ct = getConnectionSourceTree(); - - auto v = parameterToControl->getValue(); - - setValue(v, dontSendNotification); + if(ct.isValid()) + { + + + bool sourceIsVisible = true; + + valuetree::Helpers::forEachParent(ct, [&](const ValueTree& p) + { + if(p.getType() == PropertyIds::Node) + { + sourceIsVisible &= !(bool)p[PropertyIds::Folded]; + } + + return false; + }); + + auto sourceNodeTree = valuetree::Helpers::findParentWithType(ct, PropertyIds::Node); + + auto isConnectedToParentChain = pTree.isAChildOf(sourceNodeTree); + + if(isConnectedToParentChain) + { + sourceIsVisible = (bool)sourceNodeTree[PropertyIds::ShowParameters]; + } + + if(sourceIsVisible) + { + parameterToControl->addConnectionFrom({}); + auto v = parameterToControl->getValue(); + setValue(v, dontSendNotification); + } + else + { + if(isConnectedToParentChain) + { + sourceNodeTree.setProperty(PropertyIds::ShowParameters, true, nullptr); + } + else + { + valuetree::Helpers::forEachParent(ct, [&](ValueTree& p) + { + if(p.getType() == PropertyIds::Node) + { + p.setProperty(PropertyIds::Folded, false, nullptr); + } + + return false; + }); + } + } + } } }