Solved API questions

is there a built in way to convert the render setting file tokens to what they are represent?
also is there a way to save a .c4d file with out the file location window popping up using python?

Hi @jesse first of all welcome in the plugincafe community.

I would like to point you to a few rules for your next topics (I've set up this one correctly).

Now in regards to the first question, yes it's possible you should use c4d.modules.tokensystem.StringConvertTokensFilter or c4d.modules.tokensystem.FilenameConvertTokensFilter.

A quick example:

import c4d


def main():
    # Defines a path, with the $frame and $prj token
    path = r"/myprojects/topnotchproject/theimage_$frame_$prj.png"
    print(path)

    # Setups the RenderPathData
    rpd = {'_doc': doc, '_rData': doc.GetActiveRenderData(), '_rBc': doc.GetActiveRenderData().GetData(), '_frame': 1}

    # Excludes the project token to the "tokenization"
    exclude = ['prj']

    # Renders token to string
    finalFilename = c4d.modules.tokensystem.StringConvertTokensFilter(path, rpd, exclude)
    print(finalFilename)

    # Renders tokens to string and also change / to \
    finalFilename = c4d.modules.tokensystem.FilenameConvertTokensFilter(path, rpd, exclude)
    print(finalFilename)


if __name__ == '__main__':
    main()

While it's in C++, it's still worth looking at the Token Manual.

Then for the second question, you can save a .c4d file (or a document) by calling c4d.documents.SaveDocument, by default dialog are not allowed to pop up.

If you have any questions, let me know.
Cheers,
Maxime.

@m_adam thanks
so using c4d.documents.SaveDocument the window is still showing up.. even with "SAVEDOCUMENTFLAGS_NONE" or "SAVEDOCUMENTFLAGS_AUTOSAVE"
could it still be showing up because of an error in the file path its trying to save to or something like that?