Katana Plug-in APIs 0.1
Public Member Functions

FileAsset Class Reference

Inheritance diagram for FileAsset:
Foundry::Katana::Asset

List of all members.

Public Member Functions

void reset ()
 Reset will be called when Katana flushes its caches, giving the plugin a chance to reset.
bool isAssetId (const std::string &name)
 Return whether the input string represents a valid asset id.
bool containsAssetId (const std::string &name)
 Return whether the input string contains a valid asset id anywhere within it.
bool checkPermissions (const std::string &assetId, const StringMap &context)
 Returns whether permissions for the given asset id are valid in the given context.
bool runAssetPluginCommand (const std::string &assetId, const std::string &command, const StringMap &commandArgs)
 Runs a custom command for the given asset id.
void resolveAsset (const std::string &assetId, std::string &ret)
 Lookup asset id in asset system and return path (or other string) that it references.
void resolveAllAssets (const std::string &str, std::string &ret)
 Replace any asset ids found in input string with resolved asset strings.
void resolvePath (const std::string &str, const int frame, std::string &ret)
 Resolve env vars in input path string, then resolve asset ids and file sequences.
void resolveAssetVersion (const std::string &assetId, std::string &ret, const std::string &versionStr=std::string())
 Return the version that this asset id resolves to.
void getUniqueScenegraphLocationFromAssetId (const std::string &assetId, bool includeVersion, std::string &ret)
 Return a valid scenegraph location path that uniquely represents the input asset id.
void getAssetDisplayName (const std::string &assetId, std::string &ret)
 Returns a string that can be used in GUIs, for example.
void getAssetVersions (const std::string &assetId, StringVector &ret)
 Returns a vector of strings listing the available versions for the given asset.
void getRelatedAssetId (const std::string &assetId, const std::string &relation, std::string &ret)
 Return asset id that is related to input asset, given a relationship type.
void getAssetFields (const std::string &assetId, bool includeDefaults, StringMap &returnFields)
 Convert from asset id to a set of named string fields defining the asset.
void buildAssetId (const StringMap &fields, std::string &ret)
 Convert from asset fields to asset id.
void getAssetAttributes (const std::string &assetId, const std::string &scope, StringMap &returnAttrs)
 Get metadata associated with an asset or a scoped item in the asset hierarchy.
void setAssetAttributes (const std::string &assetId, const std::string &scope, const StringMap &attrs)
 Set metadata associated with an asset or a scoped item in the asset hierarchy.
void getAssetIdForScope (const std::string &assetId, const std::string &scope, std::string &ret)
 Get partial asset id scoped to the specified level in the asset hierarchy.
void createAssetAndPath (FnKat::AssetTransaction *txn, const std::string &assetType, const StringMap &assetFields, const StringMap &args, bool createDirectory, std::string &assetId)
 Create asset and optional directory path.
void postCreateAsset (FnKat::AssetTransaction *txn, const std::string &assetType, const StringMap &assetFields, const StringMap &args, std::string &assetId)
 Creates an asset after the creation of the files to be published.

Member Function Documentation

void FileAsset::buildAssetId ( const StringMap &  fields,
std::string &  ret 
) [virtual]

Convert from asset fields to asset id.

The inverse of getAssetFields, this takes a set of asset fields and returns an asset id string.

Parameters:
fieldsString map containing key/value strings representing asset fields.
retSet to asset id.

Implements Foundry::Katana::Asset.

bool FileAsset::checkPermissions ( const std::string &  assetId,
const StringMap &  context 
) [virtual]

Returns whether permissions for the given asset id are valid in the given context.

Parameters:
assetIdAsset id to check permissions for.
contextAdditional strings used to specify more details about permissions to be checked. Examples include current user or current show environment.
Returns:
True if permissions for the given asset id are valid in the given context.

Implements Foundry::Katana::Asset.

bool FileAsset::containsAssetId ( const std::string &  str) [virtual]

Return whether the input string contains a valid asset id anywhere within it.

Should parse the input string to determine whether it contains a valid asset id. Should not attempt to determine whether any asset ids found in the string actually exist in the asset database.

