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

Method activate

Engine/Node.cpp:6499–6604  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6497} // deactivate
6498
6499void
6500Node::activate(const std::list< NodePtr > & outputsToRestore,
6501 bool restoreAll,
6502 bool triggerRender)
6503{
6504 ///Only called by the main-thread
6505 assert( QThread::currentThread() == qApp->thread() );
6506 if ( !_imp->effect || isActivated() ) {
6507 return;
6508 }
6509
6510
6511 ///No need to lock, guiInputs is only written to by the main-thread
6512 NodePtr thisShared = shared_from_this();
6513
6514 ///for all inputs, reconnect their output to this node
6515 for (std::size_t i = 0; i < _imp->inputs.size(); ++i) {
6516 NodePtr input = _imp->inputs[i].lock();
6517 if (input) {
6518 input->connectOutput(false, thisShared);
6519 }
6520 }
6521
6522
6523 ///Restore all outputs that was connected to this node
6524 for (std::map<NodeWPtr, int >::iterator it = _imp->deactivatedState.begin();
6525 it != _imp->deactivatedState.end(); ++it) {
6526 NodePtr output = it->first.lock();
6527 if (!output) {
6528 continue;
6529 }
6530
6531 bool restore = false;
6532 if (restoreAll) {
6533 restore = true;
6534 } else {
6535 for (NodesList::const_iterator found = outputsToRestore.begin(); found != outputsToRestore.end(); ++found) {
6536 if (*found == output) {
6537 restore = true;
6538 break;
6539 }
6540 }
6541 }
6542
6543 if (restore) {
6544 ///before connecting the outputs to this node, disconnect any link that has been made
6545 ///between the outputs by the user. This should normally never happen as the undo/redo
6546 ///stack follow always the same order.
6547 NodePtr outputHasInput = output->getInput(it->second);
6548 if (outputHasInput) {
6549 bool ok = getApp()->getProject()->disconnectNodes(outputHasInput, output);
6550 assert(ok);
6551 Q_UNUSED(ok);
6552 }
6553
6554 ///and connect the output to this node
6555 output->connectInput(thisShared, it->second);
6556 }

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