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

Function applyNodeRedirectionsDownstream

Engine/Node.cpp:5011–5085  ·  view source on GitHub ↗

* @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. **/

Source from the content-addressed store, hash-verified

5009 * may be connected to the same node.
5010 **/
5011static void
5012applyNodeRedirectionsDownstream(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);

Callers 1

Calls 12

getInputsOutputsMethod · 0.80
getEffectInstanceMethod · 0.80
getOutputs_mt_safeMethod · 0.80
isPartOfPrecompMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
getMethod · 0.45
getGroupMethod · 0.45
getNodeMethod · 0.45
lockMethod · 0.45
getOutputNodeMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected