list of unique attribute values in python

   3179   2   3
User Avatar
Member
143 posts
Joined: Sept. 2017
Offline
Hi,

I'm currently trying to script drag and drop behavior for different types of files in houdini.
I also have problems with hda files, which I try to solve in another forum post, but this one is about fbx and obj files.

I want to automatically create materials inside a matnet node, but for that, I'd need a list of unique shop_materialpath attribute values. How would you go about getting this list of unique values?

Thanks,
Ivan
User Avatar
Member
192 posts
Joined: Oct. 2018
Offline
node = hou.node('/obj/testgeometry_crag1/testgeometry_crag1')
shop_path = node.geometry().findPrimAttrib("shop_materialpath")

if shop_path :
    for path in shop_path.strings() :
        print path
else :
    print "No shop paths exist."
User Avatar
Member
143 posts
Joined: Sept. 2017
Offline
Wow! Thank you! Works like a charm.
  • Quick Links