def main(): sel = pm.ls(sl=1) for i in sel: standin = i.getShape(type = "aiStandIn") if standin : ass_file = standin.dso.get() ass_name = pm.Path(ass_file).parent.namebase at.loadASS(ass_file) for n in at.getASSNode("MayaFile"): filename = at.getASSParameter(n, "filename") namebase = pm.Path(filename).namebase ext = pm.Path(filename).ext ma = re.match(rule, name) if ma: proj = ma.group("proj") scene = ma.group("scene") path = PROJ_SETS_SOURCEIMAGES_PATH_DIC[proj] fileinSer = os.path.join(path + scene, name+ext) at.setASSParameter(n, "filename", fileinSer) at.saveASS(ass_file)
#coding:utf-8 ''' Created on 2015年12月10日 上午10:50:01 @author: TianD @E-mail: [email protected] @Q Q: 298081132 ''' import os, os.path import ass_tool if __name__ == "__main__": for roots, dirs, files in os.walk("E:\\ArnoldStandIn"): for f in files: ass_tool.loadASS(os.path.join(roots, f)) for n in ass_tool.getASSNode("MayaFile"): print n filename = ass_tool.getASSParameter(n, "filename") print filename newfilename = filename.replace("//kaixuan.com/kx", "Z:") print newfilename ass_tool.setASSParameter(n, "filename", newfilename) ass_tool.saveASS(os.path.join(roots, f))