Skip to content

Instantly share code, notes, and snippets.

@takavfx
Last active December 5, 2017 20:26
Show Gist options
  • Save takavfx/fe05a7633afceb85bc293204b3d66fe6 to your computer and use it in GitHub Desktop.
Save takavfx/fe05a7633afceb85bc293204b3d66fe6 to your computer and use it in GitHub Desktop.
import hou
import re
node = hou.pwd()
geo = node.geometry()
path_attrib = geo.addAttrib(hou.attribType.Prim, 'path', '')
instance = hou.node('..').name()
base = 'base'
name = 'name'
for prim in geo.prims():
grps = prim.groups()
for grp in grps:
name = grp.name()
base = re.split(r'Shape$', grp.name())[0]
path_name = '/' + instance + '/' + base + '/' + name
prim.setAttribValue(path_attrib, path_name)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment