c4d.modules.tokensystem

Follow me to the Inheritance diagramm .

New in version R17.048.

See also

Scripts for the Token System API in the examples .

Functions

c4d.modules.tokensystem. StringConvertTokens ( path , rpData )

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

Parameters:
  • path ( str ) – The original path string.
  • rpData ( dict ) – The data used to extract value for Tokens. See RenderPathData Dictionary .
Return type:

bool

Returns:

The converted string, or the original path if any error.

c4d.modules.tokensystem. FilenameConvertTokens ( path , rpData )

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

Parameters:
  • path ( str ) – The original path filename.
  • rpData ( dict ) – The data used to extract value for Tokens. See RenderPathData Dictionary .
Return type:

bool

Returns:

The converted filename, or the original path if any error.

c4d.modules.tokensystem. StringConvertTokensFilter ( path , rpData , 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:
  • path ( str ) – The original path string.
  • rpData ( dict ) – The data used to extract value for Tokens. See RenderPathData Dictionary .
  • exclude ( list ) – A list of Tokens strings to be ignored.
Return type:

bool

Returns:

The converted string, or the original path if any error.

c4d.modules.tokensystem. FilenameConvertTokensFilter ( path , rpData , 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:
  • path ( str ) – The original path filename.
  • rpData ( dict ) – The data used to extract value for Tokens. See RenderPathData Dictionary .
  • exclude ( list of str ) – A list of Tokens strings to be ignored.
Return type:

bool

Returns:

The converted filename, or the original path if any error.

c4d.modules.tokensystem. StringExtractRoot ( path )

Searches for the first Token in path . If it is found and it is in-between “/..” returns the preceeding directory path string.

Parameters: path ( str ) – The original path string.
Return type: bool
Returns: The root string path, or the original string if no Token is found.
c4d.modules.tokensystem. FilenameExtractRoot ( path )

Searches for the first Token in path . If it is found and it is in-between “/..” returns the preceeding directory path filename.

Parameters: path ( str ) – The original path filename.
Return type: bool
Returns: The root filename path, or the original filename if no Token is found.
c4d.modules.tokensystem. FilenameSlicePath ( path )

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

Parameters: path ( str ) – The original path filename.
Return type: tuple(str, str)
Returns: The root and filename paths.
c4d.modules.tokensystem. GetAllTokenEntries ( )

New in version R17.053.

Returns a list of all available Token entries.

For instance the following code prints all registered tokens:

import c4d
tokens = c4d.modules.tokensystem.GetAllTokenEntries()
for entry in tokens:
  print entry
							
Return type: list of dict
Returns: All the registered Token information, or None if an error occurred.

RenderPathData Dictionary

The rpData (RenderPathData) parameter of StringConvertTokens() , FilenameConvertTokens() , StringConvertTokensFilter() and FilenameConvertTokensFilter() accepts a dictionary with the data to convert tokens.

These are the keys that can be set in such dictionary:

For instance the dictionary can be initialized like this:

rpd = {'_doc': doc, '_rData': renderData, '_rBc': renderSettings, '_frame': 1}
					

See also

Scripts for the Token System API in the examples .

Table Of Contents