Custom Tokens with Python?
On 29/03/2017 at 07:36, xxxxxxxx wrote:
I've been lurking on here for some time and always found an answer to what i needed, so a massive thank you to all who provide their knowledge on here for free, it's an amazing forum!
I'm looking to create some custom render tokens to use through the Python implementation in Cinema. I had a quick look and i see that it is well documented in the C++ SDK, using RegisterToken() and TokenEntry().
My question is, are we able to get at this with the Python SDK? I don't have any experience with C++ so can't go down that route (for the time being).
Is anybody able to provide any info or point me in the right direction?
On 29/03/2017 at 07:40, xxxxxxxx wrote:
Take a look at https://github.com/PluginCafe/cinema4d_py_sdk/tree/master/scripts/tokensystem I think you get everything what you need.
Anyway thanks you I didn't know this class exist I always did this kind of stuff manually with os module and some regex.
On 30/03/2017 at 06:10, xxxxxxxx wrote:
Thanks for the reply gr4ph0s, much appreciated.
I still need to properly dig through the documentation on this topic, one thing that isn't clear is that if it's possible to register my own custom tokens through Python (which are shown with the command tokensystem.GetAllTokenEntries(), i would like my token to show up here).
Essentially I want to register a custom token: $PT, which references the parent output filepath so it can be used in the child render setting.
Let me know if this is possible with Python to begin with, if not i don't want to waste time barking up the wrong tree!
On 30/03/2017 at 07:45, xxxxxxxx wrote:
welcome to the Plugin Café forums
Unfortunately currently our Python SDK is lacking the means to register new tokens. We have added it to our list of needed additions.
On 30/03/2017 at 07:50, xxxxxxxx wrote:
Thanks for the reply, that saved me some time!
Is it something you plan on including in future updates to the Python SDK, or will it be kept for C++?
On 30/03/2017 at 07:54, xxxxxxxx wrote:
I probably was too slow with my edit of the last post. While I can't tell, when we will add it, I'm pretty sure we will. We are constantly working on improving the coverage of the Python SDK.
On 30/03/2017 at 07:57, xxxxxxxx wrote:
Ha no worries, was eager to find out!
That's really cool, thank you, will keep an eye out for it in future releases.