Another couple of options: 
- the command cmds.rename returns the new name (which is often the name you 
gave it, but not always)
- you can rename without changing the selection by using cmds.rename(oldName, 
newName), and it will still all be selected when you're done.


On Wednesday, 9 January 2019 16:07:18 UTC+11, Francesco wrote:
>
> Hi Jakob,
>
> I never heard of the UUID (I'm still a beginner) but it works perfectly!
>
> I've changed the lines from 48 to 64 to this and it now works exactly as I 
> wanted. Thank you so much!!
>
> #Get UUID of renamed object (UUID to prevent error caused by long names 
>>> not matching)
>>>             newLongName= cmds.ls(sl= True, uuid= True)[0]
>>>             newNameSelection.insert(0, newLongName)
>>>             #Decrease number input by User by 1
>>>             startingNumberText= startingNumberText - 1
>>>         #Select UUID (re-establish original selection)
>>>         for each in newNameSelection:
>>>             cmds.select(cmds.ls(each), add= True)
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/43c13fbe-6cfd-4c8c-a8fb-7e8cfdfaa47e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to