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

Method initializeInputs

Engine/NodeInputs.cpp:417–480  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

415}
416
417void
418Node::initializeInputs()
419{
420 ////Only called by the main-thread
421 assert( QThread::currentThread() == qApp->thread() );
422 const int inputCount = getNInputs();
423 InputsV oldInputs;
424 {
425 QMutexLocker k(&_imp->inputsLabelsMutex);
426 _imp->inputLabels.resize(inputCount);
427 _imp->inputHints.resize(inputCount);
428 for (int i = 0; i < inputCount; ++i) {
429 _imp->inputLabels[i] = _imp->effect->getInputLabel(i);
430 _imp->inputHints[i] = _imp->effect->getInputHint(i);
431 }
432 }
433 {
434 QMutexLocker l(&_imp->lastRenderStartedMutex);
435 _imp->inputIsRenderingCounter.resize(inputCount);
436 }
437 {
438 QMutexLocker l(&_imp->inputsMutex);
439 oldInputs = _imp->inputs;
440
441 std::vector<bool> oldInputsVisibility = _imp->inputsVisibility;
442 _imp->inputIsRenderingCounter.resize(inputCount);
443 _imp->inputs.resize(inputCount);
444 _imp->guiInputs.resize(inputCount);
445 _imp->inputsVisibility.resize(inputCount);
446 ///if we added inputs, just set to NULL the new inputs, and add their label to the labels map
447 for (int i = 0; i < inputCount; ++i) {
448 if ( i < (int)oldInputs.size() ) {
449 _imp->inputs[i] = oldInputs[i];
450 _imp->guiInputs[i] = oldInputs[i];
451 } else {
452 _imp->inputs[i].reset();
453 _imp->guiInputs[i].reset();
454 }
455 if (i < (int) oldInputsVisibility.size()) {
456 _imp->inputsVisibility[i] = oldInputsVisibility[i];
457 } else {
458 _imp->inputsVisibility[i] = true;
459 }
460 }
461
462
463 ///Set the components the plug-in accepts
464 _imp->inputsComponents.resize(inputCount);
465 for (int i = 0; i < inputCount; ++i) {
466 _imp->inputsComponents[i].clear();
467 if ( _imp->effect->isInputMask(i) ) {
468 //Force alpha for masks
469 _imp->inputsComponents[i].push_back( ImagePlaneDesc::getAlphaComponents() );
470 } else {
471 _imp->effect->addAcceptedComponents(i, &_imp->inputsComponents[i]);
472 }
473 }
474 _imp->outputComponents.clear();

Callers 11

createReadNodeMethod · 0.45
notifyNodeDeactivatedMethod · 0.45
notifyNodeActivatedMethod · 0.45
notifyNodeNameChangedMethod · 0.45
createWriteNodeMethod · 0.45
onProjectViewsChangedMethod · 0.45

Calls 9

resizeMethod · 0.45
getInputLabelMethod · 0.45
getInputHintMethod · 0.45
sizeMethod · 0.45
resetMethod · 0.45
clearMethod · 0.45
isInputMaskMethod · 0.45
push_backMethod · 0.45
addAcceptedComponentsMethod · 0.45

Tested by

no test coverage detected