MCPcopy Create free account
hub / github.com/christophhart/HISE / setParent

Method setParent

hi_scripting/scripting/scriptnode/api/NodeBase.cpp:664–696  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

662}
663
664void NodeBase::setParent(var parentNode, int indexInParent)
665{
666 checkValid();
667
668 ScopedValueSetter<bool> svs(isCurrentlyMoved, true);
669
670 auto network = getRootNetwork();
671
672 // allow passing in the root network
673 if (parentNode.getObject() == network)
674 parentNode = var(network->getRootNode());
675
676 Parameter::ScopedAutomationPreserver sap(this);
677
678 if(getValueTree().getParent().isValid())
679 getValueTree().getParent().removeChild(getValueTree(), getUndoManager());
680
681 if (auto pNode = dynamic_cast<NodeContainer*>(network->get(parentNode).getObject()))
682 {
683 pNode->getNodeTree().addChild(getValueTree(), indexInParent, network->getUndoManager());
684 }
685
686 else
687 {
688 if (parentNode.toString().isNotEmpty())
689 reportScriptError("parent node " + parentNode.toString() + " not found.");
690
691 if (auto pNode = dynamic_cast<NodeContainer*>(getParentNode()))
692 {
693 pNode->getNodeTree().removeChild(getValueTree(), getUndoManager());
694 }
695 }
696}
697
698var NodeBase::getParameter(var indexOrId) const
699{

Callers 4

createAndAddMethod · 0.45
insertDraggedNodeMethod · 0.45
handlePopupMenuResultMethod · 0.45
wrapIntoChainMethod · 0.45

Calls 13

varFunction · 0.85
getRootNodeMethod · 0.80
getNodeTreeMethod · 0.80
getUndoManagerFunction · 0.50
getObjectMethod · 0.45
isValidMethod · 0.45
getParentMethod · 0.45
removeChildMethod · 0.45
getMethod · 0.45
addChildMethod · 0.45
getUndoManagerMethod · 0.45
isNotEmptyMethod · 0.45

Tested by

no test coverage detected