Adobe-CEP / Samples

Code samples for CEP extensions
MIT License
972 stars 551 forks source link

time variable in exportCurrentFrameAsPNG is overwritten #129

Closed russellaugust closed 3 years ago

russellaugust commented 3 years ago

https://github.com/Adobe-CEP/Samples/blob/63f176a4903b9be9e6aa73133ae689a3904f78c8/PProPanel/jsx/PPRO/Premiere.jsx#L151

When the above happens, it overwrites time which is used later to set exportFramePNG. It's expecting to the original time prior to be changed.

Should be something like this:

exportCurrentFrameAsPNG : function () {
    app.enableQE();
    var activeSequence = qe.project.getActiveSequence(); // note: make sure a sequence is active in PPro UI
    if (activeSequence) {
        // Create a file name, based on timecode of frame.
        var time = activeSequence.CTI.timecode; // CTI = Current Time Indicator.
        var removeThese = /:|;/ig;              // Why? Because Windows chokes on colons in file names.
        time_modified = time.replace(removeThese, '_');
        var outputPath = new File("~/Desktop");
        var outputFileName = outputPath.fsName + $._PPP_.getSep() + time_modified + '___' + activeSequence.name;
        activeSequence.exportFramePNG(time, outputFileName);
    } else {
        $._PPP_.updateEventPanel("No active sequence.");
    }
},
sir-editor commented 3 years ago

Good catch! That is why this example didn't work for users: https://community.adobe.com/t5/premiere-pro/how-to-get-an-image-of-current-timeline-frame-in-cep-panel/td-p/12187652

bbb999 commented 3 years ago

Fixed; thanks!