Last active
October 13, 2017 09:14
-
-
Save raytirat/d3b46b7aeedcd2db935f0569582a8fdf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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