Copy develop settings from one photo to another: problems! Photo: getDevelopSettings LrDevelopController.setValue

I've also attached the full code at the bottom of this message in case this is useful, but the summary

I have a plugin of lua (rsjaffe MIDI2LR) who receives an application via a LrSocket MIDI messages. Everything works, but I tried to add copy/paste develop settings without success.

In the following code, copy settings is:

function copySettings()

local photo = LrApplication.activeCatalog (:getTargetPhoto())

parameters = photo: getDevelopSettings()

end

and paste the settings:

function pasteSettings()

applySettings (settings)

end


function applySettings (set) - still experimental

If LrApplicationView.getCurrentModuleName () ~ = 'develop' then

LrApplicationView.switchToModule ('develop')

end

for x, v to peers (set)

-SERVER: send (string.format ("%s % d\n", x, develop_lerp_to_midi (v) "))

-PARAM_OBSERVER [x] = v

LrDevelopController.setValue (x, v)

end

end


Functions called, but nothing happens to the picture of the target. I was also unable to attach a debugger (tried ZeroBrane studio as described in debugging Adobe Lightroom plugins with ZeroBrane Studio - ZeroBrane , but can not get Lightroom to load mobdebug.lrmodule.)


Can someone point out where I'm wrong?

Thank you.


require "strict.lua" - catch some incorrect variable names

require "Develop_Params.lua" - global table to develop params, we must observe

local LrApplication = import "LrApplication".

local LrApplicationView = import "LrApplicationView".

local LrDevelopController = import "LrDevelopController".

local LrFunctionContext = import "LrFunctionContext".

local LrSelection = import "LrSelection".

local LrShell = import "LrShell".

local LrSocket = import "LrSocket".

local LrTasks = import "LrTasks".

local LrUndo = import "LrUndo".

-File-local Consts

local RECEIVE_PORT = 58763

local SEND_PORT = 58764

local PICKUP_THRESHOLD = 4

-File-local vars

Local CopyUUID

local settings

local LAST_PARAM = "

local PARAM_OBSERVER = {}

local PICKUP_ENABLED = true

Local SERVER = {}

-File-local work statements, advance declared to allow him to be in the scope of all calls.

-When you define previously stated function, DO NOT USE local KEYWORD once again, it will define another local function.

-These statement are intended to overcome certain Lua gotcha.

local applySettings

local copySettings

local develop_lerp_to_midi

local midi_lerp_to_develop

local pasteSettings

local processMessage

local sendChangedParams

local startServer

local updateParam

LOCAL = {}

['DecrementLastDevelopParameter'] is function () LrDevelopController.decrement (LAST_PARAM) end.

["VirtualCopy"] = function () LrApplication.activeCatalog ():createVirtualCopies() end,

['ToggleScreenTwo'] = LrApplicationView.toggleSecondaryDisplay,

['CopySettings'] = copySettings,

['PasteSettings'] = pasteSettings,

}

local TOOL_ALIASES = {}

["Magnifying glass"] = "magnifying glass."

["CropOverlay"] = "crop."

["SpotRemoval"] = "dust."

["Red eye"] = "red eye."

["GraduatedFilter"] = "degraded."

["RadialFilter"] = "circularGradient."

["AdjustmentBrush"] = "localized,"

}

local SETTINGS = {}

["Pick-up"] = function (enabled) PICKUP_ENABLED = (activated == 1) end.

}

function copySettings()

local photo = LrApplication.activeCatalog (:getTargetPhoto())

parameters = photo: getDevelopSettings()

end

function pasteSettings()

applySettings (settings)

end

function midi_lerp_to_develop (param, midi_value)

-map range from midday to develop the range of parameter

local min, max = LrDevelopController.getRange (param)

-If (param == 'Température') then

-min = 3000

-max = 9000

-end

local result = midi_value/127 * (max - min) + min

Returns the result

end

function develop_lerp_to_midi (param)

-map develop parameter range range midi

local min, max = LrDevelopController.getRange (param)

-If (param == 'Température') then

-min = 3000

-max = 9000

-end

local result = (LrDevelopController.getValue (param) - min) /(max-min) * 127

Returns the result

end

function updateParam (param, midi_value)

-This function performs a "Pick-up" check type

-in other words, it will ensure the setting is close to develop

