Skip to content

getUniqueScenegraphLocationFromAssetId

pshinners edited this page Feb 9, 2022 · 5 revisions
void  getUniqueScenegraphLocationFromAssetId(
    const std::string& assetId,
    bool includeVersion, 
    std::string& ret
)

Define a unique fragment of a scenegraph path for an assetId.

This function is called aggressively at render time. Usually for any node that is importing external resources, like Alembic geometry or KatanaLook materials. It realistically needs to be cached to avoid excessive load on external resources. Be aware that this will also be called aggressively from multiple threads while preparing to render, with multiple threads often requesting the same value at the same time.

This section of a scenegraph path is used when loading assetIds into Katana's scenegraph. It is used by nodes like Importmatic and LookFileManager.

The returned scenegraph can be of arbitrary depth. The choice is up to the asset plugin and the preference of artists when using these nodes.

The generated scenegraph path fragment should avoid leading or trailing slashes. Only valid scenegraph characters are allowed, so avoid non-alphanumeric characters like punctuation. Underscores are allowed.

The simplest implementation will return a short, valid scenegraph name for the asset like "hero". When includeVersion is true, it should append a child location, like "hero/ver20".

Studios implementing this plugin may want to define more hierarchy based on variants or asset fields. This could generate a result like "villain/burnt/lod" or "villain/v0015/burnt/lod", depending on if the version is requested with includeVersion.