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

  • 1
  • Problem
  • Updated 4 years ago
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.

Photo of Rob Cole

Rob Cole

  • 4831 Posts
  • 385 Reply Likes

Posted 4 years ago

  • 1

Be the first to post a reply!