Skip to main content
Known Participant
December 13, 2023
Question

SDK Issue with applyDevelopPreset for plugin created with plug-in

  • December 13, 2023
  • 1 reply
  • 1201 views

I am building a plugin that allows me to "Save" settings from one image and then "Apply" those settings to another image. I am saving the settings from the reference image to a develop preset using LrApplication.addDevelopPresetForPlugin() (this is one lua file) and then applying the settings using photo:applyDevelopPreset() (this is a different lua file). Everything is working as it should except when I attempt to apply the settings multiple times in a row. I receive an error that says "An internal error has occurred. assertion failed!"

 

Here is a video of the error: https://vimeo.com/893943484/947d84620e?share=copy

 

Here is my script for the Save Settings lua file:

 

local LrApplication = import "LrApplication"
local LrDialogs = import 'LrDialogs'
local LrTasks = import 'LrTasks'
local catalog = LrApplication.activeCatalog ()
local photo = catalog:getTargetPhoto ()
local targetPhoto = catalog:getTargetPhoto ()

LrTasks.startAsyncTask( function()
catalog:withWriteAccessDo ("Save Settings One", function ()

local settings = targetPhoto:getDevelopSettings ()
savesettingsone = LrApplication.addDevelopPresetForPlugin(_PLUGIN, "Paste Settings", settings)
end)
end)

 

Here is my script for the Apply Settings lua file:

 

local LrApplication = import "LrApplication"
local LrDialogs = import 'LrDialogs'
local LrTasks = import 'LrTasks'
local catalog = LrApplication.activeCatalog ()
local photo = catalog:getTargetPhoto ()
local photos = catalog:getTargetPhotos()


LrTasks.startAsyncTask( function()
catalog:withWriteAccessDo ("Paste", function ()

photo:applyDevelopPreset(savesettingsone, _PLUGIN)

end)
end)

 

Any thoughts on what is happening here?

This topic has been closed for replies.

1 reply

johnrellis
Genius
December 13, 2023

You can often get an idea of where an error is coming from by starting LR from the Terminal command line with the -tracebacks option:

/Applications/Adobe\ Lightroom\ Classic/Adobe\ Lightroom\ Classic.app/Contents/MacOS/Adobe\ Lightroom\ Classic -tracebacks

 

Trigger the error, and then copy/paste the last couple hundred lines or so here.

 

 

C.Cella
Inspiring
December 13, 2023

@cwurzbach 

 

I have to ask: in what way is your plug-in different compared to LrC internal Copy and Paste?

 

Seems to me you are copying settings as they are, so you are keeping all the bugs and issue connected to it.

 

What's the advantage?

Why not use LrC directly?

 

Is this the beginning of a bigger more complete plug-in?

 

 

 

.

cwurzbachAuthor
Known Participant
December 13, 2023

@C.Cella I have a very specific use case for this functionality that is different than the native copy and paste functionality in Lightroom Classic.