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

Method checkMetadata

Engine/EffectInstance.cpp:5696–5842  ·  view source on GitHub ↗

* @brief The purpose of this function is to check that the meta data returned by the plug-ins are valid and to * check for warnings **/

Source from the content-addressed store, hash-verified

5694 * check for warnings
5695 **/
5696void
5697EffectInstance::Implementation::checkMetadata(NodeMetadata &md)
5698{
5699 NodePtr node = _publicInterface->getNode();
5700
5701 if (!node) {
5702 return;
5703 }
5704 //Make sure it is valid
5705 int nInputs = node->getMaxInputCount();
5706
5707 for (int i = -1; i < nInputs; ++i) {
5708 md.setBitDepth( i, node->getClosestSupportedBitDepth( md.getBitDepth(i) ) );
5709 int nComps = md.getNComps(i);
5710 bool isAlpha = false;
5711 bool isRGB = false;
5712 if (i == -1) {
5713 if ( nComps == 3) {
5714 isRGB = true;
5715 } else if (nComps == 1) {
5716 isAlpha = true;
5717 }
5718 }
5719
5720 if ( md.getComponentsType(i) == kNatronColorPlaneID ) {
5721 md.setNComps(i, node->findClosestSupportedComponents(i, ImagePlaneDesc::mapNCompsToColorPlane(nComps)).getNumComponents());
5722 }
5723
5724 if (i == -1) {
5725 //Force opaque for RGB and premult for alpha
5726 if (isRGB) {
5727 md.setOutputPremult(eImagePremultiplicationOpaque);
5728 } else if (isAlpha) {
5729 md.setOutputPremult(eImagePremultiplicationPremultiplied);
5730 }
5731 }
5732 }
5733
5734
5735 ///Set a warning on the node if the bitdepth conversion from one of the input clip to the output clip is lossy
5736 QString bitDepthWarning = tr("This nodes converts higher bit depths images from its inputs to work. As "
5737 "a result of this process, the quality of the images is degraded. The following conversions are done:");
5738 bitDepthWarning.append( QChar::fromLatin1('\n') );
5739 bool setBitDepthWarning = false;
5740 const bool supportsMultipleClipDepths = _publicInterface->supportsMultipleClipDepths();
5741 const bool supportsMultipleClipPARs = _publicInterface->supportsMultipleClipPARs();
5742 const bool supportsMultipleClipFPSs = _publicInterface->supportsMultipleClipFPSs();
5743 std::vector<EffectInstPtr> inputs(nInputs);
5744 for (int i = 0; i < nInputs; ++i) {
5745 inputs[i] = _publicInterface->getInput(i);
5746 }
5747
5748
5749 ImageBitDepthEnum outputDepth = md.getBitDepth(-1);
5750 double outputPAR = md.getPixelAspectRatio(-1);
5751 bool outputFrameRateSet = false;
5752 double outputFrameRate = md.getOutputFrameRate();
5753 bool mustWarnFPS = false;

Callers 1

Calls 15

absFunction · 0.85
QStringClass · 0.85
getNCompsMethod · 0.80
getComponentsTypeMethod · 0.80
setNCompsMethod · 0.80
appendMethod · 0.80
getOutputFrameRateMethod · 0.80
getLabel_mt_safeMethod · 0.80
setStreamWarningsMethod · 0.80
getNodeMethod · 0.45

Tested by

no test coverage detected