Saori Yoshimoto work notes since 2018

Tuesday, July 23, 2019

[Hython] Change a path Linux to Windows

import os

print "############################################################"

fp_bas = '/root/work/cache'
fp_tar = 'E:\work\cache'
fpn_tar = fp_tar.decode('ascii').replace(chr(92),'/')

root = hou.node('/')
all_nodes = root.allSubChildren()
for n in all_nodes:
    if n.type().name() == 'filecache':
        if not 'setLoader' in n.path():
            fp = n.evalParm('file')
            fpn = fp.replace(fp_bas,fpn_tar)
            n.parm('file').set(fpn)
         
            print n.path()
            print fpn
            print "----"



---------------------------
Reference HP: Thx a lot.

No comments:

Post a Comment