Skip to main content
Known Participant
July 29, 2013
Question

create a preset in lua module

  • July 29, 2013
  • 1 reply
  • 2215 views

I want to experiment with applying develop adjustments from a plug-in.  noticed the photo:applyDevelopPreset( preset, plugin ) function.

Question:

Is there a way to create a preset on the fly within the plug-in, for example a preset for  setting the Exposure2012 to +10.

A little piece of code would be appreciated much!

This topic has been closed for replies.

1 reply

areohbee
Legend
July 29, 2013

preset = LrApplication.addDevelopPresetForPlugin( _PLUGIN, "My Groovy Preset", { Exposure2012 = .3 } ) -- no catalog write access required.

photo:applyDevelopPreset( preset, _PLUGIN ) -- catalog write access required.

Note: develop preset will be applied at Lr's leisure in the background (after returning from catalog write access method), so if you are depending on preset settling in, you need to add some logic after applying.

Beware: assuring auto-toned values have settled, so you can make adjustments to auto-toned values, is particularly problematic. There are similar problems with auto/custom white-balance, lens corrections, ...

dhmc05Author
Known Participant
July 30, 2013

Rob, THANK YOU!!!!!!!!!

Great,this is awesome!

Participant
December 1, 2013

Hi guys im working on my first plugin, excuse me my poor knowlage. i use code

"

local function setPreset () 

  local LrApplication = import 'LrApplication'

  local catalog = LrApplication.activeCatalog()

  catalog:withWriteAccessDo( 'setPreset', function()

   

   local preset = LrApplication.addDevelopPresetForPlugin( _PLUGIN, "___Dummy___", { Exposure2012 = 1.2 } )

   photo:applyDevelopPreset(preset, _PLUGIN)

  end)

 

end

"

i recive error :

attemp to index global 'catalog' a nil value.

why is that happening?