Skip to content
Peter Shinners edited this page Apr 16, 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 will 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]. The simplest solution 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 often 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 field values are different than the assetId attributes used by [getAssetAttributes]. The fields only need to be the individual values that identify the assetId. The attributes are used to identify optional metadata and information about the assetId.

Katana implies there should be a "name" value in the fields that represents the unversioned assetId. If defined there can also be a "version" value that represents the fully resolved versioned assetId. But nothing in Katana actually uses or expects any fields.

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