Is there a way to query the name, attribute and default value of a c4dtoa 'User Data' node in Python? I looked for a corresponding .h file for a solution, but found that these nodes appear to be defined by c4dtoa.mtl instead.
I'd like to iterate through the shader network extracting User Data nodes to create artist-oriented GUI elements such that multiple objects can have different looks using the same shader.
Hi Shawn,
Yes, it's possible to query and modify the shader network via custom messages. Check out the documentation here: https://support.solidangle.com/display/A5AFCUG/Shader+Network+%7C+Python
There are some example scripts at the bottom of the docs.
Once you get the shaders you can check for the type like:
ARNOLD_SHADER_GV = 1033990
C4DAI_GVSHADER_TYPE = 200
C4DAIN_USER_DATA_RGB = 547120169
if shader.GetOperatorID() == ARNOLD_SHADER_GV and shader[C4DAI_GVSHADER_TYPE] == C4DAIN_USER_DATA_RGB:
# do something
Tthe node ids are in api/include/util/NodeIds.h. The parameter ids can be generated with a hash function which you find in the docs. For example hashid("user_data_rgb.attribute") or hashid("user_data_rgb.default"). You can use kick to list the available attributes (kick -info n user_data_rgb).
Thank you! I think this is exactly what I was after. I'll give it a go when I'm back on this project.
I made a custom wrapper around the current python api of c4dtoa, that make it way more easier to deal with. The projet is open source ,I did it initally for a custom made material converted but if it can help any other devs, it's welcome !
https://gr4ph0s.github.io/C4DToA_python_wrapper/
Very cool! Thank you! This makes things much easier. Unfortunately the project I was working on was postponed. But I'll keep it in mind 🙂