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

Showing a list of photos

Engaged ,
Dec 11, 2018 Dec 11, 2018

Copy link to clipboard

Copied

I have a set of photos, a table of LrPhotos, scattered around the catalog. What's the best way of programmatically showing them all in a grid view. I've messed with Catalog:setViewFilter() but if that's the way it's lack of documentation is defeating me. And thoughts?

TOPICS
SDK

Views

393

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
LEGEND ,
Dec 11, 2018 Dec 11, 2018

Copy link to clipboard

Copied

There are two straightforward methods, setting a view filter and using a collection.

To figure out how to set a view filter, set a sample filter in the user interface. Then dump out the results of catalog:getCurrentViewFilter() to see how the filter is represented.  I have several plugins that set view filters, and that's how I figured out how to do it. For this approach, you need some way of uniquely identifying the photos to be displayed. If that can't be done using existing metadata fields, then you'll have to set a custom metadata field to have a unique value (e.g. LrDate.currentTime()) and then set the view filter to have that custom field as a column, with the unique value selected. (See my Any Filter plugin for an example of this.)

To create a collection, use catalog:createCollection() and collection:addPhotos(). Use catalog:setActiveSources() to change the current source to that collection and cause it to be displayed to the user.

The methods have their pros and cons.  View filters let the user "intersect" the filter with different sources (folders and collections), but I know from long experience with my Any Filter plugin that many users don't really understand view filters and get confused when they see the Library Filter bar in action.

While users generally understand collections, it's not easy for most users to "intersect" a collection with another collection or folder (if that's important here).  Also, LR has long had a performance bug, where the time for a plugin to create or delete a collection is proportional to the square of the number of photos it contains -- this only becomes noticeable when you have very large collections with thousands of photos.  With the view-filter method, the time to display N photos is strictly proportional to N, whereas it's N^2 for collections.

Votes

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
LEGEND ,
Dec 13, 2018 Dec 13, 2018

Copy link to clipboard

Copied

LATEST

Here's a previous post explaining the bad n-squared behavior for deleting photos from a collection:

Re: Lightroom slow deleting collection set. Advice?

Votes

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