Skip navigation
lightroomvietnam
Currently Being Moderated

get parent Collectionset in create Collection

Aug 13, 2012 8:51 PM

Hi All,

 

     In Create Collection, How to get parent collectionset.

getparent.gif

 

Thanks,

Dung

 
Replies
  • Currently Being Moderated
    Aug 13, 2012 9:13 PM   in reply to lightroomvietnam

    I think you want to post this in the Photoshop Lightroom forum (this is the Lightroom SDK forum, for plugin authors).

     

    Or have I misunderstood the question? (collection:getParent() to get parent in lua code).

     

    Or are you trying to call the catalog function to create a collection, but don't know what to use for parent collection set? If this is the case, then you will have to create a collection set if you can't find something suitable to act as parent (e.g. a selected collection set obtained from catalog:getActiveSources()). Reminder: parent parameter is optional - if omitted, then collection will be created in root of catalog (or publish service) - that's another option.

     

    Most of my plugins that create collections create a collection set in the root, named after the plugin, and put all sub-collections/sets in it.

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 13, 2012 9:30 PM   in reply to lightroomvietnam

    Are we talking about lua plugin code?

     

    If so, just call catalog:getChildCollectionSets() and visit each until you find BatchUpload.

     

    ?

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 13, 2012 9:53 PM   in reply to lightroomvietnam

    You must supply the parent collection set when you create the collection. Whichever collection set you pass, will be the parent of the new collection.

     

    When iterating the catalog's child collection sets, you can look at the collection set name to see if it's the right one, assuming you will know the correct name when you see it - will you always?

     

    Consider posting actual code snippets if you can.

     

    Rob

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 14, 2012 12:21 AM   in reply to lightroomvietnam

    If parent is nil then parent is root. Make sure when you create the collection, that you are passing a valid collection set as parent, if you don't want it created in the root.

     

    In the code you posted, you are not actually creating a collection, but rather getting a reference to an already existing collection, which was created in the root of the publishing service.

     

    Do you also have the code that is creating the collection?

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 14, 2012 1:03 AM   in reply to lightroomvietnam

    Do you have the SDK API doc? - these are from the top of the page about publish services:

     

    publishService:createPublishedCollection( name, parent, canReturnExisting )

    Creates a new published collection in this publish service.

     

    publishService:createPublishedCollectionSet( name, parent, canReturnExisting )

    Creates a new collection set in this publish service.

     

    publishService:createPublishedSmartCollection( name, searchDesc, parent, canReturnExisting )

    Creates a new published smart collection in this publish service.

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 14, 2012 8:12 PM   in reply to lightroomvietnam

    I think you are going to have to try and state the problem more clearly.

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 15, 2012 1:31 PM   in reply to lightroomvietnam

    Do you want the parent of the collection to be the collection set named 'BatchUpload'?

     

    In any case, you need to determine the parent before creating the collection. If the parent does not already exist, then you need to create it. If the parent does already exist, then you need to find it, by rummaging through existing collection sets.

     

    Note: if the target collection set may be nested, you may need to use recursion to find it, since there is no method to get a complete list of all collection set children.

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 16, 2012 1:16 AM   in reply to lightroomvietnam

    You're welcome - although I don't know how much I helped. I hope you get it working, if you haven't already...

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 16, 2012 2:32 AM   in reply to lightroomvietnam

    Okay - I see now. Thanks for letting me know .

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points