| 4499 | |
| 4500 | |
| 4501 | void |
| 4502 | EffectInstance::getAvailableLayers(double time, ViewIdx view, int inputNb, std::list<ImagePlaneDesc>* availableLayers) |
| 4503 | { |
| 4504 | |
| 4505 | EffectInstancePtr effect; |
| 4506 | if (inputNb >= 0) { |
| 4507 | effect = getInput(inputNb); |
| 4508 | } else { |
| 4509 | effect = shared_from_this(); |
| 4510 | } |
| 4511 | if (!effect) { |
| 4512 | return; |
| 4513 | } |
| 4514 | |
| 4515 | |
| 4516 | std::list<ImagePlaneDesc> passThroughLayers; |
| 4517 | { |
| 4518 | |
| 4519 | |
| 4520 | EffectInstance::ComponentsNeededMap comps; |
| 4521 | double passThroughTime = 0.; |
| 4522 | int passThroughView = 0; |
| 4523 | int passThroughInputNb = -1; // prevent infinite recursion, because getComponentsNeededAndProduced_public() may call getAvailableLayers() |
| 4524 | std::bitset<4> processChannels; |
| 4525 | bool processAll = false; |
| 4526 | effect->getComponentsNeededAndProduced_public(getRenderHash(), time, view, &comps, &passThroughLayers, &processAll, &passThroughTime, &passThroughView, &processChannels, &passThroughInputNb); |
| 4527 | |
| 4528 | // Merge pass-through planes produced + pass-through available planes and make it as the pass-through planes for this node |
| 4529 | // if they are not produced by this node |
| 4530 | std::list<ImagePlaneDesc>& outputLayers = (comps)[-1]; |
| 4531 | mergeLayersList(outputLayers, &passThroughLayers); |
| 4532 | } |
| 4533 | |
| 4534 | // Ensure the color layer is always the first one available in the list |
| 4535 | bool hasColorPlane = false; |
| 4536 | for (std::list<ImagePlaneDesc>::iterator it = passThroughLayers.begin(); it != passThroughLayers.end(); ++it) { |
| 4537 | if (it->isColorPlane()) { |
| 4538 | hasColorPlane = true; |
| 4539 | availableLayers->push_front(*it); |
| 4540 | passThroughLayers.erase(it); |
| 4541 | break; |
| 4542 | } |
| 4543 | } |
| 4544 | |
| 4545 | // In output, also make available the default project layers and the user created components |
| 4546 | if (inputNb == -1) { |
| 4547 | |
| 4548 | std::list<ImagePlaneDesc> projectLayers = getApp()->getProject()->getProjectDefaultLayers(); |
| 4549 | if (hasColorPlane) { |
| 4550 | // Don't add the color plane from the default alyers if already present |
| 4551 | for (std::list<ImagePlaneDesc>::iterator it = projectLayers.begin(); it != projectLayers.end(); ++it) { |
| 4552 | if (it->isColorPlane()) { |
| 4553 | projectLayers.erase(it); |
| 4554 | break; |
| 4555 | } |
| 4556 | } |
| 4557 | } |
| 4558 | mergeLayersList(projectLayers, availableLayers); |
nothing calls this directly
no test coverage detected