Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


P: SDK: The new photo:copySettings() and :pasteSettings() don't work

1 Vote
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 Started
TOPICS
macOS, SDK, Windows

Views

82

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
6 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
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Nov 09, 2021 Nov 09, 2021

Copy link to clipboard

Copied

Set status to investigating

Rikk Flohr - Customer Advocacy: Adobe Photography Products
Bug Started

Votes

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
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
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
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
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
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
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 12, 2021 Nov 12, 2021

Copy link to clipboard

Copied

LATEST

"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
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines