Skip to content

Instantly share code, notes, and snippets.

@kanishk2391
Created February 25, 2017 06:45
Show Gist options
  • Save kanishk2391/5488058f10cdb1f66593bb108021c50c to your computer and use it in GitHub Desktop.
Save kanishk2391/5488058f10cdb1f66593bb108021c50c to your computer and use it in GitHub Desktop.
Switch Cameras
//Switch Perspective Cameras
$currentCamera = `lookThru -q`;
string $allCameras[];
$allCameras = `listCameras -p`;// This will select perspective cameras only
int $nextCamera;
for($pos=0;$pos<size($allCameras);$pos++)
{
if($currentCamera == $allCameras[$pos]) $nextCamera = $pos+1;
}
if($nextCamera>=size($allCameras)) $nextCamera = 0;
lookThru $allCameras[$nextCamera];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment