Asset API (OpScript)
Asset Plugin
- Asset.GetDefaultAssetPlugin()
Returns an
AssetPlugin
object.
- class Asset.AssetPlugin
Class representing the default asset plugin. Note that this is not instantiable directly - instead use
GetDefaultAssetPlugin()
.In the methods below the optional throwOnError boolean flag determines whether an exception is thrown in the case of an error.
- isAssetId(string str[, boolean throwOnError=false])
Returns
true
if input string represents a valid asset id.
- containsAssetId(string str[, boolean throwOnError=false])
Returns
true
if input string contains a valid asset id anywhere within it.
- checkPermissions(string assetId, table context[, boolean throwOnError=false])
Returns
true
if permissions for the given asset id are valid in the given context.
- resolveAsset(string assetId[, boolean throwOnError=false])
Look up asset id in asset system and return path (or other string) that it references.
- resolveAllAssets(string str[, boolean throwOnError=false])
Replace any asset ids found in input string with resolved asset strings.
- resolvePath(string path, int frame[, boolean throwOnError=false])
Resolves env vars in input path string, then resolves asset ids and file sequences.
- resolveAssetVersion(string assetId, string versionStr[, boolean throwOnError=false])
Return integer version that this asset id resolves to.
- getUniqueScenegraphLocationFromAssetId(string assetId, boolean includeVersion[, boolean throwOnError=false])
Returns a valid scene graph location path that uniquely represents the input asset id.
- getAssetVersions(string assetId[, boolean throwOnError=false])
Returns a list of the available versions for the given asset.
- getRelatedAssetId(string assetId, string relation[, boolean throwOnError=false])
Returns asset id that is related to input asset, given a relationship type.
- getAssetFields(string assetId, boolean includeDefaults[, boolean throwOnError=false])
Convert from asset id to a table of named string fields defining the asset. If includeDefaults is
true
, include default values for fields not explicitly specified by the assetId.
- buildAssetId(table fields[, boolean throwOnError=false])
Convert from asset fields (table with string keys/values) to asset id.
- getAssetAttributes(string assetId, string scope[, boolean throwOnError=false])
Get metadata associated with an asset or a scoped item in the asset hierarchy.
- getAssetIdForScope(string assetId, string scope[, boolean throwOnError=false])
Get asset id scoped to the specified level in the asset hierarchy.
- getAssetDisplayName(string assetId[, boolean throwOnError=false])
Produces a name for the given asset that can be used to represent the asset in a scene graph location.
File Sequence Plugin
- Asset.GetDefaultFileSequencePlugin()
Returns a
FileSequencePlugin
object.
- class Asset.FileSequencePlugin
- isFileSequence(string str[, boolean throwOnError=false])
Returns
true
if str is a valid file sequence.
- buildFileSequenceString(string prefix, string suffix, int padding[, boolean throwOnError=false])
Returns file sequence string built from given prefix, suffix, and padding values.
- resolveFileSequence(string path, int frame[, boolean throwOnError=false])
Resolves a file sequence string into an single real file path.
- isFrameInFileSequence(string path, int frame[, boolean throwOnError=false])
Returns
true
if frame is a part of the file sequence