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

SDK determine if creative profile is imported in Lightroom

Participant ,
Apr 26, 2024 Apr 26, 2024

Copy link to clipboard

Copied

We need to be able to identify whether a specific creative profile has been imported into LrC.

 

I know that we can see presets, but are we able to see creative profiles in the same way?

Does the SDK provide this option?

 

The only option I can think of is looping all files below the CameraRaw directory looking for a <profile name>.xmp file.

TOPICS
macOS , SDK , Windows

Views

91

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 1 Correct answer

LEGEND , Apr 26, 2024 Apr 26, 2024

Unfortunately, when enhanced profiles were added to LR 7.3, they weren't added to the SDK.


I think your only option is to examine the various settings folders for .xmp files and use LrXml to read the contents of each .xmp file to determine its name (as displayed in LR) and its type (develop preset or enhanced profile).

 

Some complications to be aware of:

 

1. You have to determine whether the option Preferences > Presets > Store Presets With This Catalog is set and then look in the appropriate locat

...

Votes

Translate

Translate
LEGEND ,
Apr 26, 2024 Apr 26, 2024

Copy link to clipboard

Copied

Unfortunately, when enhanced profiles were added to LR 7.3, they weren't added to the SDK.


I think your only option is to examine the various settings folders for .xmp files and use LrXml to read the contents of each .xmp file to determine its name (as displayed in LR) and its type (develop preset or enhanced profile).

 

Some complications to be aware of:

 

1. You have to determine whether the option Preferences > Presets > Store Presets With This Catalog is set and then look in the appropriate location for the settings folder. LrPathUtils.getStandardFilePath ("appData") isn't cognizant of the Preferences settings.

 

You could search the preferences file to determine the (near) current setting of the option, or you could enumerate all develop presets and examine their current file location.  Each is imperfect -- I've included the function I use for the latter.

 

2. The Imported Settings folder is always read and never stored in the catalog folder. (That's a bizarre deliberate design choice by Adobe that was never justified.)

 

--[[----------------------------------------------------------------------------
void 
determineSettingsLocation ()

Determines the location of the Settings folder, which could be in the user's
Appdata/Library or in the catalog folder. Shows a progress bar, since LR has
an N^2 bug for enumerating presets and this could take a long time for those
users with hundreds or thousands of presets.

Sets the global "settingsFolder" to the path of the settings folder, or nil if
we can't determine it (because there aren't any created presets).
------------------------------------------------------------------------------]]

function determineSettingsLocation () 
    callWithContext ("", showErrors (function (context)

        local scope = LrDialogs.showModalProgressDialog {
            title = "Scanning presets", functionContext = context}
        scope:setIndeterminate ()

        settingsFolder = nil
        for _, folder in ipairs (LrApplication.developPresetFolders ()) do
            for _, preset in ipairs (folder:getDevelopPresets ()) do
                local path = presetPath (preset)
                if CatalogSettingsFolder == 
                   path:sub (1, #CatalogSettingsFolder) 
                then
                    settingsFolder = CatalogSettingsFolder; break
                elseif SettingsFolder == path:sub (1, #SettingsFolder) then
                    settingsFolder = SettingsFolder; break
                    end

                scope:setCaption (preset:getName ())
                end
            end

        scope:done ()
        end)) 

    LrTasks.sleep (0) -- force progress bar to close
    end

 

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
Participant ,
Apr 29, 2024 Apr 29, 2024

Copy link to clipboard

Copied

LATEST

I already figured out the scanning of the xmp files, however I missed the "Preferences > Presets > Store Presets With This Catalog" consequences.

Thank you!

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