Skip to content
Peter Shinners edited this page Apr 18, 2021 · 5 revisions
void buildAssetId(
    const StringMap& fields, 
    std::string& ret
)

Katana will ask the asset plugin to convert an assetId into a set of string fields with getAssetFields. It can then use this function to convert them back into an assetId. The resulting assetId must be copied into the ret argument.

This method only needs to deal with data created from getAssetFields so it easy to know what fields to expect. The simplest solution is storing an assetId value in the fields so that this method can easily return a single value with no work.

Be prepared to deal with values that are empty strings. This happens when Katana calls getAssetFields with the includeDefaults argument set to true.

If this function can't generate an assetId from the fields values, it must copy an empty string into ret.

These fields are different than the string map generated by getAssetAttributes. These fields are only the interpreted values that identify the original assetId. The other attributes are used to identify optional metadata and information about the assetId.

Some functionality of the Katana interface is managed by there being "name" and "version" values in the fields. These are intended to be the versioned and unversioned assetIds, but that is not a requirement. See getAssetFields for more information.

Katana converts an assetId to these fields when publishing and creating new assets. The fields are used when calling createAssetAndPath and createAssetAndPath so it can be helpful to add field values that are needed during these publish calls.