* @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. **/
| 5009 | * may be connected to the same node. |
| 5010 | **/ |
| 5011 | static void |
| 5012 | applyNodeRedirectionsDownstream(int recurseCounter, |
| 5013 | const NodePtr& node, |
| 5014 | bool useGuiOutputs, |
| 5015 | NodesList& translated) |
| 5016 | { |
| 5017 | NodeGroup* isGrp = node->isEffectGroup(); |
| 5018 | |
| 5019 | if (isGrp) { |
| 5020 | //The node is a group, meaning it should not be taken into account, instead jump directly to the input nodes output of the group |
| 5021 | NodesList inputNodes; |
| 5022 | isGrp->getInputsOutputs(&inputNodes, useGuiOutputs); |
| 5023 | for (NodesList::iterator it2 = inputNodes.begin(); it2 != inputNodes.end(); ++it2) { |
| 5024 | //Call recursively on them |
| 5025 | applyNodeRedirectionsDownstream(recurseCounter + 1, *it2, useGuiOutputs, translated); |
| 5026 | } |
| 5027 | |
| 5028 | return; |
| 5029 | } |
| 5030 | |
| 5031 | GroupOutput* isOutput = dynamic_cast<GroupOutput*>( node->getEffectInstance().get() ); |
| 5032 | if (isOutput) { |
| 5033 | //The node is the output of a group, its outputs are the outputs of the group |
| 5034 | boost::shared_ptr<NodeCollection> collection = isOutput->getNode()->getGroup(); |
| 5035 | if (!collection) { |
| 5036 | return; |
| 5037 | } |
| 5038 | isGrp = dynamic_cast<NodeGroup*>( collection.get() ); |
| 5039 | if (isGrp) { |
| 5040 | NodesWList groupOutputs; |
| 5041 | if (useGuiOutputs) { |
| 5042 | groupOutputs = isGrp->getNode()->getGuiOutputs(); |
| 5043 | } else { |
| 5044 | NodePtr grpNode = isGrp->getNode(); |
| 5045 | if (grpNode) { |
| 5046 | grpNode->getOutputs_mt_safe(groupOutputs); |
| 5047 | } |
| 5048 | } |
| 5049 | for (NodesWList::iterator it2 = groupOutputs.begin(); it2 != groupOutputs.end(); ++it2) { |
| 5050 | //Call recursively on them |
| 5051 | NodePtr output = it2->lock(); |
| 5052 | if (output) { |
| 5053 | applyNodeRedirectionsDownstream(recurseCounter + 1, output, useGuiOutputs, translated); |
| 5054 | } |
| 5055 | } |
| 5056 | } |
| 5057 | |
| 5058 | return; |
| 5059 | } |
| 5060 | |
| 5061 | boost::shared_ptr<PrecompNode> isInPrecomp = node->isPartOfPrecomp(); |
| 5062 | if ( isInPrecomp && (isInPrecomp->getOutputNode() == node) ) { |
| 5063 | //This node is the output of the precomp, its outputs are the outputs of the precomp node |
| 5064 | NodesWList groupOutputs; |
| 5065 | if (useGuiOutputs) { |
| 5066 | groupOutputs = isInPrecomp->getNode()->getGuiOutputs(); |
| 5067 | } else { |
| 5068 | isInPrecomp->getNode()->getOutputs_mt_safe(groupOutputs); |
no test coverage detected