Hi,
So I know its probably me but I did have a good dig around the docs/forum but …
If I middle click say the surface shader it tells me its a vopmaterial type. Running hou.nodeCreate with type as vopmaterial errors out saying “type none doesn't exist”.
If I repeat it with a box, cone, transform, channel, anything else really, using the type operator show in the network view, it WILL work. So what's up with shaders or shader context nodes?
I did see if any of the hou.shader or shop methods would do the same but no. I also tried hou.as code and the hou ‘ opscript’ wrapper and that will give me function definition to create the shader nodes but also blows away the top level parms so then I need to run opparm wrappers as well and suddenly it becomes a major task with error checking, instead of the 4-5 lines of code it takes for anything else.
So am I missing something? I am just switching out some of the fbx materials on fbx imports with mantra shaders but I am falling over at the final lines of the script which generate the shader nodes because of this nodeCreate() error line.
Thnks
Why does hou.createNode() not work for material types?
2992 3 1- frankvw
- Member
- 61 posts
- Joined: 2月 2006
- Offline
- goldfarb
- スタッフ
- 3463 posts
- Joined: 7月 2005
- Offline
the gallery materials are all build with pre-sets
if you put down a vopmaterial or a principledshader and click on the ‘gear’ you'll see a list of pre-sets : Rocks, Dirt, Skin etc etc
you SHOULD be able to use the hscript command :
oppresetload vopmaterial1 name_of_preset (and related commands)
but it seems to be broken…
I'll log a bug…
#72545
if you put down a vopmaterial or a principledshader and click on the ‘gear’ you'll see a list of pre-sets : Rocks, Dirt, Skin etc etc
you SHOULD be able to use the hscript command :
oppresetload vopmaterial1 name_of_preset (and related commands)
but it seems to be broken…
I'll log a bug…
#72545
- Collaski
- Member
- 2 posts
- Joined: 11月 2015
- Offline
Hi,
Done a ton of python FBX and shader stuff on another forum recently and createNode definitely does work. As example, try ;
shader = hou.node('/shop')
shader.createNode(“vopmaterial”)
As arctor said, vopmaterial is a generalized type so you then need to apply a preset after, either creating your own preset or recycling an existing gallery entry using the hou.galleries methods. ie,
applyclay = hou.node('/shop/vopmaterial1')
hou.galleries.galleryEntries('Clay').applyToNode(applyclay)
Obviously need to check your presets and nodes match for any other contexts you may be using (pyro, cvex, RSL, whatever). canApplyToNode() method can check that for you.
Good luck!
Done a ton of python FBX and shader stuff on another forum recently and createNode definitely does work. As example, try ;
shader = hou.node('/shop')
shader.createNode(“vopmaterial”)
As arctor said, vopmaterial is a generalized type so you then need to apply a preset after, either creating your own preset or recycling an existing gallery entry using the hou.galleries methods. ie,
applyclay = hou.node('/shop/vopmaterial1')
hou.galleries.galleryEntries('Clay').applyToNode(applyclay)
Obviously need to check your presets and nodes match for any other contexts you may be using (pyro, cvex, RSL, whatever). canApplyToNode() method can check that for you.
Good luck!
- goldfarb
- スタッフ
- 3463 posts
- Joined: 7月 2005
- Offline
-
- Quick Links