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

Function applyNodeRedirectionsUpstream

Engine/NodeInputs.cpp:45–83  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43#include "Engine/OpenGLViewerI.h"
44
45NATRON_NAMESPACE_ENTER
46
47/**
48 * @brief Resolves links of the graph in the case of containers (that do not do any rendering but only contain nodes inside)
49 * so that algorithms that cycle the tree from bottom to top
50 * properly visit all nodes in the correct order
51 **/
52static NodePtr
53applyNodeRedirectionsUpstream(const NodePtr& node,
54 bool useGuiInput)
55{
56 if (!node) {
57 return node;
58 }
59 NodeGroup* isGrp = node->isEffectGroup();
60 if (isGrp) {
61 //The node is a group, instead jump directly to the output node input of the group
62 return applyNodeRedirectionsUpstream(isGrp->getOutputNodeInput(useGuiInput), useGuiInput);
63 }
64
65 PrecompNode* isPrecomp = dynamic_cast<PrecompNode*>( node->getEffectInstance().get() );
66 if (isPrecomp) {
67 //The node is a precomp, instead jump directly to the output node of the precomp
68 return applyNodeRedirectionsUpstream(isPrecomp->getOutputNode(), useGuiInput);
69 }
70
71 GroupInput* isInput = dynamic_cast<GroupInput*>( node->getEffectInstance().get() );
72 if (isInput) {
73 //The node is a group input, jump to the corresponding input of the group
74 NodeCollectionPtr collection = node->getGroup();
75 assert(collection);
76 isGrp = dynamic_cast<NodeGroup*>( collection.get() );
77 if (isGrp) {
78 return applyNodeRedirectionsUpstream(isGrp->getRealInputForInput(useGuiInput, node), useGuiInput);
79 }
80 }
81
82 return node;
83}
84
85/**
86 * @brief Resolves links of the graph in the case of containers (that do not do any rendering but only contain nodes inside)

Callers 1

getInputInternalMethod · 0.85

Calls 6

getOutputNodeInputMethod · 0.80
getEffectInstanceMethod · 0.80
getRealInputForInputMethod · 0.80
getMethod · 0.45
getOutputNodeMethod · 0.45
getGroupMethod · 0.45

Tested by

no test coverage detected