Copier le lien dans le Presse-papiers
Copié
While we're waiting for the SDK docs, I scanned for functions, methods, and properties not documented in the LR 4 SDK. Here's what I found:
LrCatalog
Methods:
assertHasReadAccess
buildSmartPreviews (array of LrPhoto)
createPublishService
createVirtualCopies
getPhotoByLocalId
withReadAccessDo
Properties:
allPhotos
hasCatalogAccess
hasReadAccess
hasWriteAccess
path
targetPhoto
targetPhotos
LrCollection
Methods:
getSearchDescription
LrController
nextPhoto
previousPhoto
showBezel
showGrid
showLoupe
startSlideshow
stopSlideshow
triggerCapture
LrDialogs
closeFloatingDialogsForPlugin
presentFloatingDialog
presentWebViewDialog
showBezel (string message, [number fadeDelay])
showStringsDialog
LrDigest
HMAC
MD4
MD5
SHA1
SHA256
SHA384
SHA512
LrLogger
Methods:
configure
restoreConfiguration
saveConfiguration
wrapMethodWithTrace
wrapMethodsWithTrace
Properties:
_actions
_name
_savedConfigurations
will_debug
will_error
will_info
will_trace
will_warn
LrPhoto
Methods:
applyDevelopSnapshot
buildSmartPreview
deleteDevelopSnapshot
deleteSmartPreview
getDevelopSnapshots
locationIsPrivate
readMetadata
requestJpegThumbnail
saveMetadata
withSettingsForPluginDo
Properties:
countStackInFolderMembers
countVirtualCopies
isInStackInFolder
isVirtualCopy
localIdentifier
masterPhoto
path
stackInFolderIsCollapsed
stackInFolderMembers
stackPositionInFolder
uuid
virtualCopies
LrPhotoPictureView
makePhotoPictureView
LrPlugin
nativeFunction
LrPublishService
delete
getAllRemoteIds
promptEditDialog
LrPublishedCollection
Methods:
getSearchDescription
publishSelected
setSearchDescription
LrPublishedCollectionSet
Methods:
delete
LrPublishedPhoto
Methods:
getDevelopSettingsDigest
getMetadataDigest
LrTableUtils
debugDumpTable
LrUUID
generateUUID
LrView
Methods:
path_control
square_button
LrXml
xmlElementToSimpleTable
I didn't examine the classes LrExportContext, LrExportRendition, LrExportSession, LrExportSettings, LrFilterContext, LrVideoExportPreset, LrWebViewFactory.
Copier le lien dans le Presse-papiers
Copié
That would open some doors .
~R.
Copier le lien dans le Presse-papiers
Copié
Direct native calls would need some more boilerplate (for pointers, callbacks). Of course it could be some kind of lua library loader, but I wouldn't count on that either. It would be easier to enable standard lua native libraries, if Adobe really wanted to support native code.
Perhaps it is a way to call Lightroom internal functions from a plugin?
Jarno
Copier le lien dans le Presse-papiers
Copié
Maybe it's some kind of LR-specific method for loading a Lua extension module.
Perhaps it is a way to call Lightroom internal functions from a plugin?
Perhaps, but structurally it would be a little curious to locate it as a method of LrPlugin, rather than, say, LrApplication.
However, there is only one occurrence of the string "nativeFunction" in all the Windows files, so it's not used by other parts of LR (e.g. by the tethering plugins). Perhaps it's not fully implemented.
Copier le lien dans le Presse-papiers
Copié
I figured out how to use LrPlugin.nativeFunction to instantiate LuaSocket:
local LrApplication = import "LrApplication"
local msg = LrApplication.activeCatalog():getPath()
local luasocket = _PLUGIN:nativeFunction("luaopen_socket_core")
local core = luasocket()
local socket = core.udp()
socket:sendto(msg, '224.0.0.1', 7777)
socket:close()
(This will send a UDP multicast packet, which can be received on OSX with netcat utility: nc -u -l 7777)
LuaSocket is used in socket.lrmodule, and I found out that it is just plain lua dynamic library by running:
nm ./Contents/PlugIns/socket.lrmodule/Contents/MacOS/socket
If anyone figures out how to load your own Lua extensions from installable plugins, I'm interested
Copier le lien dans le Presse-papiers
Copié
Woah - this could open some doors (of course Adobe may shut them next rev) - thanks for posting Jarno.
How did you figure out the parameter to pass?
~R.
Copier le lien dans le Presse-papiers
Copié
Like I said, I noticed that socket.lrmodule had actually binary with standard LuaSocket exports, and I just tried it... At first, I tried passing a filename, but since there was no file access (I used dtrace to investigate), I figured it must be something else
Copier le lien dans le Presse-papiers
Copié
Hmm, actually the same code doesn't work on my other laptop... maybe there is something in one of my installed plugins that allows loading socket library?
Copier le lien dans le Presse-papiers
Copié
Anybody have a clue about 'showStringsDialog'?
Copier le lien dans le Presse-papiers
Copié
It appears to display a dialog with a scrollable list of strings:
LrFunctionContext.callWithContext ("test", function (context)
LrDialogs.showStringsDialog {
title = "Test Strings Dialog",
strings = {"line 1", "line 2", "line 3"},
cancelVerb = "Stop!"}
end)
May be unfinished (and thus undocumented) -- the "title" and "cancelVerb" parameters are ignored.
Copier le lien dans le Presse-papiers
Copié
Thanks John.
It would be great if it was possible to have different fonts etc. for different strings.
I mean, in the simplest case, one can accomplish the same thing (pretty much) via a scrolled_view of a static_text view.
R
Copier le lien dans le Presse-papiers
Copié
photo:deleteDevelopSnapshot - used to work, but doesn't anymore (granted, it was never documented).
To be clear: @Lr5.3RC, the function still exists, executes, and says it worked, but no snapshots are actually deleted.
In original Lr5 version(s), beta and 5.0 anyway, the function worked, if Lr in develop module (not library module).
Copier le lien dans le Presse-papiers
Copié
Differences in master vs. virtual copy, snapshot-wise:
local masterPhoto = virtualCopy:getRawMetadata( 'masterPhoto' )
local snaps = masterPhoto:getDevelopSnapshots() -- gets master and virtual copy snapshots
virtualCopy:getDevelopSnapshots() -- NEVER works.
virtualCopy:deleteDevelopSnapshot( snap[1].id_global ) -- NEVER works.
masterPhoto:deleteDevelopSnapshot( snap[1].id_global ) -- always works in develop module (do not use snapshotID, which only sometimes works).
virtualCopy:createDevelopSnapshot( name ) -- works in develop module, but always creates a new snapshot (even if name already exists).
virtualCopy:createDevelopSnapshot( name, true ) -- ditto, so pre-delete in separate with-do func to re-create/update.
~R.
Copier le lien dans le Presse-papiers
Copié
Just noticed these methods never made it into SDK 5 doc:
* photo:saveMetadata
* photo:readMetadata
Subject to certain caveats, these methods do seem to work, and I'm using them in released plugins.
Anybody else have any experience/problems with them?
Thanks,
Rob
Copier le lien dans le Presse-papiers
Copié
Hi,
I was trying to get HMAC working for my Lightroom plugin but there was no luck
I coould not find any reference to HMAC functions.
There is only MD5 which is given is SDK
local LrMD5 = import 'LrMD5' -- assign namespace to local variable
local digest = LrMD5.digest( 'some string' ) -- call "digest()" function in namespace
Does anybody know how to use the HMAC functions?
Thanks
Copier le lien dans le Presse-papiers
Copié
A little poking around suggests how to use LrDigest:
d = LrDigest.SHA256.digest ("Hello world")
d => "64ec88ca00b268e5ba1a35678a1b5316d212f4f366b2477232534a8aeca37f3c"
x = LrDigest.SHA256.init ()
x:update ("Hello ")
x:update ("world")
d = x:digest ()
d => "64ec88ca00b268e5ba1a35678a1b5316d212f4f366b2477232534a8aeca37f3c"
Copier le lien dans le Presse-papiers
Copié
Hi john,
I really appreciate the quick response and I have been struggling with this for a few days. Your example above works perfectly.
This is what I did
local sha = import 'LrDigest'
d = sha.SHA256.digest ("Hello world")
My requirement is to do HMAC
if you do this in PHP you do like this
$genarated_hmac = hash_hmac("sha256",'string input','private key');
I tried this in my Lua plugin file but it crashed the plugin
This is what I did
local sha = import 'LrDigest'
d2 = sha.HMAC.digest ('SHA256', 'test1','test2')
I was shooting in the dark as there was no reference I could use.
Please help me if you can.
Thanks heaps again
Copier le lien dans le Presse-papiers
Copié
I didn't know what HMAC is, so I looked it up at Wikipedia, hoping to find some clues about how to use LrDigest.HMAC. But I didn't make any progress. It would seem that you need to specify a hash algorithm to HMAC, e.g. SHA256 or MD5, as well as a key. In Lua, it would be more likely that you pass an actual function, e.g. LrDigest.MD5.digest, rather than a string like "MD5". But I couldn't figure out the magic sequence. Sorry...
Copier le lien dans le Presse-papiers
Copié
Hi John,
Thank you for trying. Appreciate it
Cheers
Trouvez plus d’idées, d’événements et de ressources dans la nouvelle communauté Adobe
Explorer maintenant