rob_cole_2221866's profile

4.5K Messages


76.3K Points

Fri, Nov 21, 2014 4:43 AM


Lightroom 5 SDK: photo:createDevelopSnapshot( name, true ) -- creates duplicate snapshot if photo is virtual copy.

I believe this symptom is related to the fact that photo:getDevelopSnapshots() returns an empty array if photo is virtual copy, i.e. Lr is only recording develop snapshots for master, so snapshot created by virtual copy never seems like a duplicate.

So, one needs to always have logic like this when getting snapshots:

local snapshots
if photo:getRawMetadata( 'isVirtualCopy' ) then
snapshots = photo:getRawMetadata( 'masterPhoto' ):getDevelopSnapshots()
snapshots = photo:getDevelopSnapshots()

Unfortunately, re-creating snapshot of virtual copy requires more aggressive intervention, e.g.

if photo:getRawMetadata( 'isVirtualCopy' ) then
-- with-cat-do: delete pre-existing snapshot
-- with-cat-do: re-create virtual copy snapshot
-- i.e. snapshot deletion must be concluded (catalog updated) before snapshot re-creation.
-- create snapshot without pre-deletion, in with-cat-do wrapper..

PS - I realize getDevelopSnapshots method is not documented, and so presumably not supported, but createDevelopSnapshot is documented, and so should be made to function in a more reasonable manner - thanks.

No Responses!