Solved Custom Tokens with Team Render Server

our Cinema 4D plug-in is using custom tokens to generate the render path dynamically. When using Team Render Server for rendering, our tokens are not translated.
This is the render path we set in "Edit Render Settings":

This is the path, where the rendering is put to:

We expect the rendering to be put into the following path:

If we use "Render To Picture Viewer" in Cinema 4D, our custom tokens are translated correctly.
Also, if we use standard tokens (e.g. /$take/$res)​ in our project and render with Team Render Server.

All machines have installed the necessary plug-ins installed correctly.

How can we use Team Render Server with our own tokens?

Thank you for your help.

Hi @Janosch

Thanks for reaching us normally they should just work as a normal token, in fact, Cinema 4D ones are built the same way 3rd party does, so normally no difference should happen.

  1. Are they Python Or C++ Token?
  2. Are you sure your tokens are correctly registered even in Team Render Client by printing/logging the result of RegisterToken?
  3. Does your token is executed?
  4. Are you sure your token has everything it needs to works (I guess $layoutid work only on your custom scene)?

Thanks in advance,

I'll just chime in here, as I'm involved in that project, too.

So the token hook needs to access certain elements of the scene to get their values, and the problem (thankfully) is easily reproducible.

I wrote a sample plugin that recreates the behaviour by simply returning data from the first object in the scene. Download it from our dropbox:

Here is the code:

This is the render setting in my example scene (which just contains a Cube):

Here is the render result in the Picture Viewer, notice the correct file name:

Uploading and rendering the file on TeamRender produces this:

The debugger clearly shows that doc->GetFirstObject() returns nullptr.

Only asking personal code questions here.

Hi, unfortunately, there is an issue in the Team Render Server that prevents your script to work were to speed up things on the team render side only render data are loaded first to setup stuff like filename.

Nothing that you can fix on your side.

I've opened a bug report about it.

I will keep you in touch.

Thanks for your reply! Too bad there's nothing we can do on our side to fix this. Is at least the document container loaded, so we could maybe store some information there before exporting saving the scene for TR use?

Only asking personal code questions here.

@fwilleke80 Yes or the RenderData but that means the data needs to be there before the token evaluation which is done before any scene execution render wise.