| 43 | #include "Engine/ViewIdx.h" |
| 44 | |
| 45 | NATRON_NAMESPACE_ENTER |
| 46 | |
| 47 | EffectInstance::RenderRoIRetCode |
| 48 | EffectInstance::treeRecurseFunctor(bool isRenderFunctor, |
| 49 | const NodePtr& node, |
| 50 | const FramesNeededMap& framesNeeded, |
| 51 | const RoIMap& inputRois, |
| 52 | const boost::shared_ptr<InputMatrixMap>& reroutesMap, |
| 53 | bool useTransforms, // roi functor specific |
| 54 | StorageModeEnum renderStorageMode, // if the render of this node is in OpenGL |
| 55 | unsigned int originalMipMapLevel, // roi functor specific |
| 56 | double time, |
| 57 | ViewIdx view, |
| 58 | const NodePtr& treeRoot, |
| 59 | FrameRequestMap* requests, // roi functor specific |
| 60 | EffectInstance::InputImagesMap* inputImages, // render functor specific |
| 61 | const EffectInstance::ComponentsNeededMap* neededComps, // render functor specific |
| 62 | bool useScaleOneInputs, // render functor specific |
| 63 | bool byPassCache) // render functor specific |
| 64 | { |
| 65 | ///For all frames/views needed, call recursively on inputs with the appropriate RoI |
| 66 | |
| 67 | EffectInstPtr effect = node->getEffectInstance(); |
| 68 | bool isRoto = node->isRotoPaintingNode(); |
| 69 | |
| 70 | //Same as FramesNeededMap but we also get a pointer to EffectInstance* as key |
| 71 | typedef std::map<EffectInstPtr, std::pair</*inputNb*/ int, FrameRangesMap> > PreRenderFrames; |
| 72 | |
| 73 | PreRenderFrames framesToRender; |
| 74 | //Add frames needed to the frames to render |
| 75 | for (FramesNeededMap::const_iterator it = framesNeeded.begin(); it != framesNeeded.end(); ++it) { |
| 76 | int inputNb = it->first; |
| 77 | bool inputIsMask = effect->isInputMask(inputNb); |
| 78 | ImagePlaneDesc maskComps; |
| 79 | int channelForAlphaInput; |
| 80 | // if (inputIsMask) { |
| 81 | if ( !effect->isMaskEnabled(inputNb) ) { |
| 82 | continue; |
| 83 | } |
| 84 | |
| 85 | std::list<ImagePlaneDesc> availableLayers; |
| 86 | effect->getAvailableLayers(time, view, inputNb, &availableLayers); |
| 87 | |
| 88 | channelForAlphaInput = effect->getMaskChannel(inputNb, availableLayers, &maskComps); |
| 89 | // } else { |
| 90 | //} |
| 91 | |
| 92 | //No mask |
| 93 | if ( inputIsMask && ( (channelForAlphaInput == -1) || (maskComps.getNumComponents() == 0) ) ) { |
| 94 | continue; |
| 95 | } |
| 96 | |
| 97 | //Redirect for transforms if needed |
| 98 | EffectInstPtr inputEffect; |
| 99 | if (reroutesMap) { |
| 100 | InputMatrixMap::const_iterator foundReroute = reroutesMap->find(inputNb); |
| 101 | if ( foundReroute != reroutesMap->end() ) { |
| 102 | inputEffect = foundReroute->second.newInputEffect->getInput(foundReroute->second.newInputNbToFetchFrom); |
nothing calls this directly
no test coverage detected