After applying Develop Settings (either via SDK or via UI), sometimes photos are left in a state where photo:getDevelopSettings() will not give correct values for all sliders, especially Temperature and Tint. (and also the visual representation in the grid does not seem to be updated - when you scroll to the image, you see it visually update only after it has entered the viewport).
Simple code snippet to try for yourself:
local LrApplication = import "LrApplication"
local LrTasks = import "LrTasks"
local LrDialogs = import "LrDialogs"
local LrFunctionContext = import "LrFunctionContext"
LrTasks.startAsyncTask(function()
local catalog = LrApplication.activeCatalog()
local photos = catalog:getTargetPhotos()
local badSettings = {}
for i, photo in ipairs(photos) do
local settings = photo:getDevelopSettings()
local temperature = nil
local tint = nil
if settings.IncrementalTemperature ~= nil and settings.IncrementalTint ~= nil then
temperature = settings.IncrementalTemperature
tint = settings.IncrementalTint
if temperature < -100 or temperature > 100 or tint < -100 or tint > 100 then
badSettings[#badSettings + 1] = {photo,
"OUT OF RANGE incTemp: " .. tostring(temperature) .. " incTint: " ..
tostring(tint)}
end
elseif settings.Temperature ~= nil and settings.Tint ~= nil then
temperature = settings.Temperature
tint = settings.Tint
if temperature < 2000 or temperature > 50000 or tint < -150 or tint > 150 then
badSettings[#badSettings + 1] = {photo,
"OUT OF RANGE temp: " .. tostring(temperature) .. " tint: " ..
tostring(tint)}
end
else
badSettings[#badSettings + 1] = {photo,
"NIL temp: " .. tostring(settings.Temperature) .. " tint: " ..
tostring(settings.Tint) .. " incTemp: " .. tostring(settings.IncrementalTemperature) .. " incTint: " ..
tostring(settings.IncrementalTint)}
end
end
if #badSettings > 0 then
LrFunctionContext.callWithContext("CheckForBadSettings", function(context)
local info = ""
for i, b in ipairs(badSettings) do
local photo = b[1]
local reason = b[2]
info = info .. photo:getFormattedMetadata("fileName") .. ":" .. tostring(reason) .. ", \n"
end
local result = LrDialogs.message("Found " .. tostring(#badSettings) .. " / " .. tostring(#photos) ..
" images bad settings", info)
end)
else
LrDialogs.message("No bad settings found")
end
end)
How to reproduce:
Take a catalog with multiple photos. Select more than are visible in the grid viewport (in my example i select 102 images, when the grid only shows 9). Do right click -> develop settings -> reset develop settings (or set them via photo:applyDevelopSettings()).
With the images still selected, run above code. We quite consistently get:
Found 73 / 102 images bad settings (basically all the photos outside the viewport)
If i scroll through the grid down a few images, i see them visually update and when running the code again, the number of bad images reduces by the number of images i had scrolled through.
Note: Instead of nil values we also encountered -999999 values in some cases.
Is this known/intented, and is there a way to trigger LrC to update the images via SDK? We tried photo:
requestJpegThumbnail() but this also did not consistently ensure good values.