15 Replies Latest reply on Jul 2, 2015 5:33 PM by MasterDomino

    Forum for plugin development?

    jan_ekholm

      Is there a specific forum or place where plugin development is discussed? This forum seems to be mostly about using existing plugins.

       

      What I'm trying to do is import about 10 years of photos into Lightroom from an old home grown photo management application. I can

      export the data from that application into any form necessary, but need to write a small plugin to do the final import into Lightroom. My

      plugin would not be of general interest, but I could publish it on, say, Github if someone is interested. I tried to look at the Aperture/iPhoto

      import plugin for ideas, but all the Lua files are scrambled (wtf is up with that, why?) and pretty much useless to me.

       

      I'm new to Lua and Lightroom plugins, but otherwise a fairly experienced software developer. I have the SDK v5.0 and all the docs, but

      look for a place where I could get help with troubleshooting things.

        • 1. Re: Forum for plugin development?
          Dave Merchant MVP & Adobe Community Professional

          Moved to the Lightroom SDK forum

          • 2. Re: Forum for plugin development?
            john beardsworth Adobe Community Professional & MVP

            Look up the plugin LrTransporter.

            • 3. Re: Forum for plugin development?
              jan_ekholm Level 1

              Thanks, I knew there had to be a better place that the general forum.

              • 4. Re: Forum for plugin development?
                jan_ekholm Level 1

                Not sure that plugin does what I want. Seems to be about batch importing flat images into the main catalog? In my case I have a large hierarchy of what in LR will be collection sets and collections of photos and I want to import those too along with sometimes extensive descriptive meta data that does not really work in a CSV file.

                • 5. Re: Forum for plugin development?
                  johnrellis Most Valuable Participant

                  I tried to look at the Aperture/iPhoto import plugin for ideas, but all the Lua files are scrambled

                  They're compiled (into bytecodes).  Adobe generally compiles all of its source code, regardless of source language.

                  • 6. Re: Forum for plugin development?
                    johnrellis Most Valuable Participant

                    I agree, LR/Transporter isn't a good fit for what you want.  I don't know of a plugin that can handle hierarchical collections.  But do you really want collections, rather than keywords?  There are many reasons why keywords are better than collections from an organizational and workflow point of view (and LR/Transporter can handle keywords). 

                     

                    If you really want to import your existing structure as collections, I think you'll have to write your own import script.  I ended up doing that to migrate from Photoshop Elements to LR 3, because the Adobe catalog migration didn't move all the metadata and was buggy.   Once you've grokked the core APIs, this isn't very hard, since you don't need to write a UI for the script.

                    • 7. Re: Forum for plugin development?
                      jan_ekholm Level 1

                      I want collections as that's basically what my old application used. I didn't use any keywording/tagging there. Could perhaps use the old hierarchy names as keywords of course, but I'd then have to set up smart collections to be able to easily find a certain party, happening or trip.

                       

                      Btw, can you link to some docs that would explain why keywording is better than using collections? Since I started with LR last fall I have been using keywords heavily, but I don't really see the keywords replacing a good thought out hierarchy of collections. I wish Lightroom allowed collections to have child collections (like the albums in Aperture), now it's impossible to break out a set of images in a given collection into a subcollection (such as "images from the trip I'll show on Facebook"). Not really relevant for this post though.

                       

                      My current idea is to scavenge the docs to find a minimal stub for a Lua plugin and then have my custom written exporter simply generate Lua code that can be added to that plugin. So instead of reading in some JSON, CSV, XML or whatnot I'd have the exporter create ready code. Would mean one or more massively big Lua files with code like:

                       

                      catalog.addPhoto( "/Volumes/.../photos/2001/01/.....jpg" );

                      catalog.addPhoto( "/Volumes/.../photos/2001/01/.....jpg" );

                      ...

                       

                      Personally I'd rather have seen the SDK use some nicer language than Lua, such as Python, but it can't be too hard to grok. The SDK docs sure could use more examples of how the classes are supposed to be used, but my needs are not too advanced.

                      • 8. Re: Forum for plugin development?
                        johnrellis Most Valuable Participant
                        have my custom written exporter simply generate Lua code that can be added to that plugin. So instead of reading in some JSON, CSV, XML or whatnot I'd have the exporter create ready code.

                        Yes, that's what I did.  Very straightforward.

                        • 9. Re: Forum for plugin development?
                          johnrellis Most Valuable Participant
                          Personally I'd rather have seen the SDK use some nicer language than Lua, such as Python, but it can't be too hard to grok. The SDK docs sure could use more examples of how the classes are supposed to be used, but my needs are not too advanced.

                           

                          Lua has a sound principled design that is fairly different from more common languages; it is most similar to Scheme.  I strongly recommend that you spend some time with the reference manual or an introductory book.   Spending four hours reading rather than just diving in goes against the grain of most professional programmers, but I've noticed that in this case, that investment can quickly pay off from avoiding pitfalls and learning Lua-specific idioms.

                          • 10. Re: Forum for plugin development?
                            johnrellis Most Valuable Participant

                            You could start with one of the sample plugins in the SDK, or you could simply load your generated script (which doesn't have a UI) from the undocumented script menu.  Though one of the posters in that thread warns against using the menu, the original poster Rob Cole went on to provide many lightweight scripts (uncompiled, source available) that many people found useful. Unfortunately, Rob's gone missing since January, along with his Web site (I hope he's alright).

                             

                            Note that the Lua debugging environment provided by LR is crippled compared to what the standard features that the Lua library provides.  There's a post somewhere in this forum with instructions for how to attach an IDE's debugger to LR, but I never tried it -- I'm a dinosaur and tend to stay away from the steep learning curves of IDEs.  I have a  more rudimentary debugging toolkit that many have found useful -- it takes a while to set it up and learn, but once you do, it will save you a huge amount of time compared to print statements.  At a very minimum, be sure to use "strict.lua" -- it will find typos and save you hours!

                            • 11. Re: Forum for plugin development?
                              johnrellis Most Valuable Participant
                              Could perhaps use the old hierarchy names as keywords of course, but I'd then have to set up smart collections to be able to easily find a certain party, happening or trip.

                              LR provides some easy, fast mechanisms to filter by keyword.  In the Keyword List panel, if you hover the mouse over a keyword, on the right you'll see a right-arrow appear (next to the photo count).  Click on the arrow and the filter bar will be automatically set to filter just those pics containing the keyword.  In the Keyword column of the filter bar's metadata browser, you can command/ctrl-click additional keywords to get a "boolean or" (photos that contain at least one of the selected keywords).  If you add multiple Keyword columns, then you can get a "boolean and" of the criteria from each Keyword column.

                              Btw, can you link to some docs that would explain why keywording is better than using collections? Since I started with LR last fall I have been using keywords heavily, but I don't really see the keywords replacing a good thought out hierarchy of collections. I wish Lightroom allowed collections to have child collections (like the albums in Aperture), now it's impossible to break out a set of images in a given collection into a subcollection (such as "images from the trip I'll show on Facebook").

                               

                              I don't know of any good references exploring the difference between keywords and collections, though perhaps others do.  But here are my thoughts on the issues:

                               

                              - Collections allow you to provide a custom sort order of their pics, keywords do not.

                               

                              - Keywords are recorded as industry-standard metadata in the photos, which can be (optionally) exported for use in other programs.  Collections are not recorded in the photos' metadata and are pretty much locked inside LR's catalog (though plugins can pry the structure loose).  Many programs and services understand the exported keywords, e.g. Flickr.

                               

                              - Finding all the pics in a single collection is about the same number of clicks in the LR UI as finding all the pics assigned a given keyword (see above).

                               

                              - When searching for photos inside LR, it's far easier to intersect criteria using keywords than collections.  For example, a typical hierarchical keyword structure would have root keywords People, Places, Events.  LR makes it straightforward to find photos with, say, event "John's Birthday", place "San Mateo", and people "Jane" or "John".    While it's possible to intersect collections in LR using smart collections, it's far less convenient and error prone (starting with the fact that LR doesn't provide exact match on collection names!). 


                              - Keyword criteria can be easily intersected with folders, while it's much harder to intersect a collection with a folder.

                               

                              - If you ever leave LR for another program or service, the keywords embedded in the photos metadata will automatically transfer without needing any special "import" scripts or plugins.

                              • 12. Re: Forum for plugin development?
                                jan_ekholm Level 1

                                Thank you a lot for your input on the collections vs keywords. I can see the benefit from using mostly keywords if you always add keywords. Sometimes I tend to just empty my camera from 1000 photos and go through them (maybe) at a later time and add keywords. For that it's much easier to just create a collection "Trip to San Mateo 2015" and add all photos there. Easy to find later when I have time to go through and add suitable keywords. Well, that was a bad example as I could just as well have added a single "San Mateo" keyword. Collections give me a better overview of what I have than the flat and long keyword lists.

                                 

                                LR's keyword editor is awful, the one in Aperture was far more usable. It's extremely hard to move keywords into correct hierarchies using the cr*p editor. Dragging is slow and you can't apparently copy and paste them either. But once the keyword hierarchy is properly set up, adding and editing keywords is made very easy.

                                 

                                I think I now have the tools I need to start working on a simple plugin to do my import. I don't need any UI, it's only for me and it's only for running once, so it's all quite simple in the end. Thank you for the links to your debugging toolkit and the sample plugins, very much appreciated!

                                • 13. Re: Forum for plugin development?
                                  MasterDomino

                                  To come back to your original post: Yes, I would be very interested for you to publish it on GitHub, as it is so rather hard to get your hands on any unscrambled Lightroom plugin code to learn from.

                                  • 14. Re: Forum for plugin development?
                                    johnrellis Most Valuable Participant
                                    it is so rather hard to get your hands on any unscrambled Lightroom plugin code to learn from.

                                    The Lightroom SDK has a fairly extensive guide and a number of examples (with source).

                                    • 15. Re: Forum for plugin development?
                                      MasterDomino Level 1

                                      Yes, I am aware of that. However, compared to similar subjects - say Scripting in InDesign - there is very little open code out there and I - as a beginner to both coding and Lua - am happy about anyone making his code public and by that promoting the idea to others, too.