This script for Maya 2016, Maya 2017, and Maya 2018 will grab objects parented to world or world oriented/centered nodes.
/*
Limitations
Script can only mirror objects parented to world or world oriented and centered objects
For more concerns, please email me
*/
{
//Finds objects and lists them
string $nodes0[] = `ls -selection`;
//Clones and lists clones of selected objects
duplicate -rr ;
string $nodes1[] = `ls -selection`;
//Groups and lists group
doGroup 0 1 1 ;
string $group[] = `ls -selection`;
for ($node in $group)
{
//Loop through each object and obtain its node
string $node[] = `listRelatives $node`;
float $dimension = `getAttr ($node[0] + ".scaleX")` ;
//Set the x-scale attribute of each shape node to its negative counterpart
setAttr ($node[0] + ".scaleX") (-1*$dimension) ;
}
//Selects group
select -r $group ;
FreezeTransformations ;
//Parents objects to world
parent -world $nodes1 ;
select -cl ;
//Selects and deletes created groups
select -r $group ;
delete ;
//Selects and freezes transforms on affected objects
select -r $nodes0 ;
select -tgl $nodes1 ;
FreezeTransformations ;
}
// Script by Zachary Yarnot the DualVission
// Script for non-commercial and personal use only
// https://yarnot.com/Zach
// zach@yarnot.com
print(" Objects cloned and mirrored. Transforms frozen. ; ") ;
Update 06/09/2018 21:27 US EDT: Fixes typo in release preventing script from functioning with more than one nodes selected.