I'm using Maya as a platform to export data into someone elses toolchain so all my assets are imported..
I'm writing some scripts to do cleanup and pre processing before export ( I have some prior knowledge of python so chose it over mel which I know nothing about), came across a weird stumbling block
import maya.cmds as mc
allNodes = mc.ls(l=True)
length = len(myName)
for n in allNodes:
#check id this is an imported node and rename
if n[:length] == myName:
#this is a node to re-name!
newName = n[length:]
print "Re-name node '"+ n + "' to '"+newName+"'"
The above function is to strip out some garbage that my exporter puts in every node.
The print function indicates that the variables are getting the right names, but the mc.rename line is not actually renaming the nodes....
if I set n and newname as variables outside of this function
than the node is renamed fine.
What am i doing wrong?