Friday, April 4, 2014

Using scripting in Maya to help with selecting things

Happy Friday,

Here's a script i wrote today to help make selections in Maya.  I used this to add a prefix to all transforms and joints in a group.

Hope you find this script helpful:

//prepare selection for renaming -- default uses entire hierarchy of single thing selected
if(size(`ls -sl`) == 1){
select -hierarchy;
select -r `ls -sl -type transform -type joint`;//only select transforms and joints

 import maya.cmds as cmds

sel = []
if len( selection = True ) ) == 1: = True)
    sel = selection = True , type = ["transform","joint"] ) sel, replace = True)

It is very helpful to use this in conjunction with Michael Comet's amazing rename tool to add prefixes on his website at (comet-cartoons dot com)


Inspired by
Michael Comet (comet-cartoons dot com).