| 2900 | } |
| 2901 | |
| 2902 | NodePtr |
| 2903 | Node::getPreferredInputNode() const |
| 2904 | { |
| 2905 | GroupInput* isInput = dynamic_cast<GroupInput*>( _imp->effect.get() ); |
| 2906 | PrecompNode* isPrecomp = dynamic_cast<PrecompNode*>( _imp->effect.get() ); |
| 2907 | |
| 2908 | if (isInput) { |
| 2909 | NodeGroup* isGroup = dynamic_cast<NodeGroup*>( getGroup().get() ); |
| 2910 | assert(isGroup); |
| 2911 | if (!isGroup) { |
| 2912 | return NodePtr(); |
| 2913 | } |
| 2914 | int inputNb = -1; |
| 2915 | std::vector<NodePtr> groupInputs; |
| 2916 | isGroup->getInputs(&groupInputs, false); |
| 2917 | for (std::size_t i = 0; i < groupInputs.size(); ++i) { |
| 2918 | if (groupInputs[i].get() == this) { |
| 2919 | inputNb = i; |
| 2920 | break; |
| 2921 | } |
| 2922 | } |
| 2923 | if (inputNb != -1) { |
| 2924 | NodePtr input = isGroup->getNode()->getInput(inputNb); |
| 2925 | |
| 2926 | return input; |
| 2927 | } |
| 2928 | } else if (isPrecomp) { |
| 2929 | return isPrecomp->getOutputNode(); |
| 2930 | } else { |
| 2931 | int idx = getPreferredInput(); |
| 2932 | if (idx != -1) { |
| 2933 | return getInput(idx); |
| 2934 | } |
| 2935 | } |
| 2936 | |
| 2937 | return NodePtr(); |
| 2938 | } |
| 2939 | |
| 2940 | void |
| 2941 | Node::getOutputsConnectedToThisNode(std::map<NodePtr, int>* outputs) |
no test coverage detected