I'm trying to script the creation of an Octane Universal Material. I am able to get most of the channels' shaders connected correctly using BaseList2D's InsertShader method. I am getting hung up, however, when trying to connect the Metallic texture to the Metallic shader.
The shader starts as a float with a Texture button next to it:
The button opens a contextual menu allowing the user to choose the type of shader:
With Image selected, I could then insert the shader into the ImageTexture slot as with the other channels:
This is my current code:
import c4d ID_OCTANE_BITMAP = 1029508 ID_OCTANE_SPECULAR_MAP = 1029508 def addMetallicTexture(id,mat): imageTexture = c4d.BaseShader(ID_OCTANE_BITMAP) imageTexture[c4d.IMAGETEXTURE_FILE] = "Clear_Plastic_Mat_metallic.png" mat[id] = imageTexture doc.AddUndo(c4d.UNDOTYPE_CHANGE, mat) mat[c4d.OCT_MAT_SPECULAR_MAP_LINK].InsertShader(imageTexture) mat.Message(c4d.MSG_UPDATE) c4d.EventAdd() def main(): doc = c4d.documents.GetActiveDocument() doc.StartUndo() mat = doc.GetActiveMaterial() addMetallicTexture(ID_OCTANE_SPECULAR_MAP,mat) doc.EndUndo() if __name__=='__main__': main()
It works in the creation of the node, but doesn't create the Image Texture into the Metallic channel so it can be inserted. No commands appear in the Script Log when I select "Image" nor when I connect the nodes in the Octane Node Editor, so I'm not sure how else to create the Image Texture.
I've also tried to call the Button, but it opens the contextual menu without inserting the Image Texture:
Can anyone help me script this? Thank you!