Copy link to clipboard
Copied
Lightroom version 13.3.1 and CameraRaw 16.3.1
After setting the White balance to "As shot" the photo:getDevelopSettings() doesn't return the correct develop settings for Temperature or Tint. All photos selected are RAW files.
Also there is a difference in behavior when running the script on images with or without having resetted the settings to original <Ctrl><Shift> R.
On new images the value of -999999 returned, however when you Reset the images with <Ctrl><Shift> R and run the script again, instead of the value for Temperature and Tint is nil.
Only after 1 or more seconds the correct values are returned.
First run on new images:
Now hitting the Reset settings <Ctrl><Shift> R key:
Same images still selected.
Code used:
local LrApplication = import("LrApplication")
local LrDialogs = import("LrDialogs")
local LrFunctionContext = import("LrFunctionContext")
local catalog = LrApplication.activeCatalog()
local logFilename = 'WhiteBalance_01.txt'
local MyLogger = import 'LrLogger' (logFilename)
MyLogger:enable("logfile")
local inspect = require "inspect"
local function main(context)
LrDialogs.attachErrorDialogToFunctionContext(context)
local photos = catalog:getTargetPhotos()
MyLogger:info("#photos", #photos)
local devSettings = { WhiteBalance = "As shot" }
catalog:withWriteAccessDo("Apply White balance settings", function()
local preset = LrApplication.addDevelopPresetForPlugin(_PLUGIN, "WB As Shot", devSettings)
for _, photo in ipairs(photos) do
MyLogger:info(photo:getFormattedMetadata("fileName"))
photo:applyDevelopPreset(preset, _PLUGIN)
end
end)
local message = "Loop 1\n"
local nilValues = true
local counter = 1
while nilValues and (counter < 20) do
nilValues = false
for _, photo in ipairs(photos) do
local fileName = photo:getFormattedMetadata("fileName")
local developSetings = photo:getDevelopSettings()
MyLogger:info(fileName, inspect(developSetings))
-- Test for nil values
if (nilValues == false) and
(
(developSetings.Temperature == nil) or
(developSetings.Temperature == -999999) or
(developSetings.Tint == nil) or
(developSetings.Tint == -999999)
) then
nilValues = true
end
message = message ..
string.format("image: %-15s temperature: %-8s tint: %-8s\n", fileName,
developSetings.Temperature or "nil",
developSetings.Tint or "nil")
end
if (nilValues == true) then
counter = counter + 1
LrTasks.sleep(0.5)
message = message .. string.format("\n\nLoop %d -- wait for an extra %.1f seconds\n",counter, 0.5)
end
end
LrDialogs.message("LightroomStatistics", message)
end
LrFunctionContext.postAsyncTaskWithContext("", main)
Have something to add?