// Copyright © 2007 Jason Gill All rights reserved // www.3dgill.com // // Directions: // - copy the mel file to you maya scripts directory // - start maya // - type "jgMirrorObject;" in the command line // - press enter // - select the plane you wish to mirror across // - type the names you wish to replace, such as a prefix // - select the object you wish to mirror // - hit "Mirror Object" // global proc mirrorObjectProc() { string $searchObj = `textFieldGrp -q -tx objectSearchTextGrp`; string $replaceObj = `textFieldGrp -q -tx objectReplaceTextGrp`; duplicate; searchReplaceNames $searchObj $replaceObj "hierarchy"; searchReplaceNames "1" "" "selected"; for ($mirObj in `ls -sl`) { select -r $mirObj; pickWalk -d up; for ($parObj in `ls -sl`) { group -em -n mirroringGroup; if ($parObj == $mirObj) { parent $mirObj mirroringGroup; } else { pointConstraint -o 0 0 0 -w 1 $parObj mirroringGroup; parent $mirObj mirroringGroup; } if ((`radioButtonGrp -q -sl mirObjAcrossRbGrp`) == 1) { setAttr mirroringGroup.sz -1; } if ((`radioButtonGrp -q -sl mirObjAcrossRbGrp`) == 2) { setAttr mirroringGroup.sx -1; } if ((`radioButtonGrp -q -sl mirObjAcrossRbGrp`) == 3) { setAttr mirroringGroup.sy -1; } if ($parObj == $mirObj) { parent -w $mirObj; } else { parent $mirObj $parObj; } delete mirroringGroup; } } } global proc jgMirrorObject() { if (`window -ex jgMirrorObjectGUI`) deleteUI jgMirrorObjectGUI; window -t "Jason Gill - Mirror Object - www.3dgill.com" -wh 400 160 -s false jgMirrorObjectGUI; columnLayout -cal "center"; columnLayout -cal "center"; radioButtonGrp -nrb 3 -l "Mirror Across" -la3 "XY" "YZ" "XZ" -sl 2 -cw4 150 50 50 50 -cl4 "center" "left" "left" "left" mirObjAcrossRbGrp; separator -w 400 -h 10; text -al "left" -w 350 -l "Replacement names for duplicated objects:"; textFieldGrp -l "Search For:" objectSearchTextGrp; textFieldGrp -l "Replace With:" objectReplaceTextGrp; separator -w 400 -h 15; setParent ..; rowLayout -nc 2 -cw2 50 300 -ct2 "both" "both"; text -l ""; button -l "Mirror Object" -w 250 -al "center" -c "mirrorObjectProc"; setParent ..; setParent ..; showWindow; }