2 Replies Latest reply on Oct 21, 2015 2:25 PM by kichetof

    Lightroom 6.0 SDK - improvement LrDevelopController

    kichetof

      Dear Adobe Team,

       

      Thanks for your news great features insides SDK 6.0 !! In particular LrDevelopController !

       

      About this new namespace, I've some questions.

       

      Why we need to be on Develop module to apply developement parameters ? Could it be possible to apply them programmatically instead of "visual programmatically" like Excel Macro ?

      This is what I want (and do actually):


      1. Import new photo above the existing photo
      2. Create a develop snapshop for the new one
      3. Select existing photo
      4. get develop settings of existing photo
      5. select new imported photo
      6. refresh catalog:getTargetPhoto() (if not, the next line apply on the existing photo and not on the new one)
      7. Develop Controller set value for each parameters getted from existing photo
      8. create a new snapshot



      It seems that Develop Snapshot take no effect when it was done programmatically ?

       

      A snippet is more useful

       

      local import = catalog:withWriteAccessDo('Import', function(context)

          local photoImported = catalog:addPhoto(newPhoto, existingPhoto, 'above')

           

          photoImported:createDevelopSnapshot("Before syncing params", true) -- same image after setters no OK (need to be like after imported: empty; not like after setters new values)

       

          catalog:setSelectedPhotos(existingPhoto, {photoImported })

          local syncParams = existingPhoto:getDevelopSettings()

          --LrSelection.nextPhoto() -- no effect

          --LrSelection.previousPhoto() -- no effect

          

          catalog:setSelectedPhotos(photoImported , {})

          local convertedPhoto = catalog:getTargetPhoto()

       

      -- workaround to wait for displaying image :

          while convertedPhoto:getFormattedMetadata("fileName") ~= photoImported:getFormattedMetadata("fileName") do

              convertedPhoto = catalog:getTargetPhoto()

          end

       

          for k, v in pairs(syncParams) do

              LrDevelopController.startTracking(k)

              LrDevelopController.setValue(k, v)

              LrDevelopController.stopTracking()

          end

       

          photoImported:createDevelopSnapshot("After syncing params", true) -- same image after setters OK

       

      end,

      {timeout = 30}

      )

       

       

      What I have noticed:

       

      If the display isn't finished when you do setSelectedPhotos or nextPhoto(): LrDevelopController.setValue use the existing photo to apply setting and not the new one.

       

      If you decide to apply them on a lot of picture, it will take a long time to do that because you need to wait the new displayed picture who refresh before set new values.

       

      Why it isn't possible to do something like that ? (like copy paste settings) without needed to select and reselect and deselect and select ..

       

      local syncParams = existingPhoto:getDevelopSettings()

      newPhoto:setDevelopSettings(syncParams)

       

      Maybe I was wrong, but I have not found a "simple" solution to set development values

      Hope you'll have a nice workaround

      Thanks,

      Tof