files = cmds.ls(type="file")
for item in files:
fullpath = cmds.getAttr('%s.fileTextureName' %item)
newpath = myCopy(fullpath, project_path) #mycopy uses copy2 and returns the new path
cmds.setAttr("%s.fileTextureName" %item, newpath,type="string") #setting the new path
|
import pymel.core as pm import os files = pm.ls(type="file") project_path = os.getenv('MAYA_PROJECT') def myCopy (path): return path.replace('/','') #does both / and //... for item in files: fileNode = pm.PyNode(item) fileNode.fileTextureName.set(myCopy(project_path), type='string') #setting the new path print fileNode.fileTextureName.get() #echos back old file path!!!!!!! |
|
import maya.cmds as cmds import os |
|
files = cmds.ls(type="file") |
project_path = os.getenv('MAYA_PROJECT') def myCopy (path): return path.replace('/','') #does both / and //... for item in files: cmds.setAttr( "%s.fileTextureName"%item, myCopy(project_path), type='string') #setting the new path print cmds.getAttr( "%s.fileTextureName"%item) #echos back old file path!!!!!!! |