An Asset Library in Tank

Hi there, here is what we did to setup an asset library in Tank. We wanted to share it, as we guess others will want to build something like that. Comments are more than welcome !

Shotgun : 

  • Enabled the AssetLibrary entity. 
  • Added a Library "entity" field to Assets, accepting a AssetLibrary. 
  • Rule : if not left empty, then the Asset is part of library.

Schema : 

  • Added a "libraries" tree under project and project/work/humanuser, copied the "assets" tree under libraries/library. 
  • Added a library.yml under libraries, side by side with a library folder, entity_type: "AssetLibrary" and default project based filter. 
  • In librairies/library/assets/asset_type, changed the filter in asset.yml to include : 
               { "path": "sg_library", "relation" : "is_not", "values" : [null] } 
               { "path": "sg_library", "relation": "is", "values": [ "$library"] } 
  • In assets/asset_type ( the regular one, not under a libraries folder ) changed the filter in asset.yml to include ( didn't test the new is null filter ) : 
              { "path": "sg_library", "relation": "type_is_not", "values": [ "AssetLibrary"] }

Config : 

  • Added a key in templates.yml 
                AssetLibrary : 
                type : str 
  • Added various template paths in templates.yml, e.g. : 
               maya_library_work: work/{HumanUser}/libraries/{AssetLibrary}/assets/{sg_asset_type}/{Asset}/{Step}/maya/{name}.v{version}.mb 
               maya_library_publish: libraries/{AssetLibrary}/assets/{sg_asset_type}/{Asset}/{Step}/publish/{TankType}/{name}/v{version}/{Asset}_{name}_v{version}.mb 
  • Added a library.yml env file, defining engines, apps and templates to use in library context.

Hooks : 

  • Added "AssetLibrary" in core/hooks/context_additional_entities.py 
  • Tweaked core/hooks/pick_environment.py "Asset" block :
                   elif context.entity["type"] == "Asset": 
                   # Need to check if we are dealing with an Asset 
                   # from a library or not 
                       sg = self.parent.shotgun 
                       sg_asset = sg.find_one( context.entity["type"], [ ['id', 'is', context.entity['id']] ], ['sg_library'] ) 
                       if sg_asset is not None and sg_asset['sg_library'] is not None : 
                           return "library" 
                      return "asset"


  • 0
    Stephane Deverly

    Here is how our test project tktest is set.

    Hope it helps !

  • 0
    Bruno Guerreiro

    Hi Stephane,

    First of all, Thank you for sharing! this is an awesome add on to Toolkit.

    I have been really tempted to test this out! I do have a question, this type of library configuration its not project dependent, meaning those library assets will be shared across all projects correct?


    All the Best


  • 0
    Stéphane Deverly

    Hey Bruno, thanks for the nice words. This is project dependent, but you could have a "special" studio project what will hold things at the studio level.

    I usually recommend to add libraries at projects level, and then, when the project is over, review what was build, copy and publish what is interesting at the studio level. Otherwise, you might sooner than later end up having a lot of things that you don't want at the studio level. The two steps process allows to filter out what is not interesting, or even do a bit of polish / clean up.

    Hope it helps !

  • 0
    Patrick Macdonald

    Thanks for sharing this too!

    Could you explain a little more about how you use this setup? 

    eg once an asset is ready to publish to a library, do you save your scene to the library context and localise all depencies to the locations you've added to templates.yml? 

    I'm still not sure how libraries would bring organisational improvements over simply tagging assets and creating custom Asset view tabs that filter assets by tag? A tag based approach would allow assets to exist in multiple libraries and allow users to create very specific libraries from particular tag combinations; eg red car model, sunny hdri, etc

    (I'm coming at this with the aim of creating a 'library' project where approved assets are packaged up and transferred to the global library project)

    Thanks again




Please sign in to leave a comment.