MCPcopy Create free account
hub / github.com/NatronGitHub/Natron / buildTreeInternal

Method buildTreeInternal

Gui/NodeGraphUndoRedo.cpp:784–921  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

782typedef std::list<TreePtr> TreePtrList;
783
784void
785Tree::buildTreeInternal(const NodesGuiList& selectedNodes,
786 NodeGui* currentNode,
787 const QPointF & currentNodeScenePos,
788 std::list<NodeGui*> & usedNodes)
789{
790 QSize nodeSize = currentNode->getSize();
791 NodePtr internalNode = currentNode->getNode();
792 const std::vector<Edge*> & inputs = currentNode->getInputsArrows();
793 NodeGuiPtr firstNonMaskInput;
794 NodesGuiList otherNonMaskInputs;
795 NodesGuiList maskInputs;
796
797 for (U32 i = 0; i < inputs.size(); ++i) {
798 NodeGuiPtr source = inputs[i]->getSource();
799
800 ///Check if the source is selected
801 NodesGuiList::const_iterator foundSelected = std::find(selectedNodes.begin(), selectedNodes.end(), source);
802 if ( foundSelected == selectedNodes.end() ) {
803 continue;
804 }
805
806 if (source) {
807 bool isMask = internalNode->getEffectInstance()->isInputMask(i);
808 if (!firstNonMaskInput && !isMask) {
809 firstNonMaskInput = source;
810 for (std::list<TreeNode>::iterator it2 = nodes.begin(); it2 != nodes.end(); ++it2) {
811 if (it2->first == firstNonMaskInput) {
812 firstNonMaskInput.reset();
813 break;
814 }
815 }
816 } else if (!isMask) {
817 bool found = false;
818 for (std::list<TreeNode>::iterator it2 = nodes.begin(); it2 != nodes.end(); ++it2) {
819 if (it2->first == source) {
820 found = true;
821 break;
822 }
823 }
824 if (!found) {
825 otherNonMaskInputs.push_back(source);
826 }
827 } else if (isMask) {
828 bool found = false;
829 for (std::list<TreeNode>::iterator it2 = nodes.begin(); it2 != nodes.end(); ++it2) {
830 if (it2->first == source) {
831 found = true;
832 break;
833 }
834 }
835 if (!found) {
836 maskInputs.push_back(source);
837 }
838 } else {
839 ///this can't be happening
840 assert(false);
841 }

Callers

nothing calls this directly

Calls 15

getSourceMethod · 0.80
getEffectInstanceMethod · 0.80
emptyMethod · 0.80
getSizeMethod · 0.45
getNodeMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
isInputMaskMethod · 0.45
resetMethod · 0.45
push_backMethod · 0.45
heightMethod · 0.45

Tested by

no test coverage detected