Token System Library

Detailed Description

Since
R17.032
See also
The Token System Overview article.

Classes

struct  TokenEntry
 
struct  RenderPathData
 

Macros

#define ID_TOKEN_LIB
 
#define INVALID_FRAME
 

Typedefs

typedef String TOKENHOOK(void *data)
 

Functions

Bool GetAllTokenEntries (maxon::BaseArray< TokenEntry > &tokenList)
 
String StringConvertTokens (const String &path, const RenderPathData *rpData)
 
Filename FilenameConvertTokens (const Filename &path, const RenderPathData *rpData)
 
String StringConvertTokensFilter (const String &path, const RenderPathData *rpData, const maxon::BaseArray< String > &exclude)
 
Filename FilenameConvertTokensFilter (const Filename &path, const RenderPathData *rpData, const maxon::BaseArray< String > &exclude)
 
String StringExtractRoot (const String &path)
 
Filename FilenameExtractRoot (const Filename &path)
 
Bool FilenameSlicePath (const Filename &path, Filename &root, Filename &fileName)
 
Bool RegisterToken (const String &key, const String &help, const String &example, TOKENHOOK *hook)
 
Bool RegisterHiddenToken (const String &key, const String &help, const String &example, TOKENHOOK *hook)
 

Macro Definition Documentation

◆ ID_TOKEN_LIB

#define ID_TOKEN_LIB

Token library ID.

◆ INVALID_FRAME

#define INVALID_FRAME

Private.

Typedef Documentation

◆ TOKENHOOK

typedef String TOKENHOOK(void *data)

Token hook definition. Use RegisterToken() to register a custom Token.
Here is an example from the Take Token:

static String TakeTokenHook(void *data)
{
RenderPathData* rDataPath = (RenderPathData*)data;
if (!rDataPath)
return String();
if (rDataPath->_cTake)
return rDataPath->_cTake->GetName();
return String();
}
if (!RegisterToken(String("take"), String("Current Take Name"), String("MyTake"), TakeTokenHook))
{
return false;
}
See also
The Custom Tokens example.

Function Documentation

◆ GetAllTokenEntries()

Bool GetAllTokenEntries ( maxon::BaseArray< TokenEntry > &  tokenList)

Fills a list will all available Token entries.

Parameters
[out]tokenListThe array to be filled.
Returns
true if successful, otherwise false.

◆ StringConvertTokens()

String StringConvertTokens ( const String path,
const RenderPathData rpData 
)

Converts tokenized path String to standard String by replacing all Tokens with correct values if found.

Parameters
[in]pathThe original path String.
[in]rpDataThe data used to extract value for Tokens. The caller owns the pointed RenderPathData.
Returns
The converted String, or the original path if any error.

◆ FilenameConvertTokens()

Filename FilenameConvertTokens ( const Filename path,
const RenderPathData rpData 
)

Converts tokenized path Filename into standard Filename by replacing all Tokens with correct values if found.

Parameters
[in]pathThe original path Filename.
[in]rpDataThe data used to extract value for Tokens. The caller owns the pointed RenderPathData.
Returns
The converted FileName, or the original path if any error.

◆ StringConvertTokensFilter()

String StringConvertTokensFilter ( const String path,
const RenderPathData rpData,
const maxon::BaseArray< String > &  exclude 
)

Converts tokenized path String to standard String by replacing all Tokens with correct values if found. Tokens added to exclude array are ignored.

Parameters
[in]pathThe original path String.
[in]rpDataThe data used to extract value for the Tokens. The caller owns the pointed RenderPathData.
[in]excludeA list of Tokens strings to be ignored.
Returns
The converted String or the original path if any error.

◆ FilenameConvertTokensFilter()

Filename FilenameConvertTokensFilter ( const Filename path,
const RenderPathData rpData,
const maxon::BaseArray< String > &  exclude 
)

Converts tokenized path Filename into standard Filename by replacing all Tokens with correct values if found. Tokens added to exclude array are ignored.

Parameters
[in]pathThe original path Filename.
[in]rpDataThe data used to extract value for Tokens. The caller owns the pointed RenderPathData.
[in]excludeA list of Tokens strings to be ignored.
Returns
The converted FileName or the original path if any error.

◆ StringExtractRoot()

String StringExtractRoot ( const String path)

Searches for the first Token in path. If it is found and it is in-between "/.." returns the preceeding directory path String.

Parameters
[in]pathThe original path String.
Returns
The root String path, or the original String if no Token is found.

◆ FilenameExtractRoot()

Filename FilenameExtractRoot ( const Filename path)

Searches for the first Token in path. If it is found and it is in-between "/..", returns the preceeding directory path Filename.

Parameters
[in]pathThe original path Filename.
Returns
The root Filename path, or the original Filename if no Token is found.

◆ FilenameSlicePath()

Bool FilenameSlicePath ( const Filename path,
Filename root,
Filename fileName 
)

Splits path in two parts if a Token is found as sub-folders and extracts root and filename path starting at sub-folder.

Parameters
[in]pathThe original path Filename.
[out]rootThe root Filename path.
[out]fileNameThe sub-folder and filename.
Returns
true if a Token is found, otherwise false.

◆ RegisterToken()

Bool RegisterToken ( const String key,
const String help,
const String example,
TOKENHOOK hook 
)

Registers a new Token that can be used in a render filename.

Note
The key is the identifier for the Token and has to be unique. For this reason identify your plugin in the Token key as a prefix.
Example: "myplug.pass" instead of just "pass" as it will collide wit the generic "pass" Token definition.
Parameters
[in]keyThe key string for the Token itself without the "$".
[in]helpAn help string used to show the Token in the menu.
[in]exampleAn example string for the use of the Token.
[in]hookAn implemented TOKENHOOK used to define the string to replace the Token.
Returns
true if successful, otherwise false.

◆ RegisterHiddenToken()

Bool RegisterHiddenToken ( const String key,
const String help,
const String example,
TOKENHOOK hook 
)

Registers a new Token that can be used in a render filename but hides it from the render filename menu.

Note
The key is the identifier for the Token and has to be unique. For this reason identify your plugin in the Token key as a prefix.
Example: "myplug.pass" instead of just "pass" as it will collide wit the generic "pass" Token definition.
Since
R18
Parameters
[in]keyThe key string for the Token itself without the "$".
[in]helpAn help string used to show the Token in the menu.
[in]exampleAn example string for the use of the Token.
[in]hookAn implemented TOKENHOOK used to define the string to replace the Token.
Returns
true if successful, otherwise false.