Skip to content

Instantly share code, notes, and snippets.

@raytirat
Last active October 13, 2017 09:14
Show Gist options
  • Save raytirat/d3b46b7aeedcd2db935f0569582a8fdf to your computer and use it in GitHub Desktop.
Save raytirat/d3b46b7aeedcd2db935f0569582a8fdf to your computer and use it in GitHub Desktop.
import hou
import os
import json
dirPath = '/'.join(os.path.dirname(hou.hipFile.path()).split('/')[:5]) + '/assets/texture/texture.json'
matList = json.load(open(dirPath))
sel = hou.selectedNodes()[0]
if sel:
mat = sel.allSubChildren()
for m in mat:
r = m.name()
for t in matList:
if r == t[0]:
m.parm('diff_colorUseTexture').set(1)
m.parm('diff_colorTexture').set(t[1])
print 'Cool'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment