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

Method checkForPremultWarningAndCheckboxes

Engine/Node.cpp:11356–11421  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11354}
11355
11356void
11357Node::checkForPremultWarningAndCheckboxes()
11358{
11359 if ( isOutputNode() ) {
11360 return;
11361 }
11362 boost::shared_ptr<KnobBool> chans[4];
11363 boost::shared_ptr<KnobString> premultWarn = _imp->premultWarning.lock();
11364 if (!premultWarn) {
11365 return;
11366 }
11367 NodePtr prefInput = getPreferredInputNode();
11368
11369 //Do not display a warning for Roto paint
11370 if ( !prefInput || _imp->effect->isRotoPaintNode() ) {
11371 //No input, do not warn
11372 premultWarn->setSecret(true);
11373
11374 return;
11375 }
11376 for (int i = 0; i < 4; ++i) {
11377 chans[i] = _imp->enabledChan[i].lock();
11378
11379 //No checkboxes
11380 if (!chans[i]) {
11381 premultWarn->setSecret(true);
11382
11383 return;
11384 }
11385
11386 //not RGBA
11387 if ( chans[i]->getIsSecret() ) {
11388 return;
11389 }
11390 }
11391
11392 ImagePremultiplicationEnum premult = _imp->effect->getPremult();
11393
11394 //not premult
11395 if (premult != eImagePremultiplicationPremultiplied) {
11396 premultWarn->setSecret(true);
11397
11398 return;
11399 }
11400
11401 bool checked[4];
11402 checked[3] = chans[3]->getValue();
11403
11404 //alpha unchecked
11405 if (!checked[3]) {
11406 premultWarn->setSecret(true);
11407
11408 return;
11409 }
11410 for (int i = 0; i < 3; ++i) {
11411 checked[i] = chans[i]->getValue();
11412 if (!checked[i]) {
11413 premultWarn->setSecret(false);

Callers 1

Calls 5

getIsSecretMethod · 0.80
lockMethod · 0.45
setSecretMethod · 0.45
getPremultMethod · 0.45
getValueMethod · 0.45

Tested by

no test coverage detected