Parameters:
strThe string to test.
Returns:
True if the string contains a valid asset id.

Implements Foundry::Katana::Asset.

void FileAsset::createAssetAndPath ( FnKat::AssetTransaction txn,
const std::string &  assetType,
const StringMap &  assetFields,
const StringMap &  args,
bool  createDirectory,
std::string &  assetId 
) [virtual]

Create asset and optional directory path.

Parameters:
txnHandle to transaction object. If null, asset/directory creation is done immediately.
assetTypeType of Katana asset to create (e.g. katana scene, image, shadow, etc)
assetFieldsGroupAttribute representing asset fields for asset to create (same as getAssetFields output).
argsAdditional args used to specify more details (may differ based on assetType). Examples include "versionUp", which is a boolean determining whether to version up an existing asset or "colorspace" if the assetId is of the type "image" (in which if this is provided it should be seen as an Attribute to be associated with the asset)
createDirectoryBoolean specifying whether to create the directory associated with this asset.
assetIdSet to the asset id created (or that will be created on transaction commit).

Implements Foundry::Katana::Asset.

void FileAsset::getAssetAttributes ( const std::string &  assetId,
const std::string &  scope,
StringMap &  returnAttrs 
) [virtual]

Get metadata associated with an asset or a scoped item in the asset hierarchy.

This differs from the above "asset fields" which are the fields that uniquely define the asset itself. This metadata may include fields such as asset creator, creation time, etc.

Parameters:
assetIdAsset for which to return metadata.
scopeOptional string specifying scope for metadata lookup, such as "name" or "version".
returnAttrsFill with key/value strings representing metadata attributes.

Implements Foundry::Katana::Asset.

void FileAsset::getAssetDisplayName ( const std::string &  assetId,
std::string &  ret 
) [virtual]

Returns a string that can be used in GUIs, for example.

Parameters:
assetIdThe asset for which the display name is required
retReturn value with the display name.

Implements Foundry::Katana::Asset.

void FileAsset::getAssetFields ( const std::string &  assetId,
bool  includeDefaults,
StringMap &  returnFields 
) [virtual]

Convert from asset id to a set of named string fields defining the asset.

The minimum set of fields are "name" and "version". Other fields are preserved but ignored by Katana.

Parameters:
assetIdInput asset id.
includeDefaultsIf true, return the full set of fields for this asset system, including defaults not specified in the asset id. If false, return only the fields specified in the asset id.
returnFieldsFill map with key/value strings representing asset fields.

Implements Foundry::Katana::Asset.

void FileAsset::getAssetIdForScope ( const std::string &  assetId,
const std::string &  scope,
std::string &  ret 
) [virtual]

Get partial asset id scoped to the specified level in the asset hierarchy.

Should return a more general asset reference to the given asset id. For instance, if scope is "name", return an asset id that doesn't include a specific version number. This may not make sense in some asset systems, in which case, return the input asset id.

Parameters:
assetIdInput asset id.
scopeString specifying scope for result asset id, such as "name" or "version".
retSet to result asset id.

Implements Foundry::Katana::Asset.

void FileAsset::getAssetVersions ( const std::string &  assetId,
StringVector &  ret 
) [virtual]

Returns a vector of strings listing the available versions for the given asset.

Parameters:
assetIdThe asset who's versions we want
retThe string vector of available versions

Implements Foundry::Katana::Asset.

void FileAsset::getRelatedAssetId ( const std::string &  assetId,
const std::string &  relation,
std::string &  ret 
) [virtual]

Return asset id that is related to input asset, given a relationship type.

A general function for getting related assets. An current example in Katana is an "argsxml" asset defining the UI for a renderer procedural asset.

Parameters:
assetIdInput asset id for which to find related asset.
relationString representing relationship type.
retSet to related assed id (or empty string if no related asset is found).

Implements Foundry::Katana::Asset.

void FileAsset::getUniqueScenegraphLocationFromAssetId ( const std::string &  assetId,
bool  includeVersion,
std::string &  ret 
) [virtual]

Return a valid scenegraph location path that uniquely represents the input asset id.

