• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
1

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

LEGEND ,
Dec 11, 2021 Dec 11, 2021

Copy link to clipboard

Copied

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.

 

 

Bug Fixed
TOPICS
macOS , SDK , Windows

Views

1.2K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 2 Correct answers

Adobe Employee , Jun 14, 2022 Jun 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

...
Status Fixed

Votes

Translate

Translate
Adobe Employee , Dec 13, 2021 Dec 13, 2021

Setting status to investigating

Status Started

Votes

Translate

Translate
3 Comments
Adobe Employee ,
Dec 13, 2021 Dec 13, 2021

Copy link to clipboard

Copied

Setting status to investigating

Rikk Flohr - Customer Advocacy: Adobe Photography Products
Status Started

Votes

Translate

Translate

Report

Report
Adobe Employee ,
Jun 14, 2022 Jun 14, 2022

Copy link to clipboard

Copied

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 - Customer Advocacy: Adobe Photography Products
Status Fixed

Votes

Translate

Translate

Report

Report
LEGEND ,
Jun 18, 2022 Jun 18, 2022

Copy link to clipboard

Copied

LATEST

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.

Votes

Translate

Translate

Report

Report