| 43 | #include "Engine/OpenGLViewerI.h" |
| 44 | |
| 45 | NATRON_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 | **/ |
| 52 | static NodePtr |
| 53 | applyNodeRedirectionsUpstream(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) |
no test coverage detected