Skip to main content
johnrellis
Legend
December 12, 2021

P: SDK: photo:rotateLeft() and :rotateRight() can rotate all photos in the catalog

The SDK methods photo:rotateLeft() and :rotateRight() have a disastrous bug -- they can rotate all the photos in the catalog. To reproduce:

 

1. Save the script below into "rotate-bug.lua" in the Scripts folder.

 

2. Open a test catalog with at least 10 JPEGs.

 

3. Rename one of the photos to be "xyz321.jpg".

 

4. Run the script "rotate-bug.lua".

 

5. Observe that just that one photo gets rotated.

 

6. Set the filter "Filename Doesn't Contain xyz321.jpg" and observe that file is no longer visible in Grid view.

 

7. Run the script "rotate-bug.lua".

 

8. Observe that all the photos in Grid view get rotated!

 

Underlying this bug is another (old) bug: photo:rotateLeft() and photo:rotateRight() rotate all the photos in the current selection, rather than "photo" (and only "photo"). To work around this old bug, a plugin must use catalog:setSelectedPhotos() to select the photo it wants to rotate. But as this bug report demonstrates, if that photo is not visible in Grid view, all the photos get rotated!

 

 

 

local LrApplication = import "LrApplication"
local LrDialogs = import "LrDialogs"

local catalog = LrApplication.activeCatalog ()

local FileName = "xyz321.jpg"

local photo
for _, p in ipairs (catalog:getAllPhotos ()) do
    if p.path:sub (- #FileName) == FileName then
        photo = p
        break
        end
    end 

if photo == nil then 
    LrDialogs.message ("Couldn't find photo with file name " .. FileName)
    return
    end

catalog:setSelectedPhotos (photo, {})
photo:rotateLeft ()

LrDialogs.message ("Remember to Undo!!!")

 

 

 

Tested on LR 11.0.1 / Mac OS 11.6.

 

 

Ce sujet a été fermé aux réponses.

3 commentaires

johnrellis
Legend
June 18, 2022

Confirming this was fixed in LR 11.4, thanks.

 

But plugin developers note carefully: The behavior of photo:rotateLeft() and photo:rotateRight() has changed incompatibly (but for the better).  Since it was introduced between LR 6 and LR 8, they rotated the currently selected photos (!), not "photo". I'm pretty sure there was a bug report filed about that, but it probably got lost in the feedback-forum transition.  I've got a couple plugins I'll need to update.

Rikk Flohr_Photography
Community Manager
Community Manager
June 14, 2022

Greetings,

 

The SDK will be updated later this week (June 13). The update contains a fix for this issue.  Please download and the latest version of your application via the Adobe Creative Cloud Application or your respective device app store.

If you do not see the update (Mac and Win) you can refresh your Creative Cloud App with the keyboard shortcut [Ctrl/Cmd]+[Alt/Opt]+[ R ]. 

 

Note: App store availability can take several days for the update to appear and be available. 

 

Thank you for your patience.

Rikk Flohr: Adobe Photography Org
Rikk Flohr_Photography
Community Manager
Community Manager
December 13, 2021

Setting status to investigating

Rikk Flohr: Adobe Photography Org