-in what order entered value is before updating

If LrApplicationView.getCurrentModuleName () ~ = 'develop' then

LrApplicationView.switchToModule ('develop')

end

If ((not PICKUP_ENABLED) or (math.abs (midi_value - develop_lerp_to_midi (param)) < = PICKUP_THRESHOLD)) then

PARAM_OBSERVER [param] = midi_lerp_to_develop (param, midi_value)

LrDevelopController.setValue (param, midi_lerp_to_develop (param, midi_value))

LAST_PARAM = param

end

end

function applySettings (set) - still experimental

If LrApplicationView.getCurrentModuleName () ~ = 'develop' then

LrApplicationView.switchToModule ('develop')

end

for x, v to peers (set)

-SERVER: send (string.format ("%s % d\n", x, develop_lerp_to_midi (v) "))

-PARAM_OBSERVER [x] = v

LrDevelopController.setValue (x, v)

end

end

-message processor

function processMessage (message)

If (message) type == 'string' then

-messages are in the format 'param value '.

local _ param, value = string.find (message, '(%S+) %s(%d+)')

If (ACTIONS [param] ~ = nil)-perform an action time

If (ToNumber (value) == 127) then ACTIONS [param] (end)

Else if (param:Find('Reset') == 1) then - reset other than those explicitly encoded in the ACTION items table

If (ToNumber (value) == 127) then LrDevelopController.resetToDefault (param end:sub(6))

Else if (param:Find('SwToM') == 1) then - perform a switch to the module

If (ToNumber (value) == 127) then LrApplicationView.switchToModule (param end:sub(6))

Else if (param:Find('ShoVw') == 1) then - change the display mode of the application

If (ToNumber (value) == 127) then LrApplicationView.showView (param end:sub(6))

Else if (param:Find('ShoScndVw') == 1) then - change the display mode of the application

If (ToNumber (value) == 127) then LrApplicationView.showSecondaryView (param end:sub(10))

ElseIf (TOOL_ALIASES [param] ~ = nil) then - switch to the desired tool

If (ToNumber (value) == 127) then

If (LrDevelopController.getSelectedTool () == TOOL_ALIASES [param]) then - switch between the tool/Magnifier

LrDevelopController.selectTool ('magnifying glass')

on the other

LrDevelopController.selectTool (TOOL_ALIASES [param])

end

end

ElseIf (PARAMETERS [param] ~ = nil) then

Settings [param] (ToNumber (value))

else - otherwise update a development parameter

updateParam (param, tonumber (value))

end

end

end

-Send settings changed to MIDI2LR

function sendChangedParams (Observer)

for param in ipairs (DEVELOP_PARAMS), __________

If (Observer [param] ~ = LrDevelopController.getValue (param)) then

SERVER: send (string.format ("%s % d\n", param, develop_lerp_to_midi (param) "))

Observer [param] = LrDevelopController.getValue (param)

LAST_PARAM = param

end

end

end

function startServer (context)

SERVER = {LrSocket.bind}

functionContext = context,

plugin = _PLUGIN,

port = SEND_PORT,

mode = "send."

onClosed = function (socket) - this callback seems never called...

-MIDI2LR closed the connection, allow reconnection

-socket: reconnect()

end,

onError = function (socket, err)

Socket: reconnect()

end,

}

end

-Main task

LrTasks.startAsyncTask (function()

LrFunctionContext.callWithContext ("socket_remote", function (context)

LrDevelopController.revealAdjustedControls (true) - parameter reveal touched in the process of Panel

-Add an observer to develop changes to the param

LrDevelopController.addAdjustmentChangeObserver (context, PARAM_OBSERVER, sendChangedParams)

local client = {LrSocket.bind}

functionContext = context,

plugin = _PLUGIN,

port = RECEIVE_PORT,

mode = "receive."

onMessage = function (socket, message)

processMessage (message)

end,

onClosed = function (socket)

-MIDI2LR closed the connection, allow reconnection

Socket: reconnect()

-call SERVER: reconnect causes LR to hang for some reason any...

SERVER: close()

startServer (context)

end,

onError = function (socket, err)

If err is 'timeout' then - reconnect if expired

Socket: reconnect()

end

end

}

startServer (context)

While true

LrTasks.sleep (1/2)

end

client: close()

SERVER: close()

end)

end)

LrTasks.startAsyncTask (function()

If (WIN_ENV) then

LrShell.openFilesInApp ({_PLUGIN.path..' / Info.lua'},.. _PLUGIN.path' / MIDI2LR.exe')

on the other

LrShell.openFilesInApp ({_PLUGIN.path..' / Info.lua'},.. _PLUGIN.path' / MIDI2LR.app')-on Mac, it seems that the argument of files must include an existing file

end

end)

This may be a correct way, it seems to work

local settings

function copySettings()

LrTasks.startAsyncTask (function)

local photo = LrApplication.activeCatalog (:getTargetPhoto())

parameters = photo: getDevelopSettings()

end)

end

function pasteSettings()

If the parameters ~ = nil then

LrTasks.startAsyncTask (function)

Catalog = LrApplication.activeCatalog)

