* @brief Resolves links of the graph in the case of containers (that do not do any rendering but only contain nodes inside) * so that algorithms that cycle the tree from top to bottom * properly visit all nodes in the correct order. Note that one node may translate to several nodes since multiple nodes * may be connected to the same node. **/
| 89 | * may be connected to the same node. |
| 90 | **/ |
| 91 | static void |
| 92 | applyNodeRedirectionsDownstream(int recurseCounter, |
| 93 | const NodePtr& node, |
| 94 | bool useGuiOutputs, |
| 95 | NodesList& translated) |
| 96 | { |
| 97 | NodeGroup* isGrp = node->isEffectGroup(); |
| 98 | |
| 99 | if (isGrp) { |
| 100 | //The node is a group, meaning it should not be taken into account, instead jump directly to the input nodes output of the group |
| 101 | NodesList inputNodes; |
| 102 | isGrp->getInputsOutputs(&inputNodes, useGuiOutputs); |
| 103 | for (NodesList::iterator it2 = inputNodes.begin(); it2 != inputNodes.end(); ++it2) { |
| 104 | //Call recursively on them |
| 105 | applyNodeRedirectionsDownstream(recurseCounter + 1, *it2, useGuiOutputs, translated); |
| 106 | } |
| 107 | |
| 108 | return; |
| 109 | } |
| 110 | |
| 111 | GroupOutput* isOutput = dynamic_cast<GroupOutput*>( node->getEffectInstance().get() ); |
| 112 | if (isOutput) { |
| 113 | //The node is the output of a group, its outputs are the outputs of the group |
| 114 | NodeCollectionPtr collection = isOutput->getNode()->getGroup(); |
| 115 | if (!collection) { |
| 116 | return; |
| 117 | } |
| 118 | isGrp = dynamic_cast<NodeGroup*>( collection.get() ); |
| 119 | if (isGrp) { |
| 120 | NodesWList groupOutputs; |
| 121 | if (useGuiOutputs) { |
| 122 | groupOutputs = isGrp->getNode()->getGuiOutputs(); |
| 123 | } else { |
| 124 | NodePtr grpNode = isGrp->getNode(); |
| 125 | if (grpNode) { |
| 126 | grpNode->getOutputs_mt_safe(groupOutputs); |
| 127 | } |
| 128 | } |
| 129 | for (NodesWList::iterator it2 = groupOutputs.begin(); it2 != groupOutputs.end(); ++it2) { |
| 130 | //Call recursively on them |
| 131 | NodePtr output = it2->lock(); |
| 132 | if (output) { |
| 133 | applyNodeRedirectionsDownstream(recurseCounter + 1, output, useGuiOutputs, translated); |
| 134 | } |
| 135 | } |
| 136 | } |
| 137 | |
| 138 | return; |
| 139 | } |
| 140 | |
| 141 | PrecompNodePtr isInPrecomp = node->isPartOfPrecomp(); |
| 142 | if ( isInPrecomp && (isInPrecomp->getOutputNode() == node) ) { |
| 143 | //This node is the output of the precomp, its outputs are the outputs of the precomp node |
| 144 | NodesWList groupOutputs; |
| 145 | if (useGuiOutputs) { |
| 146 | groupOutputs = isInPrecomp->getNode()->getGuiOutputs(); |
| 147 | } else { |
| 148 | isInPrecomp->getNode()->getOutputs_mt_safe(groupOutputs); |
no test coverage detected