Skip to content
pshinners edited this page Apr 26, 2021 · 7 revisions
void  getAssetIdForScope(
    const std::string& assetId,
    const std::string& scope,
    std::string& ret
)

Modify an assetId into another assetId.

The most common use for this function is to remove a specific version number from an assetId. Katana will pass a scope of "name" to represent this request.

Katana will generally only ever pass "name" for the scope value. It does define a "version" value. Users of the asset API could pass any arbitrary value, like "shot" or "show". But whatever assetId that returns would be defined by the asset plugin.

This method must always return an assetId or the original value. If the requested scope does not match the given assetId this function should copy the unmodified assetId into ret.

Other methods getAssetAttributes and setAssetAttributes take a similar scope argument to get the behavior of this method without having to call this directly.

Katana uses this method with a scope of "name" to collapse recently used versions of the same asset name into a single entry in the recently used history. That unversioned string will then be used when loading a recent file with resolveAsset.

The LookFileManager can call this function with "version" as the scope when the enforceVersion parameter is set.

The Python expression namespace defines assetIdForScope that will call this method. It also defines kAssetFieldName and kAssetFieldVersion as the "name" and "version" strings this function is likely to get.