Skip to content

Instantly share code, notes, and snippets.

@phmongeau
Created May 4, 2013 20:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phmongeau/5518575 to your computer and use it in GitHub Desktop.
Save phmongeau/5518575 to your computer and use it in GitHub Desktop.
mel script to get opposite object name
proc string getMirror(string $obj_name) {
string $reg = "_[RL]_";
string $side = `match $reg $obj_name`;
string $otherside = "_L_";
if($side == "_L_") {
$otherside = "_R_";
}
else if ($side == "_T_" || $side == "_C_") {
$otherside = $side;
}
string $s1 = `substitute $reg $obj_name $otherside`;
return $s1;
}
//TEST
string $result = getMirror("JT_C_hip_1");
print $result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment