Skip to main content
Adobe Photoshop Family

4.5K Messages

 • 

76.3K Points

Mon, Jun 17, 2013 8:13 AM

Solved

Lightroom SDK: catalog:createVirtualCopies only works properly in grid view.

When more than one photo is selected, and more than one copy name is passed, I mean, in Windows anyway, maybe Mac too.

First off, I realize the SDK v5 has not been released, so if this bug report is premature, just ignore it.

That said, I wanted to report ASAP in the hopes that it will be fixed before SDK 5 is released, if applicable.

Problem is, plugin has no official way of assuring Lr is in grid mode. So createVirtualCopies needs to be fixed, or we need a way to force grid view, or both.

Again, my apologies in advance: I acknowledge this is an undocumented function.

Rob

Responses

Official Solution

Adobe Administrator

 • 

15.5K Messages

 • 

291.9K Points

6 years ago

This should be fixed in Lightroom CC/Lightroom 6.

Sr. Product Manager, Adobe Digital Imaging

44 Messages

 • 

620 Points

7 years ago

Hi Rob- can you elaborate what you mean by not working properly?

I am able to create virtual copies via the SDK whether I am in grid or loupe view. The virtual copies are all created properly.

Note, we do not support more than one name for a virtual copy. All virtual copies will have the same copy name when multiple photos are selected.

4.5K Messages

 • 

76.3K Points

Hi Paul,

|> "we do not support more than one name for a virtual copy"

I was only able to get multiple copies by passing multiple names, for example:

catalog:createVirtualCopies( name1, name2, name3 )

which were indeed used as I'd hoped (but in grid view only). But perhaps I/we have been calling it wrong.

Would you mind enumerating what the parameter(s) should be?

Thanks,
Rob

4.5K Messages

 • 

76.3K Points

7 years ago

Hi Paul,

Just re-checked behavior (win7/64):

catalog:createVirtualCopies( name )

In grid view, with two photos selected (for example) creates 2 virtual copies (both having the specified copy name). So far so good...

However, in loupe view or develop module, the same statement only creates one virtual copy (although it does return an array of two lr-photos, it's just that only one of them is a newly created virtual copy - the other is the original master/base copy).

Is that not how it works for you? are we comparing oranges to oranges, or apples?

Rob

44 Messages

 • 

620 Points

7 years ago

Rob that is not the behavior I am seeing. With multiple photos selected, I am seeing multiple virtual copies created (one for each selection) even when in loupe view. Do you have a a plug-in with the bare minimum to reproduce this issue? Some sample code may help (I realize it is a single call in question, but obviously we are doing something different so the context may be relevant.)

Thanks,

-paul

4.5K Messages

 • 

76.3K Points

Have you been able to try the test plugin? (link is in the post below)

4.5K Messages

 • 

76.3K Points

7 years ago

Test plugin here:

http://www.robcole.com/LrForumSupport...

Thanks,
Rob

4.5K Messages

 • 

76.3K Points

7 years ago

Paul,

Have you been able to run the test plugin?

Rob

4.5K Messages

 • 

76.3K Points

7 years ago

Paul - you still alive?

4.5K Messages

 • 

76.3K Points

7 years ago

Replies here not making it through your spam filter, Paul?

4.5K Messages

 • 

76.3K Points

7 years ago

Knock-knock (anybody home?)...

4.5K Messages

 • 

76.3K Points

7 years ago

Just double-checked that the test plugin is downloading OK. In any case, here is the guts of it:

local LrDialogs = import 'LrDialogs'

local LrTasks = import 'LrTasks'
local LrFunctionContext = import 'LrFunctionContext'
local LrApplication = import 'LrApplication'
local LrFileUtils = import 'LrFileUtils'

LrFunctionContext.postAsyncTaskWithContext( "CreateVirtualCopyTest", function( context )

LrDialogs.attachErrorDialogToFunctionContext( context )

local catalog = LrApplication.activeCatalog()
local targets = catalog:getTargetPhotos()
if #targets < 2 then
LrDialogs.message( "This test requires multiple photos." )
return
end
if #targets > 10 then
LrDialogs.message( "This test requires 10 or less target photos." )
return
end

for i, photo in ipairs( targets ) do
if photo:getRawMetadata( 'isVirtualCopy' ) then
LrDialogs.message( "Selected photos must not be virtual copies" )
return
end
end

local answer = LrDialogs.confirm( "Go? (" .. #targets .. " photos are selected)" )
if answer == 'ok' then
-- fine
else
LrDialogs.message( "canceled" )
return
end

local copies = catalog:createVirtualCopies( "CreateVirtualCopyTest" )
if #copies ~= #targets then
LrDialogs.message( "wrong number of copies created" )
return
end
for i, photo in ipairs( copies ) do
if not photo:getRawMetadata( 'isVirtualCopy' ) then
LrDialogs.message( "Test failed - '" .. photo:getRawMetadata( 'path' ) .. "' is not a virtual copy." )
return
end
end

LrDialogs.message( "Test passed - all copies are virtual.", "I bet you're in grid view(?) - now try it in loupe view or develop module - I bet it will fail (always fails on my setup anyway), or at least if you're testing it in Windows - may not fail on Mac: dunno." )

end )

5 Messages

 • 

150 Points

7 years ago

Hi Rob, I ran your test and my results are:
Library Grid: 2 selected -> 2 Virtual copies created: test Ok
Library Loupe: 2 selected -> 1 Virtual copy created: test NOT Ok
Develop: 2 selected -> 2 Virtual copies created: test Ok

So yes, I support your point!

My system:
Windows 7-64 bits
Lightroom version: 5.0 [907681]
Operating system: Windows 7 Home Premium Edition
Version: 6.1 [7601]
Application architecture: x64
System architecture: x64

4.5K Messages

 • 

76.3K Points

7 years ago

Thanks for checking D. I'm surprised it works for you in develop module - I just double-checked, 2 selected, got this:

Not sure why the results would not be the same for us, but regardless - there's definitely a bug... - thanks again, R.

4.5K Messages

 • 

76.3K Points

7 years ago

Not fixed in Lr5.2 - what happened Paul?

5 Messages

 • 

150 Points

7 years ago

I ran the script from Rob as listed above.

This problem is not solved in 5.3 version.

I tested it with 3 different computers:
1: Windows 7 Home Home Premium Edition
2: MacBook Air 11"
3: Laptop Windows 8.0

Conclusion:
1) On all three computers the test fails
2) On each computer the fail situation is different!!

Please solve this bug, because my plug-in relies on this great functionality!
Contact me if you need more info.

Computer 1: Windows 7
Loupe: Not Ok, failded
Grid: Ok.
Develop: Ok.

Lightroom version: 5.3 [938183]
Operating system: Windows 7 Home Premium Edition
Version: 6.1 [7601]
Application architecture: x64
System architecture: x64
Logical processor count: 8
Processor speed: 3,4 GHz
Built-in memory: 8173,1 MBWindows 7:

Computer 2: MacBook Air
Loupe: Not Ok, failed
Grid: Ok.
Develop: Not Ok, failed

Lightroom version: 5.3 [938183]
Operating system: Mac OS 10
Version: 10.9 [0]
Application architecture: x64
Logical processor count: 4
Processor speed: 1,7 GHz
Built-in memory: 4096,0 MB
Real memory available to Lightroom: 4096,0 MB

Computer 3: Laptop Windows 8
Loupe: Ok
Grid: Ok.
Develop: Not Ok, failed

Lightroom version: 5.3 [938183]
Operating system: Windows 8 Home Premium Edition
Version: 6.2 [9200]
Application architecture: x64
System architecture: x64
Logical processor count: 8
Processor speed: 2,3 GHz
Built-in memory: 6029,6 MB
Real memory available to Lightroom: 6029,6 MB
Real memory used by Lightroom: 629,8 MB (10,4%)
Virtual memory used by Lightroom: 606,4 MB

4.5K Messages

 • 

76.3K Points

7 years ago

Thanks D.

I'm not sure why we're getting the silent treatment.

R.