Tokens are useful for dynamically populating values throughout a graph. Tokens are values which get populated with data based on predefined conditions. For example tokens could be used to automatically create the output path for a render based on a max file and camera name. Multiple tokens can be add together to create a complete file path.
In this example we will demonstrate how to generate the output paths for saving renders based on a combination of global tokens and custom tokens. For more information regarding the interface check out the Token Editor.
Creating a Custom Token
The first thing we will need to do is create a token for defining out project name. This will allow the graph to easily be used for other projects by simply just changing the project token value. In the Token Editor we will click and create a new token with the key being Project and value being the project Name.
Custom Token PROJECT = Turtles
Using Tokens in Graph Nodes
Next we will combine multiple tokens to generate the output path and naming for our renders using the Common Settings node. We will use this node to save renders using the render dialog's default output saver. To reference a token it must be prefixed with $$. Users can add together as many tokens as they want to create complex values.
Below we demonstrate a few ways to generate the output path.
Absolute Output Path
This example demonstrates a full file path to a specific location, using the custom token Project and then two global tokens, Shot and Pass.
Path = C:\Projects\$$PROJECT\$$SHOT\$$PASS.jpg
Results = C:\Projects\Turtles\Shot_020\Beauty.jpg
Relative Output Path
This example demonstrates a file path which is relative to the max file. In order to achieve this we use the global token MAXFILEPATH which gives us the folder location of the current max file. Then we add a folder called elements and then the name of our render which will be controlled by the name of the Pass node.
Path = $$MAXFILEPATH\elements\$$PASS.jpg
Results = C:\projects\Turtles\Shot_020\elements\Beauty.jpg
Testing Token Paths
To test a token path like the one created above, users can simply execute the graph and check the folder location on disk. In this case, since some of our token's values are generated by the Pass and Shot nodes, it's required to create those nodes and connect them as seen in the image above. Then select the top most node, which is the Shot node, and execute the graph.
Copyright © 2019 Boomer Labs and JokerMartini