i have been wrapping my head around it, but I cannot find anything. Or maybe I am thinking the wrong way.
What i want it to get selected Nodes out of my RS Material to edit the Parameters. But I cannot find anything in the SDK. Could not get anything out of the GvNode.
What I would like the script to do:
I want to select texture Nodes in my Materials and the script will change the color space to file-IO -> RAW
Thanks and happy holidays
Hi @cgweasel, to retrieve the selected node, like all BaseList2D (BaseOject,BaseTag,BaseMaterial, etc...) you can know there selection state with the method node.GetBit(c4d.BIT_ACTIVE).
So find bellow the complete code to do what you want:
# Checks if selected material is valid
mat = doc.GetActiveMaterial()
if not mat or not mat.CheckType(1036224) :
raise ValueError("There is no xpresso redshift material selected")
# Retrieve the output nodes, which is also the first node in the node hierarchy.
# Therefor we can iterate them as usual BaseList2D
node = mat[c4d.REDSHIFT_GRAPH_NODES]
# Check if this is a texture node and its selected
if node[c4d.GV_REDSHIFT_SHADER_META_CLASSNAME] == 'TextureSampler' and node.GetBit(c4d.BIT_ACTIVE):
# Set to Raw, to know the Id and the value I left click on the Filename parameter, User Interface -> Show SubChannel
# Then I dragged the ColorSpace parameter to the python console
node[c4d.REDSHIFT_SHADER_TEXTURESAMPLER_TEX0,c4d.REDSHIFT_FILE_COLORSPACE] = "RS_INPUT_COLORSPACE_RAW"
node = node.GetNext()
thank you very much. On a Xpresso Material, this works just fine. Unfortunately, I only use Node Materials. I know the type of those Materials is 5703, but it seems that everything else is not responding to nodes.
Thanks for the tipp with the sub-channels. Awesome. But this also does not work with nodes
Hi @cgweasel hope you had a nice Christmas time
Regarding your question, this has been answered in this post Change the ColorSpace of Redshift Texture Node?
Then you can find example about nodes graph in our GitHub repository, And I would advice you to look at modify_port_value.
I think with that you have all the information needed to make it work, if you struggle please let me know and I will be happy to help you. For the future please specify which node system you are using, since you mentioned GvNode I guessed that you used xpresso.