Katana Plug-in APIs 0.1
Static Public Member Functions

Foundry::Katana::DefaultAssetPlugin Class Reference

Allows the access to the currently set Asset Management System plugin. More...

#include <FnDefaultAssetPlugin.h>

List of all members.

Static Public Member Functions

static bool isAssetId (const std::string &str, bool throwOnError=false)
 Return whether the input string represents a valid asset id.
static bool containsAssetId (const std::string &str, bool throwOnError=false)
 Return whether the input string contains a valid asset id anywhere within it.
static std::string resolveAsset (const std::string &assetId, bool throwOnError=false)
 Lookup asset id in asset system and return path (or other string) that it references.
static std::string resolveAllAssets (const std::string &inputString, bool throwOnError=false)
static std::string resolvePath (const std::string &path, int frame, bool throwOnError=false)
 Resolve env vars in input path string, then resolve asset ids and file sequences.
static bool getAssetAttributes (const std::string &assetId, const std::string &scope, std::map< std::string, std::string > &attributesMap, bool throwOnError=false)
static bool checkPermissions (const std::string &assetId, const std::map< std::string, std::string > &context, bool throwOnError=false)
static std::string resolveAssetVersion (const std::string &assetId, const std::string &versionTag=std::string(), bool throwOnError=false)
static std::string getAssetDisplayName (const std::string &assetId, bool throwOnError=false)
static bool getAssetVersions (const std::string &assetId, std::vector< std::string > &versions, bool throwOnError=false)
static bool getAssetFields (const std::string &assetId, bool includeDefaults, std::map< std::string, std::string > &returnFields, bool throwOnError=false)
static std::string buildAssetId (const std::map< std::string, std::string > &fields, bool throwOnError=false)
static std::string getAssetIdForScope (const std::string &assetId, const std::string &scope, bool throwOnError=false)

Detailed Description

Allows the access to the currently set Asset Management System plugin.

This class can be used when a plugin (a Scenegraph Generator, for example) needs to resolve or publish assets using the Asset Management System Plugin set on the current scene (regardless if it is implemented in C++ or Python)....


Member Function Documentation

static std::string Foundry::Katana::DefaultAssetPlugin::buildAssetId ( const std::map< std::string, std::string > &  fields,
bool  throwOnError = false 
) [static]

Builds and return a new asset id using the given fields.

Parameters:
fieldsA map of fields used to build the new asset id.
throwOnErrorBoolean setting whether to throw an exception on error.
Returns:
The new asset id, on success. Otherwise an empty string.
static bool Foundry::Katana::DefaultAssetPlugin::checkPermissions ( const std::string &  assetId,
const std::map< std::string, std::string > &  context,
bool  throwOnError = false 
) [static]

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

Parameters:
assetIdThe id of the asset to check permission for.
context
throwOnErrorBoolean setting whether to throw an exception on error.
Returns:
static bool Foundry::Katana::DefaultAssetPlugin::containsAssetId ( const std::string &  str,
bool  throwOnError = false 
) [static]

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.
throwOnErrorBoolean setting whether to throw an exception on error.
Returns:
True if the string contains a valid asset id.
static bool Foundry::Katana::DefaultAssetPlugin::getAssetAttributes ( const std::string &  assetId,
const std::string &  scope,
std::map< std::string, std::string > &  attributesMap,
bool  throwOnError = false 
) [static]

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

Parameters:
assetIdThe id of the asset to search for metadata.
scopeA scoped item name.
attributesMapA map to be filled with the metadata attributes of the given asset.
throwOnErrorBoolean setting whether to throw an exception on error.
Returns:
static std::string Foundry::Katana::DefaultAssetPlugin::getAssetDisplayName ( const std::string &  assetId,
bool  throwOnError = false 
) [static]

Returns a name suitable for displaying to the user for the given asset id.

Parameters:
assetIdThe asset id to look for display name.
throwOnErrorBoolean setting whether to throw an exception on error.
Returns:
The display name of the given asset.
static bool Foundry::Katana::DefaultAssetPlugin::getAssetFields ( const std::string &  assetId,
bool  includeDefaults,
std::map< std::string, std::string > &  returnFields,
bool  throwOnError = false 
) [static]

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.
returnFieldsA map to be filled with the asset fields.
throwOnErrorBoolean setting whether to throw an exception on error.
Returns:
True on success.
static std::string Foundry::Katana::DefaultAssetPlugin::getAssetIdForScope ( const std::string &  assetId,
const std::string &  scope,
bool  throwOnError = false 
) [static]

Gets an 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", returns 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:
assetIdThe input asset id.
scopeA string specifying scope for result asset id, such as "name" or "version".
throwOnErrorBoolean setting whether to throw an exception on error.
Returns:
A string containing the result asset id.
static bool Foundry::Katana::DefaultAssetPlugin::getAssetVersions ( const std::string &  assetId,
std::vector< std::string > &  versions,
bool  throwOnError = false 
) [static]

Gets a list of all the available versions of the given asset.

Parameters:
assetIdThe asset id to look for available versions.
versionsThe vector to be filled with the available versions of the given asset.
throwOnErrorBoolean setting whether to throw an exception on error.
Returns:
True on success.
static bool Foundry::Katana::DefaultAssetPlugin::isAssetId ( const std::string &  str,
bool  throwOnError = false 
) [static]

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.
throwOnErrorBoolean setting whether to throw an exception on error.
Returns:
True if the string is valid asset id syntax.
static std::string Foundry::Katana::DefaultAssetPlugin::resolveAllAssets ( const std::string &  inputString,
bool  throwOnError = false 
) [static]

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

Parameters:
inputStringThe string to be searched for asset ids.
throwOnErrorBoolean setting whether to throw an exception on error.
Returns:
The string with all asset ids replaced with resolved asset strings.
static std::string Foundry::Katana::DefaultAssetPlugin::resolveAsset ( const std::string &  assetId,
bool  throwOnError = false 
) [static]

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

Parameters:
assetIdAsset id to resolve.
throwOnErrorBoolean setting whether to throw an exception on error.
Returns:
The resolved asset string.
static std::string Foundry::Katana::DefaultAssetPlugin::resolveAssetVersion ( const std::string &  assetId,
const std::string &  versionTag = std::string(),
bool  throwOnError = false 
) [static]

Returns the version for a given asset id. If it is a partial asset id (which does not have a version) then an empty string is returned.

Parameters:
assetIdThe asset id to resolve.
versionTagAn optional version tag to use for determining the resulting version. Can be an explicit version number or a special tag such as "latest" or "approved".
throwOnErrorBoolean setting whether to throw an exception on error.
Returns:
String with the integer version number that this asset id resolves to, or an empty string if an error occurs.
static std::string Foundry::Katana::DefaultAssetPlugin::resolvePath ( const std::string &  path,
int  frame,
bool  throwOnError = false 
) [static]

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:
pathInput path string to resolve.
frameFrame number to resolve file sequences with.
throwOnErrorBoolean setting whether to throw an exception on error.
Returns:
The resolved path string.

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