• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
1

P: SDK: LrView.bind (key) fails when "key" contains a period

LEGEND ,
Jan 16, 2022 Jan 16, 2022

Copy link to clipboard

Copied

LrView.bind (key) creates a non-working binding when "key" contains a period. To reproduce, install this plugin:

https://www.dropbox.com/s/fhx9521z9re47ro/bind-bug.lrdevplugin.2022.01.16.zip?dl=0 

 

and then do File > Plug-in Extras > Bind Bug. That will produce this window:

johnrellis_0-1642390331924.png

 

The first checkbox should be unchecked (white), not in the mixed state (hyphen).  Tested on LR 11.1 / Mac OS 11.6.2.

 

Just one more SDK bug to work around.

 

Here's the script for the Bind Bug command:

 

local LrBinding = import "LrBinding"
local LrDialogs = import "LrDialogs"
local LrFunctionContext = import "LrFunctionContext"
local LrView = import "LrView"

local bind = LrView.bind
local f = LrView.osFactory()

local key1 = "x.y"
local key2 = "x_y"

LrFunctionContext.callWithContext ("main", function (context)
    local prop = LrBinding.makePropertyTable (context)
    prop [key1], prop [key2] = false, false
    assert (prop [key1] == false)
    assert (prop [key2] == false)
    LrDialogs.presentModalDialog {title = "Bind Bug", 
        contents = f:column {bind_to_object = prop,
            f:checkbox {title = "Key " .. key1, value = bind (key1)},
            f:checkbox {title = "Key " .. key2, value = bind (key2)}}}
    end)

 

 

Bug Fixed
TOPICS
macOS , SDK

Views

1.0K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 2 Correct answers

Adobe Employee , Jun 14, 2022 Jun 14, 2022

Greetings,

 

The SDK will be updated later this week (June 13). The update contains a fix for this issue.  Please download and the latest version of your application via the Adobe Creative Cloud Application or your respective device app store.

If you do not see the update (Mac and Win) you can refresh your Creative Cloud App with the keyboard shortcut [Ctrl/Cmd]+[Alt/Opt]+[ R ]. 

 

Note: App store availability can take several days for the update to appear and be available. 

 

Thank you for your

...
Status Fixed

Votes

Translate

Translate
Adobe Employee , Jan 17, 2022 Jan 17, 2022

Setting status - adding bug number

Status Started

Votes

Translate

Translate
3 Comments
Adobe Employee ,
Jan 17, 2022 Jan 17, 2022

Copy link to clipboard

Copied

Setting status - adding bug number

Rikk Flohr - Customer Advocacy: Adobe Photography Products
Status Started

Votes

Translate

Translate

Report

Report
Adobe Employee ,
Jun 14, 2022 Jun 14, 2022

Copy link to clipboard

Copied

Greetings,

 

The SDK will be updated later this week (June 13). The update contains a fix for this issue.  Please download and the latest version of your application via the Adobe Creative Cloud Application or your respective device app store.

If you do not see the update (Mac and Win) you can refresh your Creative Cloud App with the keyboard shortcut [Ctrl/Cmd]+[Alt/Opt]+[ R ]. 

 

Note: App store availability can take several days for the update to appear and be available. 

 

Thank you for your patience.

Rikk Flohr - Customer Advocacy: Adobe Photography Products
Status Fixed

Votes

Translate

Translate

Report

Report
LEGEND ,
Jun 17, 2022 Jun 17, 2022

Copy link to clipboard

Copied

LATEST

This was only partially fixed. The behavior is "as designed", but it was (and still is) undocumented in the API Reference for LrView.bind().

 

The Lightroom Classic Programmers Guide has been updated on page 98 with this sentence:

 

"The keys in the table are treated as “.” (dot/period) separated hierarchical key-value pairs, e.g. a key such as x.y would bind with the key y in the table bound to key x."

 

The API Reference documentation for LrView.bind() should be similarly updated:

 

"key (string) A key name for the observed property. If the key is of the form x.y, it references to the key y in the table bound to key x."

 

Here's a modified bind-bug.lua for the plugin above that illustrates the behavior:

 

 

local LrBinding = import "LrBinding"
local LrDialogs = import "LrDialogs"
local LrFunctionContext = import "LrFunctionContext"
local LrView = import "LrView"

local bind = LrView.bind
local f = LrView.osFactory()

LrFunctionContext.callWithContext ("main", function (context)
    local prop = LrBinding.makePropertyTable (context)
    prop ["x.y"], prop.y, prop.z = false, false, {a = false}
    LrDialogs.presentModalDialog {title = "Bind Bug", 
        contents = f:column {bind_to_object = prop,
            f:checkbox {title = "Key x.y", value = bind "x.y"},
            f:checkbox {title = "Key y", value = bind "y"},
            f:checkbox {title = "Key z.a", value = bind "z.a"}}}
    assert (prop.z.a == true)
    assert (prop.y == true)
    assert (prop.x == true)
    end)

 

Votes

Translate

Translate

Report

Report