Lightroom SDK: catalog:addPhoto() clears Library filter on Windows

  • 1
  • Problem
  • Updated 1 year ago
catalog:addPhoto() incorrectly clears the current Library filter with LR CC 2015.10.1 / Windows 10. This does not happen on OS X 10.12.5, nor does it happen with LR 5.7.1 / Windows 10.

To reproduce:

1. Set a Library filter, e.g. with the preset Default Columns.

2. Run the following script:
local LrTasks = import "LrTasks"
local catalog = import "LrApplication".activeCatalog ()
local path = MAC_ENV and [[//users/john/desktop/test pics/a1.jpg]] or
    [[\\mac\home\desktop\test pics\a1.jpg]]
LrTasks.startAsyncTask (function ()
    catalog:withWriteAccessDo ("test", function ()
        catalog:addPhoto (path) end) end)
(Edit the paths to refer to a photo that's not currently in the catalog.)

3. On 2015.10.1 / Windows, note that the filter is cleared.  But on 5.7.1 / Windows and on 2015.10.1 / OS X 10.12, it isn't cleared.

----------------------------------------------
A workaround is for the plugin to restore the view filter after each call to catalog:addPhoto(), but that causes grid view to flicker and jump quite annoyingly when many photos are being added.
Photo of John R. Ellis

John R. Ellis, Champion

  • 3863 Posts
  • 1018 Reply Likes

Posted 1 year ago

  • 1
Photo of Shane Betts

Shane Betts

  • 161 Posts
  • 54 Reply Likes
John, I notice something similar on OSX where I will be working with a "Find" search, narrowed with colour label filters. Whenever I perform an export or, often, when I make the round trip to PS, I come back to all filters cleared. Interestingly, LR remembers the filters, all colour buttons are still highlighted and, when command-F is typed, the search parameters are still there, the Library view just disregards them, meaning you have to come back from those operations, type command-F, return and then double click on one of the colour selectors to return the interface to it's previous state. Annoying.
Photo of John R. Ellis

John R. Ellis, Champion

  • 3848 Posts
  • 1011 Reply Likes
Windows or Mac?
Photo of Shane Betts

Shane Betts

  • 161 Posts
  • 54 Reply Likes
"I notice something similar on OSX" Mac.
Photo of John R. Ellis

John R. Ellis, Champion

  • 3848 Posts
  • 1011 Reply Likes
Duh, thanks.
Photo of Shane Betts

Shane Betts

  • 161 Posts
  • 54 Reply Likes
:-)