Using getDevelopSettings()
Hello!
My name is Roman. I try to make a simple LR plug-in with following functions:
1. Plug-in must send commands via PC's COM port,
2. Plug-in must provide the list of presets to apply it to all photos in catalog,
3. Plug-in must provide the batch crop function.
Now I'm working with presets and something works fine (with kind help of johnrellis). For example, following code really changes all selected photos:
LrTasks.startAsyncTask(function()
catalog:withWriteAccessDo("PresetTry", function()
local cat_photos = catalog.targetPhotos
for i, photo in ipairs(cat_photos) do
local preset = LrApplication.addDevelopPresetForPlugin( _PLUGIN, "TestPreset", { Shadows2012 = .4, Exposure2012 = .3 })
photo:applyDevelopPreset(preset, _PLUGIN)
end
end)
end)
But there are some problems:
1. When I try to get some information from loaded image some methods works, some don't.
For example, photo:getFormattedMetadata("fileSize") and photo:getFormattedMetadata("fileType") works fine, but
local settings = photo:getDevelopSettings()
LrDialogs.message( string.format("%d", settings["Exposure2012"]) )
returns 0. At the same time I see that Exposure is equal to 0.3 (after the previous code was executed) in the Develop tab.
Maybe, the original image wasn't changed with photo:applyDevelopPreset(preset, _PLUGIN), so original Exposure wasn't changed.
2. I created some presets with names, for example, FirstPreset, SecondPreset etc. How can I apply it to images in my plug-in? I searched through the forum, but found nothing about it.
3. I use the following code to get all photos in catalog:
local cat_photos = catalog.targetPhotos
for i, photo in ipairs(cat_photos) do
_some_code_here_
end
It works fine when I select all photos in catalog manually (when they all highlighted), but it doesn't when only one photo is selected - then I handle this and only this photo. What could be the problem?
Thank you in advance.
Best regards
Roman
