• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

P: SDK: photo:getDevelopSettings() return nil or -999999 for Temperature and Tint after setting WB

Participant ,
Jun 14, 2024 Jun 14, 2024

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:

LightroomStatistics_0-1718356344460.png

 

Now hitting the Reset settings <Ctrl><Shift> R key:
Same images still selected.

LightroomStatistics_1-1718356409391.png

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)

 

 

TOPICS
SDK , Windows

Views

56

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
no replies

Have something to add?

Join the conversation