Skip to content

Instantly share code, notes, and snippets.

@lapaev
Created February 24, 2015 19:16
Show Gist options
  • Select an option

  • Save lapaev/036178ef60f44b0ae6d2 to your computer and use it in GitHub Desktop.

Select an option

Save lapaev/036178ef60f44b0ae6d2 to your computer and use it in GitHub Desktop.
import maya.cmds as cmds import maya.OpenMaya as om import os #Changes the name of file nodes to their Image Name fileNodes = cmds.ls(textures=True) for f in fileNodes: cmds.select(f, replace=True) imageNameFull = cmds.getAttr(".fileTextureName") imageNameBase = os.path.basename(imageNameFull) imageName, imageExt = os.path.splitext(imageNameBase) cmds.rename(f, imageName) om.MGlobal.displayInfo("Changed name on all file Nodes")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment