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

  • 3
  • Problem
  • Updated 4 years ago
  • Solved
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
Photo of Rob Cole

Rob Cole

  • 4831 Posts
  • 386 Reply Likes

Posted 6 years ago

  • 3
Photo of Paul Kleczka

Paul Kleczka, Employee

  • 44 Posts
  • 5 Reply Likes
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.
Photo of Rob Cole

Rob Cole

  • 4831 Posts
  • 386 Reply Likes
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
Photo of Paul Kleczka

Paul Kleczka, Employee

  • 44 Posts
  • 5 Reply Likes
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
Photo of Rob Cole

Rob Cole

  • 4831 Posts
  • 386 Reply Likes
Have you been able to try the test plugin? (link is in the post below)
Photo of Rob Cole

Rob Cole

  • 4831 Posts
  • 386 Reply Likes
Test plugin here:

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

Thanks,
Rob
Photo of Rob Cole

Rob Cole

  • 4831 Posts
  • 386 Reply Likes
Paul,

Have you been able to run the test plugin?

Rob
Photo of Rob Cole

Rob Cole

  • 4831 Posts
  • 386 Reply Likes
Paul - you still alive?
Photo of Rob Cole

Rob Cole

  • 4831 Posts
  • 386 Reply Likes
Replies here not making it through your spam filter, Paul?
Photo of Rob Cole

Rob Cole

  • 4831 Posts
  • 386 Reply Likes
Knock-knock (anybody home?)...
Photo of Rob Cole

Rob Cole

  • 4831 Posts
  • 386 Reply Likes
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 )
Photo of D. Holtman

D. Holtman

  • 5 Posts
  • 0 Reply Likes
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
Photo of Rob Cole

Rob Cole

  • 4831 Posts
  • 386 Reply Likes
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.
Photo of Rob Cole

Rob Cole

  • 4831 Posts
  • 386 Reply Likes
Not fixed in Lr5.2 - what happened Paul?
Photo of D. Holtman

D. Holtman

  • 5 Posts
  • 0 Reply Likes
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
Photo of Rob Cole

Rob Cole

  • 4831 Posts
  • 386 Reply Likes
Thanks D.

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

R.
Photo of Rob Cole

Rob Cole

  • 4831 Posts
  • 386 Reply Likes
Not fixed in Lr5.4.
Photo of Paul Kleczka

Paul Kleczka, Employee

  • 44 Posts
  • 5 Reply Likes
I've reproduced this issue. A bug has been filed.
Photo of John R. Ellis

John R. Ellis, Champion

  • 4114 Posts
  • 1085 Reply Likes
Great, thanks Paul.
Photo of Jeffrey Tranberry

Jeffrey Tranberry, Sr. Product Manager, Digital Imaging

  • 15249 Posts
  • 2195 Reply Likes
Official Response
This should be fixed in Lightroom CC/Lightroom 6.