C4D How to manipulate nodes in the Node Editor using Python?

Forums: C4D How to manipulate nodes in the Node Editor using Python?
Post, discuss and share handy resources like textures, models and HDRI maps in this forum.
Forum rules
Please do not post any material that is copyrighted or restricted from public use in any way. OTOY NZ LTD and it's forum members are not liable for any copyright infringements on material in this forum. Please contact us if this is the case and we will remove the material in question.

C4D How to manipulate nodes in the Node Editor using Python?

Postby aliaboshady123 » Mon Mar 25, 2024 7:00 pm

aliaboshady123 Mon Mar 25, 2024 7:00 pm
I'm trying to automate something that I do manually all the time and it takes a long time. I have this Octane material that has these nodes that I want to edit. Basically set each of these shaders' files. So how do I get a references to these 52 nodes in the image? And to go a step further, is there a way to create them in any Octane material (and then get their references)?

Image

I also have this simple script that opens the Octane Node Editor of the selected object. Not sure if this would be needed.

Code: Select all
def main():
    materials=doc.GetMaterials()
    obj =doc.GetActiveObject()

    if not obj:
        c4d.gui.MessageDialog("Please select an object or a material tag.")
        return

    objMaterial= obj.GetTag(c4d.Ttexture)
    if objMaterial == None:
        c4d.gui.MessageDialog("Selected object has not a material tag.")
       
    c4d.CallButton(objMaterial.GetMaterial(), c4d.OCT_MATERIAL_NODE_EDITOR)
   
    c4d.EventAdd()
if __name__=='__main__':
    main()   
aliaboshady123
 
Posts: 2
Joined: Tue Mar 19, 2024 1:08 am

Return to Resources and Sharing


Who is online

Users browsing this forum: No registered users and 4 guests

Tue Apr 30, 2024 11:47 am [ UTC ]