| 617 | } |
| 618 | |
| 619 | bool |
| 620 | NodeCollection::disconnectNodes(const NodePtr& input, |
| 621 | const NodePtr& output, |
| 622 | bool autoReconnect) |
| 623 | { |
| 624 | NodePtr inputToReconnectTo; |
| 625 | int indexOfInput = output->inputIndex( input ); |
| 626 | |
| 627 | if (indexOfInput == -1) { |
| 628 | return false; |
| 629 | } |
| 630 | |
| 631 | int inputsCount = input->getNInputs(); |
| 632 | if (inputsCount == 1) { |
| 633 | inputToReconnectTo = input->getInput(0); |
| 634 | } |
| 635 | |
| 636 | |
| 637 | if (output->disconnectInput( input.get() ) < 0) { |
| 638 | return false; |
| 639 | } |
| 640 | |
| 641 | if (autoReconnect && inputToReconnectTo) { |
| 642 | connectNodes(indexOfInput, inputToReconnectTo, output); |
| 643 | } |
| 644 | |
| 645 | return true; |
| 646 | } |
| 647 | |
| 648 | bool |
| 649 | NodeCollection::autoConnectNodes(const NodePtr& selected, |
no test coverage detected