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

Method getDefaultMetadata

Engine/EffectInstance.cpp:5358–5553  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5356}
5357
5358StatusEnum
5359EffectInstance::getDefaultMetadata(NodeMetadata &metadata)
5360{
5361 NodePtr node = getNode();
5362
5363 if (!node) {
5364 return eStatusFailed;
5365 }
5366
5367 const bool multiBitDepth = supportsMultipleClipDepths();
5368 int nInputs = getNInputs();
5369 metadata.clearAndResize(nInputs);
5370
5371 // OK find the deepest chromatic component on our input clips and the one with the
5372 // most components
5373 bool hasSetCompsAndDepth = false;
5374 ImageBitDepthEnum deepestBitDepth = eImageBitDepthNone;
5375 int mostComponents = 0;
5376
5377 //Default to the project frame rate
5378 double frameRate = getApp()->getProjectFrameRate();
5379 std::vector<EffectInstancePtr> inputs(nInputs);
5380
5381 // Find the components of the first non optional connected input
5382 // They will be used for disconnected input
5383 int firstNonOptionalConnectedInputComps = 0;
5384 for (std::size_t i = 0; i < inputs.size(); ++i) {
5385 inputs[i] = getInput(i);
5386 if ( !firstNonOptionalConnectedInputComps && inputs[i] && !isInputOptional(i) ) {
5387 firstNonOptionalConnectedInputComps = inputs[i]->getMetadataNComps(-1);
5388 }
5389 }
5390
5391 double inputPar = 1.;
5392 bool inputParSet = false;
5393 ImagePremultiplicationEnum premult = eImagePremultiplicationOpaque;
5394 bool premultSet = false;
5395 for (int i = 0; i < nInputs; ++i) {
5396 const EffectInstancePtr& input = inputs[i];
5397 if (input) {
5398 frameRate = std::max( frameRate, input->getFrameRate() );
5399 }
5400
5401
5402 if (input) {
5403 if (!inputParSet) {
5404 inputPar = input->getAspectRatio(-1);
5405 inputParSet = true;
5406 }
5407 }
5408
5409 int rawComp = getUnmappedComponentsForInput(this, i, inputs, firstNonOptionalConnectedInputComps);
5410 ImageBitDepthEnum rawDepth = input ? input->getBitDepth(-1) : eImageBitDepthFloat;
5411 ImagePremultiplicationEnum rawPreMult = input ? input->getPremult() : eImagePremultiplicationPremultiplied;
5412
5413 // Note: first chromatic input gives the default output premult too, even if not connected
5414 // (else the output of generators may be opaque even if the host default is premultiplied)
5415 if ( ( rawComp == 4 ) && (input || !premultSet) ) {

Callers

nothing calls this directly

Calls 15

getAppFunction · 0.85
isInputOptionalFunction · 0.85
maxFunction · 0.85
getSizeOfForBitDepthFunction · 0.85
supportsMultipleClipPARsFunction · 0.85
clearAndResizeMethod · 0.80
getMetadataNCompsMethod · 0.80
setOutputFrameRateMethod · 0.80
setOutputFieldingMethod · 0.80
setIsFrameVaryingMethod · 0.80

Tested by

no test coverage detected