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

Method getAvailableLayers

Engine/EffectInstance.cpp:4467–4535  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4465
4466
4467void
4468EffectInstance::getAvailableLayers(double time, ViewIdx view, int inputNb, std::list<ImagePlaneDesc>* availableLayers)
4469{
4470
4471 EffectInstPtr effect;
4472 if (inputNb >= 0) {
4473 effect = getInput(inputNb);
4474 } else {
4475 effect = shared_from_this();
4476 }
4477 if (!effect) {
4478 return;
4479 }
4480
4481
4482 std::list<ImagePlaneDesc> passThroughLayers;
4483 {
4484
4485
4486 EffectInstance::ComponentsNeededMap comps;
4487 double passThroughTime;
4488 int passThroughView;
4489 int passThroughInputNb;
4490 std::bitset<4> processChannels;
4491 bool processAll;
4492 effect->getComponentsNeededAndProduced_public(getRenderHash(), time, view, &comps, &passThroughLayers, &processAll, &passThroughTime, &passThroughView, &processChannels, &passThroughInputNb);
4493
4494 // Merge pass-through planes produced + pass-through available planes and make it as the pass-through planes for this node
4495 // if they are not produced by this node
4496 std::list<ImagePlaneDesc>& outputLayers = (comps)[-1];
4497 mergeLayersList(outputLayers, &passThroughLayers);
4498 }
4499
4500 // Ensure the color layer is always the first one available in the list
4501 bool hasColorPlane = false;
4502 for (std::list<ImagePlaneDesc>::iterator it = passThroughLayers.begin(); it != passThroughLayers.end(); ++it) {
4503 if (it->isColorPlane()) {
4504 hasColorPlane = true;
4505 availableLayers->push_front(*it);
4506 passThroughLayers.erase(it);
4507 break;
4508 }
4509 }
4510
4511 // In output, also make available the default project layers and the user created components
4512 if (inputNb == -1) {
4513
4514 std::list<ImagePlaneDesc> projectLayers = getApp()->getProject()->getProjectDefaultLayers();
4515 if (hasColorPlane) {
4516 // Don't add the color plane from the default alyers if already present
4517 for (std::list<ImagePlaneDesc>::iterator it = projectLayers.begin(); it != projectLayers.end(); ++it) {
4518 if (it->isColorPlane()) {
4519 projectLayers.erase(it);
4520 break;
4521 }
4522 }
4523 }
4524 mergeLayersList(projectLayers, availableLayers);

Callers

nothing calls this directly

Calls 12

mergeLayersListFunction · 0.85
getAppFunction · 0.85
push_frontMethod · 0.80
getProjectMethod · 0.80
getNodeFunction · 0.70
beginMethod · 0.45
endMethod · 0.45
isColorPlaneMethod · 0.45
eraseMethod · 0.45

Tested by

no test coverage detected