searchReplaceNames "joint" "finger" "selected";
So in python I did:
import maya.mel as mm
mm.eval("searchReplaceNames "joint" "finger" ")
But the mel is not well evaluated,beacuse there is the quote sign in
both names joint and finger...I know I should be skipping signs in
order to evaluate it as a string,but I am not succeeding to do it.
Thx
[ x.replace('joint', 'finger') for x in cmds.ls(sl=1)]
same goes for pymel objects
-chad
Also worth mentioning here is the strength of using the api for such operations. For instance, it's straight forward to grab all of the MObjects of the nodes you are working on, before renaming them. If you rename a number of nodes in the same hierarchy using a mel-centric approach you need to do some pretty ugly string manipulation to ensure that you don't maintain a reference to a node that was renamed by your action. If you grab the MObjects first, you don't have to worry about this possibility since renaming an MObjects won't change its address.
same goes for pymel objects
-chad
it is if you're working with shortest unique names and the act of
changing one of the objects in your list causes other names in the
list to become invalid (no longer points to a unique object). and
it's a lot uglier than not having to worry about it at all, as with
pymel.
-chad