Search - User list
Full Version: Read 'material:binding' via the 'Leaf Primitive Path'
Root » Solaris and Karma » Read 'material:binding' via the 'Leaf Primitive Path'
Carlo_Jongen
Attached to this post the screen capture 'MaterialBinding_Solaris.jpg'

I have a python script that gets the path from a selected Leaf Primitive. Once I have the path from the Leaf Primitive ( in my example '/Variant/MFZ6/Carabiner4_Black' ) How can I get the path inside the 'material:binding' ( in my example '/Variant/materials/HighRes/MFZ6/Carabiner4_Black' ) out of the Leaf Prim Path?

Note that in this case I have the Display flag set on a Set Variant Node but I don't necessarily have the Set Variant node selected.
So the next code doesn't work
```hou.selectedNodes().stage().GetObjectAtPath(SingleSelectedPrimPath+'.material:binding')```

So how do I read the path inside the 'material:binding' once I have the 'Leaf Primitive Path' with Python?
alexwheezy
To give you an example
node = hou.node("/obj/lopnet1/pig").stage().GetObjectAtPath("/pig/geo/shape/PigNeck.material:binding")
targets = node.GetTargets()
Carlo_Jongen
alexwheezy
hou.selectedNodes().stage().GetObjectAtPath(SingleSelectedPrimPath+'.material:binding')
This is what I had, but you can run into a situation where you have your Leaf Prim selected but not have any other perticular node selected. I wanted to avoid to use the next methode. However I don't think it is possible to read the path inside the 'material:binding' when you only have the 'Leaf Primitive Path'. You'll alway need know the'hou.node("/obj/lopnet1/pig")' to be able to get the stage().
```hou.node("/obj/lopnet1/pig").stage().GetObjectAtPath("/pig/geo/shape/PigNeck.material:binding")```
Carlo_Jongen
Notice I have the 'pMe5_variant' selected and I have the Display Flag set to 'MFZ6_variant'. And I can jump to the correct Material. This is how I wanted it to work. Only thing is that it seems impossible to read the path inside the 'material:binding' directly from the 'Leaf Primitive Path'. That would have made things a bit easier.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB