Skip to content

Instantly share code, notes, and snippets.

@hmasato
Created June 6, 2013 06:57
Show Gist options
  • Select an option

  • Save hmasato/5719786 to your computer and use it in GitHub Desktop.

Select an option

Save hmasato/5719786 to your computer and use it in GitHub Desktop.
[MAYA] _switchCams (emu Mobu)
proc _switchCams()
{
string $p=`getPanel -withFocus`;
if(!`modelPanel -ex $p`) return;
string $cams[]={};
string $cur=`modelPanel -q -cam $p`;
if(nodeType($cur)!="camera"){
$cams=`listRelatives -pa -s $cur`;
$cur=$cams[0];
}
$cams=`ls -cameras`;
string $ign[]={"frontShape", "sideShape", "topShape"};
$cams=stringArrayRemove($ign, $cams);
clear $ign;
int $id=0;
for($c in $cams){ if($c==$cur) break; $id++; }
if(!($id<size($cams))) return;
modelPanel -e -cam ($cams[($id+1) % size($cams)]) $p;
clear $cams;
}
_switchCams();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment