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

Method getInputImageInternal

Engine/OfxClipInstance.cpp:808–1041  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

806}
807
808bool
809OfxClipInstance::getInputImageInternal(const OfxTime time,
810 const ViewSpec viewParam,
811 const OfxRectD *optionalBounds,
812 const std::string* ofxPlane,
813 const ImageBitDepthEnum* textureDepth,
814 OFX::Host::ImageEffect::Image** retImage,
815 OFX::Host::ImageEffect::Texture** retTexture)
816{
817 assert( !isOutput() );
818 assert( (retImage && !retTexture) || (!retImage && retTexture) );
819
820 ClipDataTLSPtr tls = _imp->tlsData->getTLSData();
821 RenderActionDataPtr renderData;
822
823 //If components param is not set (i.e: the plug-in uses regular clipGetImage call) then figure out the plane from the TLS set in OfxEffectInstance::render
824 //otherwise use the param sent by the plug-in call of clipGetImagePlane
825 if (tls) {
826 if ( !tls->renderData.empty() ) {
827 renderData = tls->renderData.back();
828 assert(renderData);
829 }
830 }
831
832
833 EffectInstancePtr effect = getEffectHolder();
834 assert(effect);
835 int inputnb = getInputNb();
836 const std::string& thisClipComponents = getComponents();
837
838 //If components param is not set (i.e: the plug-in uses regular clipGetImage call) then figure out the plane from the TLS set in OfxEffectInstance::render
839 //otherwise use the param sent by the plug-in call of clipGetImagePlane
840
841 //bool isMultiplanar = effect->isMultiPlanar();
842 ImagePlaneDesc comp;
843 if (!ofxPlane) {
844 EffectInstance::ComponentsNeededMapPtr neededComps;
845 effect->getThreadLocalNeededComponents(&neededComps);
846 bool foundCompsInTLS = false;
847 if (neededComps) {
848 EffectInstance::ComponentsNeededMap::iterator found = neededComps->find(inputnb);
849 if ( found != neededComps->end() ) {
850 if ( found->second.empty() ) {
851 ///We are in the case of a multi-plane effect who did not specify correctly the needed components for an input
852 //fallback on the basic components indicated on the clip
853 //This could be the case for example for the Mask Input
854 ImagePlaneDesc pairedComp;
855 ImagePlaneDesc::mapOFXComponentsTypeStringToPlanes( thisClipComponents, &comp, &pairedComp );
856
857 foundCompsInTLS = true;
858 //qDebug() << _imp->nodeInstance->getScriptName_mt_safe().c_str() << " didn't specify any needed components via getClipComponents for clip " << getName().c_str();
859 } else {
860 comp = found->second.front();
861 foundCompsInTLS = true;
862 }
863 }
864 }
865

Callers

nothing calls this directly

Calls 15

isOutputFunction · 0.85
isnanFunction · 0.85
emptyMethod · 0.80
getSelectedLayerMethod · 0.80
isAllMethod · 0.80
isCurrentMethod · 0.80
getInternalImageMethod · 0.80
getTimeMethod · 0.80
getViewMethod · 0.80
getComponentsMethod · 0.80
ViewIdxClass · 0.70

Tested by

no test coverage detected