This will be used as the default location for look file materials loaded into the Katana scene, for example. (Example: /name/version/other/fields).

Parameters:
assetIdInput asset id to represent as scenegraph location path.
includeVersionallows to specify if the scenegraph location path should contain the asset version
retSet to scenegraph location path.

Implements Foundry::Katana::Asset.

bool FileAsset::isAssetId ( const std::string &  str) [virtual]

Return whether the input string represents a valid asset id.

Should parse the input string to determine whether it is a valid asset id. Should not attempt to determine whether the asset actually exists in the asset database.

Parameters:
strThe string to test.
Returns:
True if the string is valid asset id syntax.

Implements Foundry::Katana::Asset.

void FileAsset::postCreateAsset ( FnKat::AssetTransaction txn,
const std::string &  assetType,
const StringMap &  assetFields,
const StringMap &  args,
std::string &  assetId 
) [virtual]

Creates an asset after the creation of the files to be published.

Parameters:
txnHandle to transaction object. If null, asset/directory creation is done immediately.
assetTypeType of Katana asset to create (e.g. katana scene, image, shadow, etc)
assetFieldsGroupAttribute representing asset fields for asset to create (same as getAssetFields output).
argsAdditional args used to specify more details (may differ based on assetType). Examples include "versionUp", which is a boolean determining whether to version up an existing asset.
assetIdSet to the asset id created (or that will be created on transaction commit).

Implements Foundry::Katana::Asset.

void FileAsset::resolveAllAssets ( const std::string &  str,
std::string &  ret 
) [virtual]

Replace any asset ids found in input string with resolved asset strings.

Parameters:
strInput string to resolve.
retSet to resolved asset string.

Implements Foundry::Katana::Asset.

void FileAsset::resolveAsset ( const std::string &  assetId,
std::string &  ret 
) [virtual]

Lookup asset id in asset system and return path (or other string) that it references.

Parameters:
assetIdAsset id to resolve.
retSet to resolved asset string.

Implements Foundry::Katana::Asset.

void FileAsset::resolveAssetVersion ( const std::string &  assetId,
std::string &  ret,
const std::string &  versionStr = std::string() 
) [virtual]

Return the version that this asset id resolves to.

Parameters:
assetIdInput asset id resolve.
retReturns the version that this asset id resolves to.
versionStrIn some asset management systems the version can be specified by keywords (example: latest, aproved, etc) that might be associated to a specific version number. If versionStr is specified, then the plugin will try to return (on ret) the resolved string number for the assetId specified by str and the given version keyword (the versionStr value).

Implements Foundry::Katana::Asset.

void FileAsset::resolvePath ( const std::string &  str,
const int  frame,
std::string &  ret 
) [virtual]

Resolve env vars in input path string, then resolve asset ids and file sequences.

File sequence will most likely be resolved using default file sequence plugin from host. This is a good candidate for some base functionality in the C++ wrappers on the plugin side.

Parameters:
strInput path string to resolve.
frameFrame number to resolve file sequences with.
retSet to resolved path string.

Implements Foundry::Katana::Asset.

bool FileAsset::runAssetPluginCommand ( const std::string &  assetId,
const std::string &  command,
const StringMap &  commandArgs 
) [virtual]

Runs a custom command for the given asset id.

Parameters:
assetIdAsset id the command will be run on.
commandName of the command to run.
commandArgsKey-string pair representing the command arguments.
Returns:
True if the command execution succeeds.

Implements Foundry::Katana::Asset.

void FileAsset::setAssetAttributes ( const std::string &  assetId,
const std::string &  scope,
const StringMap &  attrs 
) [virtual]

Set metadata associated with an asset or a scoped item in the asset hierarchy.

This differs from the above "asset fields" which are the fields that uniquely define the asset itself. This metadata may include fields such as asset creator, creation time, etc.

Parameters:
assetIdAsset for which to set metadata.
scopeOptional string specifying scope for metadata lookup, such as "name" or "version".
attrsString map containing key/value strings representing metadata attributes.

Implements Foundry::Katana::Asset.


The documentation for this class was generated from the following file:
 All Classes Functions Variables Typedefs Enumerations Enumerator