JaredTaylor
11-26-2012, 09:55 PM
Hi,
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
import sys
'''
Rename popup box for outliner - copy/paste this script into a hotkey field in the hotkey editor
'''
try:
item = cmds.ls(os = True)[0]
except:
item = 'null'
if item == 'null':
print "Nothing Selected!",
sys.exit()
txtA = cmds.promptDialog(t = "Rename", tx = item, button = ['Rename', 'Cancel'], db = 'Rename')
if txtA == 'Rename':
tval = cmds.promptDialog(tx = True, q = True)
cmds.rename(item, tval)
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.
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
import sys
'''
Rename popup box for outliner - copy/paste this script into a hotkey field in the hotkey editor
'''
try:
item = cmds.ls(os = True)[0]
except:
item = 'null'
if item == 'null':
print "Nothing Selected!",
sys.exit()
txtA = cmds.promptDialog(t = "Rename", tx = item, button = ['Rename', 'Cancel'], db = 'Rename')
if txtA == 'Rename':
tval = cmds.promptDialog(tx = True, q = True)
cmds.rename(item, tval)
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.
