I have a rename script that works fine except for one thing - if an object name is not unique the name that comes into the rename box has the full path which is not what I want for convenience's sake.
I need a way to cmds.ls(sl = True) and have it return a non-unique name.
import maya.cmds as cmds
Rename popup box for outliner - copy/paste this script into a hotkey field in the hotkey editor
item = cmds.ls(os = True)
item = 'null'
if item == 'null':
print "Nothing Selected!",
txtA = cmds.promptDialog(t = "Rename", tx = item, button = ['Rename', 'Cancel'], db = 'Rename')
if txtA == 'Rename':
tval = cmds.promptDialog(tx = True, q = True)
And before anyone asks, I assign this to a hotkey so I don't have to grab the mouse just to rename an item, I can pickwalk so much faster.