MCPcopy Create free account
hub / github.com/NatronGitHub/Natron / computeHashInternal

Method computeHashInternal

Engine/Node.cpp:783–879  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

781}
782
783bool
784Node::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 }

Callers

nothing calls this directly

Calls 15

Hash64_appendQStringFunction · 0.85
getAppFunction · 0.85
appendMethod · 0.80
getHashValueMethod · 0.80
getProjectMethod · 0.80
onNodeHashChangedMethod · 0.80
isProjectClosingMethod · 0.80
valueMethod · 0.45
resetMethod · 0.45
lockMethod · 0.45
getNodeMethod · 0.45

Tested by

no test coverage detected