Creating custom render tokens for Cinema 4D is very simple with Python. First you want to loop through tokens and check that there is no duplicates.

if __name__=="__main__":
    for registeredToken in c4d.modules.tokensystem.GetAllTokenEntries():
        if registeredToken.get("_token") in ["my_token"]:
            exit()

Next you register your custom token with following command:

c4d.plugins.RegisterToken("my_token", "Comment", "Example value", MyFunction)

Last but not least you need the function that returns some kind of string that the token outputs:

def MyFunction(data):
    return "myString" # Replace this with your more advanced script

Here is my collection of custom tokens that might be useful.

Tokens included:

  • Date Year Full (2021) – Token: $YYYY
  • Date Year Short (21) – Token: $YY
  • Date Month (01) – Token: $MM
  • Date Day (16) – Token: $DD
  • Date Hour (18) – Token: $hh
  • Date Minute (42) – Token: $mm
  • Date Second (10) – Token: $ss
  • PC Name (String) – Token: $pcname
  • Username (String) – Token: $pcuser
  • Render Engine (Redshift) – Token: $renderer
  • Project version – Token: $ver (Parses version number of the project name)
  • Object Name – Token: $objname (Returns name of the first object in the object manager)

N.B. Many of these tokens are now already included in newer Cinema 4D versions! When using custom tokens beaware that you are not trying to overwrite existing tokens.

Updated 02/09/2021
> Added two new tokens
> Fixed render engine name token

Place the folder in the zip file to Cinema 4D’s plug-in folder.
ar_tokens_v1.0.2.zip

Cinema 4D, Plug-in, Python