Resetting both Crop and Transform Panel using API requires weird workaround.
My goal was to create a script that resets BOTH Crop and Transform.
First of all the inthe SDK documentation Transform Panel settings are erroneously still listed under lensCorrectionPanel.
What a great way to make things harder for newcomers.
Anyway this is how I wrote the script first:
local LrDevelopController = import "LrDevelopController"
local mode = LrDevelopController.resetToDefault ("PerspectiveVertical")
local mode = LrDevelopController.resetToDefault ("PerspectiveHorizontal")
local mode = LrDevelopController.resetToDefault ("PerspectiveRotate")
local mode = LrDevelopController.resetToDefault ("PerspectiveScale")
local mode = LrDevelopController.resetToDefault ("PerspectiveAspect")
local mode = LrDevelopController.resetToDefault ("PerspectiveX")
local mode = LrDevelopController.resetToDefault ("PerspectiveY")
local mode = LrDevelopController.resetToDefault ("PerspectiveUpright")
local mode = LrDevelopController.resetToDefault ("straightenAngle")
local mode = LrDevelopController.resetCrop()
This doesn't reset Crop in any way whatsoever but it does reset the Transform Panel.
Apparently LrDevelopController.resetCrop() doens't work in this context and must be used in a separate script on its own.
local LrDevelopController = import "LrDevelopController"
LrDevelopController.resetCrop()
I say apparently because in reality it is sufficient to write a single line above LrDevelopController.resetCrop() and BOTH reset Crop and reset Transform can be achieved in one code.
So I wrote this:
local LrDevelopController = import "LrDevelopController"
local mode = LrDevelopController.resetToDefault ("PerspectiveVertical")
local mode = LrDevelopController.resetToDefault ("PerspectiveHorizontal")
local mode = LrDevelopController.resetToDefault ("PerspectiveRotate")
local mode = LrDevelopController.resetToDefault ("PerspectiveScale")
local mode = LrDevelopController.resetToDefault ("PerspectiveAspect")
local mode = LrDevelopController.resetToDefault ("PerspectiveX")
local mode = LrDevelopController.resetToDefault ("PerspectiveY")
local mode = LrDevelopController.resetToDefault ("PerspectiveUpright")
local mode = LrDevelopController.resetToDefault ("straightenAngle")
LrDevelopController.setValue ("CropAngle", mode == 0)
local mode = LrDevelopController.resetCrop()
Unfortunately an extras tep for the Set Crop Angle will be recorded in history should the Crop Angle be other than 0...I tried to group them into one step with LrDevelopController.setMultipleAdjustmentThreshold() but to no avail.
So I wrote the following and it works (only one history step will be added and both Crop and Transform will be reset)
local LrDevelopController = import "LrDevelopController"
local mode = LrDevelopController.resetToDefault ("PerspectiveVertical")
local mode = LrDevelopController.resetToDefault ("PerspectiveHorizontal")
local mode = LrDevelopController.resetToDefault ("PerspectiveRotate")
local mode = LrDevelopController.resetToDefault ("PerspectiveScale")
local mode = LrDevelopController.resetToDefault ("PerspectiveAspect")
local mode = LrDevelopController.resetToDefault ("PerspectiveX")
local mode = LrDevelopController.resetToDefault ("PerspectiveY")
local mode = LrDevelopController.resetToDefault ("PerspectiveUpright")
local mode = LrDevelopController.resetToDefault ("straightenAngle")
LrDevelopController.setProcessVersion ("ProcessVersion 6")
local mode = LrDevelopController.resetCrop()
What is absurd and non intutive is that the penultimate line (as the above proves) can have nothing to do with Cropping.
One can even write LrDevelopController.setValue ("Exposure2012", mode == 0) and the LrDevelopController.resetCrop() will suddenly works in the same code alongside resetting transform.
This is most weird.
A bug or for some reason this is per design?
.
