Skip to main content
Inspiring
January 18, 2023
Question

SDK: LrExportSession - handling of LrProgressScope is broken.

  • January 18, 2023
  • 2 replies
  • 262 views

Hi.

It's me again, maybe I'm just lucky...

Here is my test code:

 

 

    local progressTitle = "Exporting..."
    local progressScope = LrProgressScope{ title = progressTitle }
    local exportSession = LrExportSession{ photosToExport = photos, exportSettings = settings }
    local renderOptions =
    {
        progressScope = progressScope,
        renderProgressPortion = progressPortion or 1,
        stopIfCanceled = true
    }
    progressScope:setPortionComplete(0, 1)
    LrDialogs.message("ProgressStart="..progressScope:getPortionComplete())
    for _, rendition in exportSession:renditions(renderOptions)
        local success, pathOrMessage = rendition:waitForRender()
        if not success then rendition:uploadFailed(pathOrMessage) end
        LrDialogs.message("Progress="..progressScope:getPortionComplete())
    end
    LrDialogs.message("ProgressEnd="..progressScope:getPortionComplete())
    -- set some flag to indicate export cancelation if it's needed
    if progressScope:isCanceled() then exportCancel=true end

 


There are two issues with this:

1. progressScope is only updated by the next iterator call, so if there is only one photo to render - it's never updated and stays at 0. If exporting 4 photos - it stays at 0.75 after export, etc

2. progressScope is always reset by exportSession:renditions() - it always starts from 0.

What's the point in having the ability to specify partial progress with renderProgressPortion if you can't continue later?
Both doesn't look by design to me.
Can someone confirm?


@johnrellis- maybe you can check?
Doesn't seem to be a lot of developers in here...

This topic has been closed for replies.

2 replies

johnrellis
Legend
January 18, 2023

My only use of exporting has been exporting temp files, not for writing an Export plugin. Adobe developers have never engaged on these forums since the early days of LR 4, and Adobe support knows nothing about the SDK, so unless someone who knows more chimes in, I think you'll have to find a workaround.  Some thoughts:

 

"1. progressScope is only updated by the next iterator call, so if there is only one photo to render - it's never updated and stays at 0. If exporting 4 photos - it stays at 0.75 after export, etc"

 

Try calling progressScope:setPortionComplete(1) and then progressScope:done() at the end.  

 

"2. progressScope is always reset by exportSession:renditions() - it always starts from 0.

What's the point in having the ability to specify partial progress with renderProgressPortion if you can't continue later?"

 

Perhaps use a parent progressScope for the outer operation and a fresh child progressScope for the inner operation (the code fragment here).  (See the LrProgressScope constructor.) 

Sean McCormack
Community Expert
Community Expert
January 18, 2023

There's just John really. I do web plugins and metadata based ones, so far less complicated. Rob Cole who was here often passed on.

 

@john beardsworth is about sometimes.  

Sean McCormack. Author of 'Essential Development 3'. Magazine Writer. Former Official Fuji X-Photographer.