Пример #1
0
void
ViewerNodePrivate::setAlphaChannelFromLayerIfRGBA()
{

    ImagePlaneDesc selectedLayer, selectedAlphaLayer, selectedDisplayLayer;
    int alphaChannelIndex;
    ViewerInstancePtr internalViewer = internalViewerProcessNode[0].lock()->isEffectViewerInstance();
    internalViewer->getChannelOptions(_publicInterface->getTimelineCurrentTime(), &selectedLayer, &selectedAlphaLayer, &alphaChannelIndex, &selectedDisplayLayer);

    // Set the alpha channel to the selected layer's alpha channel if it is not pointing to anything
    if (selectedLayer.getNumComponents() == 4 && selectedAlphaLayer.getNumComponents() == 0) {

        ChoiceOption newOption = selectedLayer.getChannelOption(3);
        KnobChoicePtr alphaChoice = alphaChannelKnob.lock();
        std::vector<ChoiceOption> options = alphaChoice->getEntries();
        for (std::size_t i = 0; i < options.size(); ++i) {
            if (options[i].id == newOption.id) {
                alphaChoice->setValue(i);
                break;
            }
        }
    }

}