Skip to content

Commit

Permalink
fix: edits use applyDevelopSettings instead of plugin presets (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
cajames authored Jun 27, 2020
1 parent b19537c commit a59a979
Showing 1 changed file with 5 additions and 15 deletions.
20 changes: 5 additions & 15 deletions VSCOKeys.lrdevplugin/Client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,7 @@ function Client:loop()
local wbDict = { WhiteBalance = "Custom" }

photo.catalog:withWriteAccessDo("VSCO Keys", function()
local preset = LrApplication.addDevelopPresetForPlugin(_PLUGIN, "WhiteBalance Custom Custom", wbDict)
photo:applyDevelopPreset(preset, _PLUGIN)
photo:applyDevelopSettings(wbDict)
end, {asynchronous = true})

-- requery the photo data to get the current whitebalance data
Expand All @@ -203,8 +202,7 @@ function Client:loop()
logging:log("Locking constrain to warp.")

photo.catalog:withWriteAccessDo("VSCO Keys", function()
local preset = LrApplication.addDevelopPresetForPlugin(_PLUGIN, "Crop Constrain To Warp Yes Yes", wbDict)
photo:applyDevelopPreset(preset, _PLUGIN)
photo:applyDevelopSettings(wbDict)
end, {asynchronous = true})

-- requery the photo data to get the current constrain data
Expand Down Expand Up @@ -249,17 +247,9 @@ function Client:loop()
if (table.count(edits) > 0) then
photo.catalog:withWriteAccessDo("VSCO Keys", function()

-- In LRC 9.3, these properties below get overwritten when applying any plugin edit preset.
-- As a fix, we're copying them from the existing image settings
-- and setting them back onto the image as part of the edit preset
-- This feels like a bug on the SDK, as this doesn't happen to any other property.
-- Raised here: https://community.adobe.com/t5/lightroom-classic/all-corrections-get-overwritten-when-calling-applydeveloppreset-with-a-plugin-preset-in-lrc-9-3/m-p/11245013?page=1#M191778
edits.PaintBasedCorrections = photoData.PaintBasedCorrections
edits.CircularGradientBasedCorrections = photoData.CircularGradientBasedCorrections
edits.GradientBasedCorrections = photoData.GradientBasedCorrections

local preset = LrApplication.addDevelopPresetForPlugin(_PLUGIN, editText, edits)
photo:applyDevelopPreset(preset, _PLUGIN)
-- Changed implementation from using presets to directly applying edits.
-- This also saves on a lot of redundant plugin presets being created.
photo:applyDevelopSettings(edits);

logging:log("Edit Applied " .. to_string(edits))
end, {asynchronous = true})
Expand Down

2 comments on commit a59a979

@rachaelblack
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @cajames . I've been in a forum with you and several others where VSCO Keys is the main topic of discussion and you've saved our butts numerous times with your updates and modifications. I remember recently there was conversation about edits being lost when actions were made using Keys (maybe converting to b&w). For the life of me, I canNOT find the forum. Can you point me in the right direction so I can research the resolution for this issue? I know it's been discussed and I just can't find my way to finding it. Thanks a million!! -Rachael

@cajames
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @rachaelblack, do you mean this forum post? This was the post I made discussing the issue I found with the problem. This was in June last year though.

https://community.adobe.com/t5/lightroom-classic/all-corrections-get-overwritten-when-calling-applydeveloppreset-with-a-plugin-preset-in-lrc-9-3/m-p/11245335

From there, someone else verified the issue that we found, and so I posted it on Adobe's forum here: https://feedback.photoshop.com/conversations/lightroom-classic/lightroom-classic-93-calling-applydeveloppreset-with-a-plugin-preset-removes-all-photo-corrections/5f5f462c4b561a3d4277e0db

And then they fixed the issue. It shouldn't be an issue anymore.

Please sign in to comment.