Copy link to clipboard
Copied
I've been playing a little with the createVirtualCopies funciton in LR5.
First adding the createVirtualCopies() function is great!
Thought / wise: could there be a similar function in the LrPhoto class, so that based on a photo a Virtual copy is created?
Then I'm not dependant upon any active selection.
Some questions:
I did a little test:
local LrDialogs = import 'LrDialogs'
local LrTasks = import 'LrTasks'
local LrFunctionContext = import 'LrFunctionContext'
local LrApplication = import 'LrApplication'
--[[--------------------------------------------------------------------------
Name inspect
Purpose module for listing a table
Source https://github.com/kikito/inspect.lua
----------------------------------------------------------------------------]]
local inspect = require 'inspect'
LrFunctionContext.postAsyncTaskWithContext( "CreateVirtualCopyTest", function( context )
LrDialogs.attachErrorDialogToFunctionContext( context )
local catalog = LrApplication.activeCatalog()
local activePhoto = catalog:getTargetPhoto()
LrDialogs.message( inspect (activePhoto:getDevelopSettings()) )
if activePhoto ~= nil then
local virtualCopy = catalog:createVirtualCopies( "CreateVirtualCopyTest" )
LrDialogs.message( inspect (virtualCopy:getDevelopSettings()) )
else
LrDialogs.message( "No photo selected! Please select a photo" )
return
end
end )
Any thoughts?
(Example based on code of Rob Cole.)
Copy link to clipboard
Copied
dhmc05 wrote:
Any thoughts?
Poor design (sorry Adobe).
There are a number of new functions which bypass the catalog write methods (which is convenient) but are tied to the Lr user interface, e.g. library view mode, or develop module, which is bad - especially bad since there is no way to:
A. Tell which module / mode Lr is in.
B. Force which module / mode to be in.
C. Assure photos are targeted, even if being filtered, or are underlings in a stack..
I hope somebody who knows what they're doing with the SDK sorts this mess out before releasing Lr5 SDK.
Rob
Copy link to clipboard
Copied
one error in your code:
it should be:
local virtualCopiesArray = catalog:createVirtualCopies...
i.e. return value is an array of photos.
Note: this function is ONLY reliable in library module, not develop module.
I strongly recommend that you check each photo in the array to assure it is a virtual copy as you expect. Lr will sometimes return photos that are NOT virtual copies of the master as you were hoping for, e.g. if in develop module.
Rob