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

Method getRenderViewerArgsAndCheckCache

Engine/ViewerInstance.cpp:1236–1292  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1234} // ViewerInstance::getRoDAndLookupCache
1235
1236ViewerInstance::ViewerRenderRetCode
1237ViewerInstance::getRenderViewerArgsAndCheckCache(SequenceTime time,
1238 bool isSequential,
1239 ViewIdx view,
1240 int textureIndex,
1241 U64 viewerHash,
1242 const NodePtr& rotoPaintNode,
1243 const AbortableRenderInfoPtr& abortInfo,
1244 const RenderStatsPtr& stats,
1245 ViewerArgs* outArgs)
1246{
1247 // Just redraw if the viewer is paused
1248 if ( isViewerPaused(textureIndex) ) {
1249 outArgs->params = std::make_shared<UpdateViewerParams>();
1250 outArgs->params->isViewerPaused = true;
1251 outArgs->params->time = time;
1252 outArgs->params->setUniqueID(textureIndex);
1253 outArgs->params->textureIndex = textureIndex;
1254 outArgs->params->view = view;
1255
1256 return eViewerRenderRetCodeRedraw;
1257 }
1258
1259 int activeA, activeB;
1260 getActiveInputs(activeA, activeB);
1261 // Fetch the viewer indexes that we should render from the A or B input depending on the textureIndex parameter
1262 if (textureIndex == 0) {
1263 outArgs->activeInputIndex = activeA;
1264 } else {
1265 if (_imp->uiContext->getCompositingOperator() == eViewerCompositingOperatorNone) {
1266 outArgs->activeInputIndex = -1;
1267 } else {
1268 outArgs->activeInputIndex = activeB;
1269 }
1270 }
1271
1272
1273 // The active input providing the image is the first upstream non disabled node
1274 EffectInstancePtr upstreamInput = getInput(outArgs->activeInputIndex);
1275 outArgs->activeInputToRender.reset();
1276 if (upstreamInput) {
1277 outArgs->activeInputToRender = upstreamInput->getNearestNonDisabled();
1278 }
1279
1280 // Before rendering we check that all mandatory inputs in the graph are connected else we fail
1281 if ( !outArgs->activeInputToRender || !checkTreeCanRender( outArgs->activeInputToRender->getNode().get() ) ) {
1282 return eViewerRenderRetCodeFail;
1283 }
1284
1285 // Fetch the render parameters from the Viewer UI
1286 setupMinimalUpdateViewerParams(time, view, textureIndex, abortInfo, isSequential, outArgs);
1287
1288 // Try to look-up the cache but do so only if we have a RoD valid in the cache because
1289
1290 // we are on the main-thread here, it would be expensive to compute the RoD now.
1291 return getRoDAndLookupCache(true, viewerHash, rotoPaintNode, stats, outArgs);
1292}
1293

Callers

nothing calls this directly

Calls 6

checkTreeCanRenderFunction · 0.85
getNearestNonDisabledMethod · 0.80
resetMethod · 0.45
getMethod · 0.45
getNodeMethod · 0.45

Tested by

no test coverage detected