• 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: The new photo:copySettings() and :pasteSettings() don't work

LEGEND ,
Nov 08, 2021 Nov 08, 2021

Copy link to clipboard

Copied

The LR 11 SDK API Reference for LrPhoto documents two new methods, photo:copySettings() and photo:pasteSettings().  But as documented, they don't do anything. 

 

Update: The documentation is highly incomplete and needs to be clarified. See below.

 

To reproduce:

 

1. Copy this script into the file "copypaste.lua" and save it in the Scripts subfolder of the "Lightroom" preferences folder:

 

 

 

local catalog = import "LrApplication".activeCatalog ()
local photos = catalog:getTargetPhotos ()
if #photos ~= 2 then 
    import "LrDialogs".message ("Select exactly 2 photos")
    return
    end
photos [1]:copySettings ()
photos [2]:pasteSettings ()
catalog:withWriteAccessDo ("copy/paste", function ()
    photos [1]:copySettings ()
    photos [2]:pasteSettings ()
    end)

 

 

 

 

2. Restart LR.

 

3. Choose a photo and set its Exposure to +5.

 

4. Select that photo and another, with the first photo most selected.

 

5. Do the menu command Scripts > copypaste. 

 

Observe that the progress bar briefly shows "Paste Settings", but the Exposure = +5 setting isn't copied to the second photo.

Bug Fixed
TOPICS
macOS , SDK , Windows

Views

301

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 1 Correct answer

Adobe Employee , Nov 09, 2021 Nov 09, 2021

Set status to investigating

Status Started

Votes

Translate

Translate
9 Comments
Adobe Employee ,
Nov 09, 2021 Nov 09, 2021

Copy link to clipboard

Copied

Thanks John.
We will investigate.

 

Thanks,
Sunil

Votes

Translate

Translate

Report

Report
Adobe Employee ,
Nov 09, 2021 Nov 09, 2021

Copy link to clipboard

Copied

Set status to investigating

Rikk Flohr - Customer Advocacy: Adobe Photography Products
Status Started

Votes

Translate

Translate

Report

Report
Adobe Employee ,
Nov 11, 2021 Nov 11, 2021

Copy link to clipboard

Copied

@johnrellis copySettings operation is asynchronous in nature, due to which the immediate pasteSettings call does not work as intended. If there is a delay between copy and paste, the APIs should work as expected.

Going forward, we will explicitly mark the copySettings API as async so that it does not lead to any confusion.

Votes

Translate

Translate

Report

Report
LEGEND ,
Nov 11, 2021 Nov 11, 2021

Copy link to clipboard

Copied

"If there is a delay between copy and paste, the APIs should work as expected."

 

Hmm, I inserted a 5-second sleep between copySettings() and pasteSettings(), and the settings still don't get copied:

local LrDialogs = import "LrDialogs"
local LrTasks = import "LrTasks"

local catalog = import "LrApplication".activeCatalog ()

LrTasks.startAsyncTask (function ()
    local photos = catalog:getTargetPhotos ()
    if #photos ~= 2 then 
        LrDialogs.message ("Select exactly 2 photos")
        return
        end
    photos [1]:copySettings ()
    LrTasks.sleep (5)
    photos [2]:pasteSettings ()
    catalog:withWriteAccessDo ("copy/paste", function ()
        photos [1]:copySettings ()
        LrTasks.sleep (5)
        photos [2]:pasteSettings ()
        end)
    LrDialogs.message ("Finished")
    end)

 

I also tried invoking copySettings() and pasteSettings() from separate scripts, same negative result.

 

Interestingly, when I invoke the script in Develop rather than Library, LR switches to the Library module and then back to Develop.  So those methods are doing something. 

Votes

Translate

Translate

Report

Report
Adobe Employee ,
Nov 11, 2021 Nov 11, 2021

Copy link to clipboard

Copied

copySettings API behaves as doing copy operation from UI without the dialog(with Alt/Opt key pressed), so only options/settings selected previosuly will get copied. Can you check if the setting that you intend to copy is already selected? 

Votes

Translate

Translate

Report

Report
LEGEND ,
Nov 12, 2021 Nov 12, 2021

Copy link to clipboard

Copied

"Can you check if the setting that you intend to copy is already selected?"

 

When I selected Exposure in Photo > Develop Settings > Copy Settings, then the script above does indeed Copy Settings.  

 

So this bug report is thus about documenting the behavior of photo:copySettings() and photo:pasteSettings() -- the current API reference doesn't mention that they use whatever was selected in the UI or that there should be a delay between the two calls.

 

Thanks for the clarifications.

Votes

Translate

Translate

Report

Report
Adobe Employee ,
Dec 13, 2021 Dec 13, 2021

Copy link to clipboard

Copied

Updates to the Adobe Photography Products were released today and contain a fix for this issue. Please install the update via your Creative Cloud Desktop App or your respective App Store. 

 

Note: 

You may need to refresh the Creative Cloud App for desktop software to show an update available.  ([Ctrl/Cmd]+[Alt/Opt]+ [ R ])

For Mobile downloads, it may take several days for the update to appear in your respective App Stores.

 

Thank you for your patience. 

Rikk Flohr - Customer Advocacy: Adobe Photography Products
Status Fixed

Votes

Translate

Translate

Report

Report
LEGEND ,
Dec 17, 2021 Dec 17, 2021

Copy link to clipboard

Copied

[This post contains formatting and embedded images that don't appear in email. View the post in your Web browser.]

 

@Rikk Flohr: Photography, if the documentation was fixed, it wasn't released:

 

https://developer.adobe.com/console/servicesandapis 

johnrellis_0-1639529900577.png

johnrellis_1-1639529979426.png

 

johnrellis_3-1639530102880.png

 

 

 

 

Votes

Translate

Translate

Report

Report
LEGEND ,
Feb 11, 2022 Feb 11, 2022

Copy link to clipboard

Copied

LATEST

@Rikk Flohr: Photography, this has been fixed in the LR SDK 11.2.

Votes

Translate

Translate

Report

Report