| 1518 | } |
| 1519 | |
| 1520 | NodePtr |
| 1521 | Node::getPreferredInputNode() const |
| 1522 | { |
| 1523 | GroupInput* isInput = dynamic_cast<GroupInput*>( _imp->effect.get() ); |
| 1524 | PrecompNode* isPrecomp = dynamic_cast<PrecompNode*>( _imp->effect.get() ); |
| 1525 | |
| 1526 | if (isInput) { |
| 1527 | NodeGroup* isGroup = dynamic_cast<NodeGroup*>( getGroup().get() ); |
| 1528 | assert(isGroup); |
| 1529 | if (!isGroup) { |
| 1530 | return NodePtr(); |
| 1531 | } |
| 1532 | int inputNb = -1; |
| 1533 | std::vector<NodePtr> groupInputs; |
| 1534 | isGroup->getInputs(&groupInputs, false); |
| 1535 | for (std::size_t i = 0; i < groupInputs.size(); ++i) { |
| 1536 | if (groupInputs[i].get() == this) { |
| 1537 | inputNb = i; |
| 1538 | break; |
| 1539 | } |
| 1540 | } |
| 1541 | if (inputNb != -1) { |
| 1542 | NodePtr input = isGroup->getNode()->getInput(inputNb); |
| 1543 | |
| 1544 | return input; |
| 1545 | } |
| 1546 | } else if (isPrecomp) { |
| 1547 | return isPrecomp->getOutputNode(); |
| 1548 | } else { |
| 1549 | int idx = getPreferredInput(); |
| 1550 | if (idx != -1) { |
| 1551 | return getInput(idx); |
| 1552 | } |
| 1553 | } |
| 1554 | |
| 1555 | return NodePtr(); |
| 1556 | } |
| 1557 | |
| 1558 | |
| 1559 | void |
no test coverage detected