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

Method activate

Engine/Node.cpp:3028–3133  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3026} // deactivate
3027
3028void
3029Node::activate(const std::list<NodePtr> & outputsToRestore,
3030 bool restoreAll,
3031 bool triggerRender)
3032{
3033 ///Only called by the main-thread
3034 assert( QThread::currentThread() == qApp->thread() );
3035 if ( !_imp->effect || isActivated() ) {
3036 return;
3037 }
3038
3039
3040 ///No need to lock, guiInputs is only written to by the main-thread
3041 NodePtr thisShared = shared_from_this();
3042
3043 ///for all inputs, reconnect their output to this node
3044 for (std::size_t i = 0; i < _imp->inputs.size(); ++i) {
3045 NodePtr input = _imp->inputs[i].lock();
3046 if (input) {
3047 input->connectOutput(false, thisShared);
3048 }
3049 }
3050
3051
3052 ///Restore all outputs that was connected to this node
3053 for (DeactivatedState::iterator it = _imp->deactivatedState.begin();
3054 it != _imp->deactivatedState.end(); ++it) {
3055 NodePtr output = it->first.lock();
3056 if (!output) {
3057 continue;
3058 }
3059
3060 bool restore = false;
3061 if (restoreAll) {
3062 restore = true;
3063 } else {
3064 for (NodesList::const_iterator found = outputsToRestore.begin(); found != outputsToRestore.end(); ++found) {
3065 if (*found == output) {
3066 restore = true;
3067 break;
3068 }
3069 }
3070 }
3071
3072 if (restore) {
3073 ///before connecting the outputs to this node, disconnect any link that has been made
3074 ///between the outputs by the user. This should normally never happen as the undo/redo
3075 ///stack follow always the same order.
3076 NodePtr outputHasInput = output->getInput(it->second);
3077 if (outputHasInput) {
3078 bool ok = getApp()->getProject()->disconnectNodes(outputHasInput, output);
3079 assert(ok);
3080 Q_UNUSED(ok);
3081 }
3082
3083 ///and connect the output to this node
3084 output->connectInput(thisShared, it->second);
3085 }

Callers 1

activateNodesMethod · 0.45

Calls 15

getAppFunction · 0.85
connectOutputMethod · 0.80
getProjectMethod · 0.80
getEmbeddedReaderMethod · 0.80
setIsActivatingGroupMethod · 0.80
getNodesMethod · 0.80
runOnNodeCreatedCBMethod · 0.80
sizeMethod · 0.45
lockMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected