Skip to content

resolveAssetVersion

Peter Shinners edited this page Apr 16, 2021 · 6 revisions
void  resolveAssetVersion(
    const std::string& assetId,
    std::string& ret, 
    const std::string& versionStr = std::string()
)

If the given assetId is valid, find a specific version to reference, using the optional versionStr argument to help pick a specific version.

The return value ret should be an individual version value as a string. It should not be a complete assetId or file path. The return ret should be assigned to an empty string if there is any problem or invalid argument.

If the versionStr is empty or the assetId does not reference an asset with versions, set the ret argument to an empty string.

The versionStr argument isn't required to be a numeric version number. It can be passed as a label or definition like "approved" or "latest".

If versionStr is an empty string, this should check if the assetId defines a version and return that.

If the resulting results in a numeric version value, it will need to be converted into a string for the ret argument. That can be done with an itoa style function or passing through a stringstream like

    std::stringstream writer;
    writer << numeric_version;
    writer >> ret;

This is called from the Importmatic after the user selects one of the versions generated by getAssetVersions.

Katana also uses this call during the look file resolver.

The optional example Casting Sheet plugin also has examples of calling this method.

TODO - Notes say this can be used by katana batch mode? What does that mean?

Clone this wiki locally