Read 'material:binding' via the 'Leaf Primitive Path'

   205   3   1
User Avatar
Member
10 posts
Joined: Nov. 2017
Offline
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?

Attachments:
MaterialBinding_Solaris.jpg (180.0 KB)

User Avatar
Member
316 posts
Joined: Jan. 2013
Offline
To give you an example
node = hou.node("/obj/lopnet1/pig").stage().GetObjectAtPath("/pig/geo/shape/PigNeck.material:binding")
targets = node.GetTargets()
User Avatar
Member
10 posts
Joined: Nov. 2017
Offline
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")```
User Avatar
Member
10 posts
Joined: Nov. 2017
Offline
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.

Attachments:
2024-12-10 23-49-31.mp4 (740.9 KB)

  • Quick Links