| 781 | } |
| 782 | |
| 783 | bool |
| 784 | Node::computeHashInternal() |
| 785 | { |
| 786 | if (!_imp->effect) { |
| 787 | return false; |
| 788 | } |
| 789 | ///Always called in the main thread |
| 790 | assert( QThread::currentThread() == qApp->thread() ); |
| 791 | if (!_imp->inputsInitialized) { |
| 792 | qDebug() << "Node::computeHash(): inputs not initialized"; |
| 793 | } |
| 794 | |
| 795 | U64 oldHash, newHash; |
| 796 | { |
| 797 | QWriteLocker l(&_imp->knobsAgeMutex); |
| 798 | |
| 799 | oldHash = _imp->hash.value(); |
| 800 | |
| 801 | ///reset the hash value |
| 802 | _imp->hash.reset(); |
| 803 | |
| 804 | ///append the effect's own age |
| 805 | _imp->hash.append(_imp->knobsAge); |
| 806 | |
| 807 | ///append all inputs hash |
| 808 | RotoDrawableItemPtr attachedStroke = _imp->paintStroke.lock(); |
| 809 | NodePtr attachedStrokeContextNode; |
| 810 | if (attachedStroke) { |
| 811 | attachedStrokeContextNode = attachedStroke->getContext()->getNode(); |
| 812 | } |
| 813 | { |
| 814 | ViewerInstance* isViewer = dynamic_cast<ViewerInstance*>( _imp->effect.get() ); |
| 815 | |
| 816 | if (isViewer) { |
| 817 | int activeInput[2]; |
| 818 | isViewer->getActiveInputs(activeInput[0], activeInput[1]); |
| 819 | |
| 820 | for (int i = 0; i < 2; ++i) { |
| 821 | NodePtr input = getInput(activeInput[i]); |
| 822 | if (input) { |
| 823 | _imp->hash.append( input->getHashValue() ); |
| 824 | } |
| 825 | } |
| 826 | } else { |
| 827 | for (U32 i = 0; i < _imp->inputs.size(); ++i) { |
| 828 | NodePtr input = getInput(i); |
| 829 | if (input) { |
| 830 | //Since the rotopaint node is connected to the internal nodes of the tree, don't change their hash |
| 831 | if ( attachedStroke && (input == attachedStrokeContextNode) ) { |
| 832 | continue; |
| 833 | } |
| 834 | ///Add the index of the input to its hash. |
| 835 | ///Explanation: if we didn't add this, just switching inputs would produce a similar |
| 836 | ///hash. |
| 837 | _imp->hash.append(input->getHashValue() + i); |
| 838 | } |
| 839 | } |
| 840 | } |
nothing calls this directly
no test coverage detected