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

Method buildTreeInternal

Gui/NodeGraphUndoRedo.cpp:795–932  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

793typedef std::list< boost::shared_ptr<Tree> > TreeList;
794
795void
796Tree::buildTreeInternal(const NodesGuiList& selectedNodes,
797 NodeGui* currentNode,
798 const QPointF & currentNodeScenePos,
799 std::list<NodeGui*> & usedNodes)
800{
801 QSize nodeSize = currentNode->getSize();
802 NodePtr internalNode = currentNode->getNode();
803 const std::vector<Edge*> & inputs = currentNode->getInputsArrows();
804 NodeGuiPtr firstNonMaskInput;
805 NodesGuiList otherNonMaskInputs;
806 NodesGuiList maskInputs;
807
808 for (U32 i = 0; i < inputs.size(); ++i) {
809 NodeGuiPtr source = inputs[i]->getSource();
810
811 ///Check if the source is selected
812 NodesGuiList::const_iterator foundSelected = std::find(selectedNodes.begin(), selectedNodes.end(), source);
813 if ( foundSelected == selectedNodes.end() ) {
814 continue;
815 }
816
817 if (source) {
818 bool isMask = internalNode->getEffectInstance()->isInputMask(i);
819 if (!firstNonMaskInput && !isMask) {
820 firstNonMaskInput = source;
821 for (std::list<TreeNode>::iterator it2 = nodes.begin(); it2 != nodes.end(); ++it2) {
822 if (it2->first == firstNonMaskInput) {
823 firstNonMaskInput.reset();
824 break;
825 }
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 otherNonMaskInputs.push_back(source);
837 }
838 } else if (isMask) {
839 bool found = false;
840 for (std::list<TreeNode>::iterator it2 = nodes.begin(); it2 != nodes.end(); ++it2) {
841 if (it2->first == source) {
842 found = true;
843 break;
844 }
845 }
846 if (!found) {
847 maskInputs.push_back(source);
848 }
849 } else {
850 ///this can't be happening
851 assert(false);
852 }

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