Skip to main content
Inspiring
February 19, 2016
Answered

getDevelopSettings().Exposure2012 returns -999999

  • February 19, 2016
  • 2 replies
  • 1561 views

In my Relative adjustments plug-in I use the getDevelopSettings() to get the original values for, for example, Exposure2012.

One client had a problem and diving into this I discovered that when, for example when retrieving the Exposure setting, in some cases LR returns -99999 instead of the real values. Although, when navigating to the image, the settings in de Basic panel are correct.
This client is on LR5.

Reproduce:

  1. Run the test plug-in below on a large folder (> 200) with RAW files
    Sometimes the error occurs direct, sometimes after applying a setting on a undeveloped image.
  2. Otherwise
    1. (Create a new catalog, Best to experiment on a new catalog)
    2. Import 200 - 300 RAW photos
    3. Select them all and apply Auto-Tone to all of them (Library module & Grid) -> Right mouse click -> Develop settings -> Auto tone.
    4. Run the code below and see what's in the log file.

On some photos this -99999 is returned and on others not. Mostly on photos not visible on screen.

When in Develop mode, I scroll through all the photos manually, then afterwards it seems fine. Caching problem??

Questions:

  • Any tips & tricks how to solve this issue?
  • Did I miss some thing?
  • How can I correct this behavior?

Info.lua

local info =

{

    LrSdkVersion        = 4.0,

    LrToolkitIdentifier = 'com.LightroomStatistics.lightroom.develop.test',

    LrPluginName        = "Test",

    LrPluginInfoUrl     = 'http://www.LightroomStatistics.com/',

    LrAlsoUseBuiltInTranslations = true,

   

    VERSION = { major=0, minor=1, revision=1, build=0, },

   

    LrHelpMenuItems = {

        {

            title = "List exposure setting photos",

            file = "ShowSettings.lua",

        },

    },

}

return info

ShowSettings.lua

local LrTasks = import 'LrTasks'

local catalog = import "LrApplication".activeCatalog()

local ProgressScope = import 'LrProgressScope'

local LrDialogs = import 'LrDialogs'

local LrView = import 'LrView'

local LrPathUtils = import 'LrPathUtils'

local LrFileUtils = import 'LrFileUtils'

local logFilename = 'ExposureSettings'

local myLogger = import 'LrLogger'( logFilename )

myLogger:enable( "logfile" )

--[[--------------------------------------------------------------------------

Name        emptyLogFile

Purpose        Clears the existing log file.

From cookbook: http://cookbooks.adobe.com/post_Clearing_your_logfile_automatically-19677.html

----------------------------------------------------------------------------]]

function emptyLogFile()

    --local myLogger = import 'LrLogger'( 'Stash' )

    myLogger:disable()    

   

    logPath = LrPathUtils.child(LrPathUtils.getStandardFilePath('documents'), logFilename .. ".log")

    if LrFileUtils.exists( logPath ) then

        local success, reason = LrFileUtils.delete( logPath )

        if not success then

            logger:error("Error deleting existing logfile!" .. reason)

        end

    end

    myLogger:enable( "logfile" )

end

--[[--------------------------------------------------------------------------

Main function

Name        Select images

Purpose        This plug-in will select every second photo.

            The selected photo is the first photo to be selected and then every second

            photo will also be selected.

Version        1.0

Developer    D. Holtman

----------------------------------------------------------------------------]]

LrTasks.startAsyncTask( function()

    emptyLogFile()

   

    --    Get all the selected photos and the active photo

    local cat_photos = catalog:getTargetPhotos()

    local nCountSelected = #cat_photos

    myLogger:info('List table develop settings')

    for i, photo in ipairs(cat_photos) do

        local devSettings = photo:getDevelopSettings()

        local name = photo:getFormattedMetadata( "fileName" )

        myLogger:info('Photo', name, devSettings.Exposure2012)

    end

   

    LrDialogs.message('Listing exposure', 'Finished')

end)

This topic has been closed for replies.
Correct answer johnrellis

The code I added illustrates that after a user does a mass updat,e for example Auto-Tone, on 200 photos and then just reading the new Exposure values, makes that Lightroom does not report back the right values, but for some photos just -99999. Although the bars in the upper left corner indicate the Auto-tone operation has finished, somehow the database or cache or ... is not yet updated which results in wrong values. Going to those photos and loading them in the Develop module, then the right value is shown in the Basic dialog and also reported in the script. The first step in my plug-in, which normally works perfect, is to read the current values, in order calculate the new one. So using photo:applyDevelopSettings will not work, because I do not get the right initial values.


after a user does a mass updat,e for example Auto-Tone

Right, that sounds very much like the Sync Settings bug I previously reported.

photo:applyDevelopSettings will not work, because I do not get the right initial values.

Good point.  But try the spin-looping and try getting the JPEG thumbnail (waiting until it is actually fetched). 

2 replies

johnrellis
Legend
February 19, 2016

In the past, I have reported two issues with getDevelopSettings() returning inconsistent values, in LR 5 and LR 2015.1.  In both cases, it appears that LR was deferring updates to the catalog to background tasks, and it wasn't waiting until that work was completed before returning from getDevelopSettings ().  Your symptoms sound very similar to the second bug report, where getDevelopSettings() returns incorrect values until you've scrolled through all the photos slowly in Library and waited until the thumbnails have been updated.  The only workaround I discovered for that problem was to ask the user to do exactly that -- scroll through Library and wait until the thumbnails are updated.

But try adding this to your test plugin:

local i, e = 0, nil

while true do

    i, e = i + 1, photo:getdevelopSettings ().Exposure2012

    if i >= 1000 or (e ~= nil and e >= -4) then break end

    LrTasks.sleep (0.1)

    end

myLogger:info (photo:getFormattedMetadata ("filename", i, e)

This will test whether the settings eventually get updated to the correct value without the user having to scroll in Library. 

johnrellis
Legend
February 19, 2016

A couple of other workarounds to try:

1. Do photo:applyDevelopSettings (photo:getDevelopSettings ()) to see if that forces the settings to get properly updated.

2. Call photo:requestJpegThumbnail(), wait until the callback is actually called, then call photo:getDevelopSettings ().  Maybe that will force the settings to get properly updated.

The idea of both of these workarounds is to invoke code paths through LR that are properly implemented, waiting for any background updates of the settings to complete.

Inspiring
February 19, 2016

The code I added illustrates that after a user does a mass updat,e for example Auto-Tone, on 200 photos and then just reading the new Exposure values, makes that Lightroom does not report back the right values, but for some photos just -99999. Although the bars in the upper left corner indicate the Auto-tone operation has finished, somehow the database or cache or ... is not yet updated which results in wrong values. Going to those photos and loading them in the Develop module, then the right value is shown in the Basic dialog and also reported in the script. The first step in my plug-in, which normally works perfect, is to read the current values, in order calculate the new one. So using photo:applyDevelopSettings will not work, because I do not get the right initial values.

johnrellis
Legend
February 19, 2016

Can you replicate this in LR 6?  Adobe doesn't pay any attention to problems with older versions.  If you can replicate it in LR 6, repost the bug report in the official Adobe feedback forum, where the product developers will see it: Photoshop Lightroom | Photoshop Family Customer Community.

Inspiring
February 19, 2016

Yes, I tried it in Lightroom 6 myself and I also, in some cases got the same result, that the Exposure2012 value reported -99999