kajjin Posted September 27, 2016 Share Posted September 27, 2016 Hello everyone, im fairly new to houdini so, i might be doing something completely wrong. At the moment stuck at trying to connect 2 nodes through python. Im trying to replace a material with a new one that i create through python. (Original network Image A), the way i do it manually is I just create a MantraShader and drag the output into the suboutput input(Image B), and that works. So, im trying to do the same thing through python. Here is what ive got so far: import hou shaderPath = hou.node("/obj/materials/CarPaint/") OldShader= hou.node("/obj/materials/CarPaint/CarPaint_surface") shaderConnection= hou.node("/obj/materials/CarPaint/suboutput") NewShader = shaderPath.createNode('mantrasurface') NewShader.setName("NewShader") shaderConnection.setInput(1,NewShader) The problem is that im not sure if the setInput is the right way to go, and, i dont fully understand shaders, but when i disconnect the Oldshader from the suboutput, the input turns from pinkish to white, and when I try to connect my new MantraShader, it doesnt work. (Image C) Sooo, im definitely doing something wrong xD. If any of you have an idea of what im doing wrong, or a completely new approach let me know! Cheers! Quote Link to comment Share on other sites More sharing options...
Atom Posted September 27, 2016 Share Posted September 27, 2016 (edited) setInput is the way to go. You are just confusing surface with material. They are not the same thing, that is why they have different color node connectors. Try to create your new node as a surface type, not a material type. This GIF shows how you can easily find out the type of a node so you can use that identifier for node creation. Edited September 27, 2016 by Atom 1 Quote Link to comment Share on other sites More sharing options...
kajjin Posted September 27, 2016 Author Share Posted September 27, 2016 Thank you for your prompt answer!! And yeah, that makes sense! Thanks! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.