Catalog: withWriteAccessDo ('pasteSettings', function()

local photo = catalogue: getTargetPhoto()

Photo: applyDevelopSettings (Settings)

end)

end)

end

end

Tags: Photoshop Lightroom

Similar Questions

  • How to copy a file from one folder to another?

    Windows 7, my images: how to COPY a file from one folder to another?

    Right-click on the file and drag it to the other folder. Release the button on the right and click on copy here.

  • How to copy a layer from one psd to another

    How to copy a layer from one psd to another

    Select... Select all, Ctrl + C to copy the contents to the Clipboard, and then in the other PSD image use Ctrl + V to paste the content in its own layer.

    Ken

  • How can I transfer Media Player Playlists and settings from one computer to another?

    How to transfer on sides from one computer to another?
    I use windows media player to work... I'm getting a new computer... I worked hard to rate/organize my music into playlists, etc... How can I transfer this information to my new computer?

    Hi Kristylundahl,

    You can use Windows easy transfer to transfer files and settings from one computer to the other. There is no way to transfer just the playlist of media
    settings to another computer. With the help of windows easy transfer, you can move your music, playlists, and album art files to another computer.

    For more information, see these links:

    Windows Easy transfer of :
    http://Windows.Microsoft.com/en-us/Windows7/products/features/Windows-easy-transfer  

    Transfer files and settings from another computer:
    http://Windows.Microsoft.com/en-us/Windows7/transfer-files-and-settings-from-another-computer

    Kind regards
    Amal-Microsoft Support.
    Visit our Microsoft answers feedback Forum and let us know what you think.

  • Copy some files from one user to another

    Hello!

    How can I copy (not share) some files from one user to another?

    The reason for this is because we rename users to other allocation model.

    Thank you!

    You must share the folders you want to transfer the ownership of the new username, or one responsibility that the new user has (I guess that's an Oracle Applications EUL). The user connects to Discoverer more with their new name. They open the workbook (s) and then do a SAVE AS. Who will save the workbook with them as the new owner. You must then sign with the old name of the owner and to delete these old files (after the first backup them) once you are sure that everything works fine. Yes, it is a nasty process. What we do is we use a "dummy" username when we create/modify the workbooks. In this way the fictional user name is the owner of the workbooks. So, it does not matter if a person leaves or if you change the user naming conventions. If you have many users to create cabinets, then a dummy user name doesn't quite work. You could always submit an enhancement request to Oracle for a copy function. I hope that you will get a lot of customers to support such a request.
    John Dickey

  • Is there a way to copy the capture from one photo to another time?

    I recently re-scanning of pictures that were original scanned a few years ago. Giving them the same name as the previous scanned (only with a _1 at the end), I import the newly scanned photo in the same folder (which is how to organize my photos), to be able to compare and then copy the metadata from the initial analysis to the latter. As I did not yet all signs or notation, most metadata will contain only keywords. But stored under "Metadata" in the view library, 'Capture time' is also stored, but I can't in any case among the options "copy of the metadata. Is there something that I missed, or is there a work-around somewhere?

    Thanks in advance-

    OLE K

    Hi Ole,

    You cannot copy, but edit:

    In the menu goto of the metadata module library - change the Capture time.

    If you have multiple images selected when you choose this command, you set the active image to what you enter as 'date and time specified' and others will be adjusted by the same increment. Decrement in your case, as I suppose.

    So if you want it to be exactly identical to that of the old scan, you must do it one by one for each new analysis.

    Cornelia

  • I have a Setup dual monitor.  When I paste develop settings from one image to the other, Lightroom going on the active window.

    Strange problem.  5.5 Lightroom.  Windows 8.1. Setting up dual monitor.

    I am processing a lot important photos.  I have #1 monitor set as my main to develop the window with #2 monitor configured only to display a larger version of the image, I work with. If I copy the parameters of development out of a picture and try to paste them on another image, Lightroom will increase from the #1 to the monitor #2 monitor in the main window to develop and does not display anything on the monitor #1.

    If I then try to paste develop settings on another image on the monitor #2, LR then displays a larger version of the image, I have been working with the #1 monitor.

    To work like I want to, I have to constantly drag my develop the window back to the #1 monitor whenever I try to paste the settings on a new image of development. How can I make this stop?

    I have similar (but different) problems dual monitor. Just posted this on my thread unanswered. It may be useful:

    Blessed excrement! After frustrating months of bi-ecrans LR questions and a month of waiting for an answer on this forum, I called Adobe technical support. Only five minutes before dialing, I had updated my PhotoShop CC application. When the useful Adobe tech classmate is online, I can't reproduce all the issues that had been plaguing me. It is a stretch... a biiiiig stretch... but he is feels/figure/seems that PhotoShop CC update has fixed my bi-ecrans LR problems! I'll keep track of what other programs I use and open while LR - ing to see if they are relaxing, but for now, everything is quite in front of two monitors.

  • How can I audio copy and paste from one slide to another in 8 Captivate?

    When I try to copy a bit of audio from one side to the other, I copy and paste, but it doesn't work.  Should be simple, but I was not able to understand.

    Thank you

    Captivate allows you to edit audio files in a certain extent, but you must make sure that you are in the EDIT Audio dialog box tab drag, not the tab add/replace.

    You can't cut and paste a piece of audio from a slide to another using this dialog box.  You can only copy and paste audio part of the audio clip to another part of the same clip.  In order to combine audio from a separate clip you must insert the whole clip and then cut out the pieces you want.  Tedious, I agree, but it's like that.  If you have the creative cloud Adobe, Adobe Audition to edit your clips outside Captivate.

  • Copy a file from one computer to another

    Hi all

    I am trying to copy a file from a computer (where I program CVI) to another computer on the same network. How do I do? Can I use library functions plug supplied by C or y at - it of the other libraries available in labwindows?

    Thank you

    Kanu

    CopyFile () in the library of the utility accepts UNC paths, so you can do something like this:

    CopyFile ("MyFile.txt", "\\\remotePC\\remoteFolder\\myfile.txt");

    Avoid conflicts between this function and the corresponding Windows API function with the same name: read the online help for explanations.

    Simpler is better, don't you think?

  • I got a virus, tried to remove it and now I get missing ntfs.sys, I don't have the windows xp cd, anyone know how to copy this file from one pc to another system

    The virus was called MS works, it disquises himself as a virus scanner who want you tho sign up to buy, basically a scam phishing for personal information.  The ntfs.sys file has been deleted by mistake, and we do not have the windows cd.  That I can download the file somewhere or I can copy form one pc to another?

    Hello BarbaraFain,

    Take a look at the following article:

    http://www.Microsoft.com/security/PC-security/antivirus-rogue.aspx

    Best regards

    Matthew_Ha

  • How to transfer files and settings from one computer to another?

    Original title: transfer user

    How can I transfer (acct users) all programs and files frm lptp one to anther?

    Hi shannonprovence,
     
    -What version of the operating system is installed on the other computer/laptop?
     
    Here are some articles that will help you transfer files and settings:
     
     
     
    If the migration from Windows XP to Windows 7, see:
     
  • How to copy a library from one user to another account in Windows 7

    In order to solve a problem in the installation of a new printer, the only solution that support Microsoft could find was to create another user account. They were certainly intended to copy all libraries to this account - My Documents is certainly there--but my images is not. Would appreciate advice on how to correct this problem. My intention is to delete the original user account that I am satisfied I will not lose anything.

    AAMT

    Log on to an account with "Administrator" privileges  You will be able to access the files from the old account and create your new account.

    It is not clear if you say that your new account doesn't have a 'My pictures' folder or if the folder my pictures in your new account is empty.

    If your new account doesn't have a folder my pictures, then proceed as follows:

    1. Click the start ORB, click computer.
    2. Go to C:\Users\
    3. You should see something like the following (you will probably see all these folders):
    4. Click on my images to select
    5. Click on the Edit menu, then click on "Copy to folder".
    6. In the window "Copy items" that appears, go to C:\Users\ and select this are you the folder with your username shows in the 'File' window
    7. Click on the button 'copy '.
    8. Once the copy operation, confirm that your new account now has a folder my pictures, and that all your photos are in.  Then go back and erase the contents of the folder my pictures in your old account.

    If your new account contains the folder my pictures, but this folder is empty:

    1. Click on the start ORB, then click on computer
    2. Navigate to\My Pictures C:\Users\
    3. Click anywhere in the right pane of Windows Explorer (where are the photo files/folders), and then click Edit > select all (or press CTRL + A) and edit > copy (or press CTRL + C)
    4. Navigate to\My Pictures C:\Users\
    5. Click anywhere in the right pane of Windows Explorer (the empty window), then click Edit > paste (or press CTRL + V)
    6. Once you confirm that all your images are in the folder my pictures of your new account, go back and erase the contents of the folder my pictures in your old account.
  • How can I mirate Firefox settings from one user to another

    10 worthless Windows installed with a corrupt user profile and I had to create another. I just want to get my Firefox user profile settings to the other. There should be an easy way to do this that I've just not found it. Can you please point me in the right direction?

    https://support.Mozilla.org/en-us/KB/recovering-important-data-from-an-old-profile

    https://support.Mozilla.org/en-us/KB/back-and-restore-information-Firefox-profiles

  • Copy & install fonts from one computer to another

    With previous Windows operating systems, it was easy to copy a font to a computer and install it on another.  Not the same with Windows 7.  Or maybe I just have forgatten how I used to do.  All suggestions welcome.

    Assuming that OTF or TTF files for fonts:

    Navigate to the folder/directory containing the font files. Highlight the names of file in the usual way. Copy it to a flash drive. Wait for the copy complete. Remove the flashrdrive from the source computer and connect to the destination computer. Search for police files and highlight the right click of the mouse and select install from the pop-up menu.

    There are other ways. For example, if both computers are on the same network:

    Navigate to the folder/directory containing the files. Highlight the names. Right mouse click on and select install from the pop-up menu.

    Tom Ferguson

  • "" In windows 7 "library &#62; Documents ', how copy a Word from one folder to another document

    When I right click the icon of the document within a document library folder, the options are 'copy' - but I want to send the copy to another folder and it doesn't seem to be a way to run the copy to another folder.

    How do I do that? How to copy a file Word document A to folder B, without having to go to the trouble to open the Document in Word and do "Save as"?

    Thanks for your help!

    [Transferred from Internet Explorer]

    Hello

    After you have copied the document, open the destination folder and paste the document in this folder.

    Don

Maybe you are looking for

  • Password page

    I have a new PC HP Pavilion p6610f, w / Windows 7 Home Premium 64-bit. I set up the login page to use without password, simply click on my icon to enter.  Problem is, I can work on any program, e-mail, etc & my pc will appear on this page of connecti

  • Error-20003 of curve non linear adjustment LM with a VI curve as a good model

    Hello I was stuck for a while now, by an error when I use the non-linear curve mount LM with a VI as the model curve adjustment. The code error is-20003, and occurs in the "LM get new coefficients ' vi and analysis, said"the number of samples must be

  • Local IP address

    I want to put my local ip in the DMZ on my Linksys EA6350 so people will be able to access my files via a program called Soulseek could someone help me to do this

  • Dc7600 card mother bip

    The beeps of motherboards are as follows "beep... beep beep beep... beep beep... beep beep... beep beep." So a total of 5 cycles. On the manual which is here is saying beep 5 cycles, each beepnig is twice a memory error. But he also says that the bee

  • How to remove screen blurryness

    Hello guys. I have a problem whenever I change my VGA cable. The screen goes fuzzy with nuances and everything that makes it too bad to see the desktop. I tried many things, but none of them worked. I would be very happy if someone could help me with