// =========================================================================== // Copyright 2018 Autodesk, Inc. All rights reserved. // // Use of this software is subject to the terms of the Autodesk license // agreement provided at the time of installation or download, or which // otherwise accompanies this software in either electronic or hard copy form. // =========================================================================== // Description : Get multi-camera children assuming child is passed in. global proc string[] getMultiCameraRenderList( string $camera ) { string $cameras[]; $cameras[0] = $camera; string $parentXform[] = `listRelatives -path -parent $camera`; if ( `pluginInfo -query -loaded "stereoCamera"` ) { string $parentXform[] = `listRelatives -path -parent $camera`; if ( size($parentXform) > 0 ) { python("import maya.app.stereo.stereoCameraRig as stereoCameraRig"); // Make sure we have a rig before trying to find it's children string $pyCmd = ("stereoCameraRig.isRigRoot('" + $parentXform[0] + "')"); int $isRig = python( $pyCmd ); if ($isRig) { int $cameraCount = 0; $pyCmd = ("str(stereoCameraRig.leftCam('" + $parentXform[0] + "'))"); string $result = python( $pyCmd ); if ( $result != "None" ) { $cameras[$cameraCount] = $result; $cameraCount++; } $pyCmd = ("str(stereoCameraRig.centerCam('" + $parentXform[0] + "'))"); $result = python( $pyCmd ); if ( $result != "None" ) { $cameras[$cameraCount] = $result; $cameraCount++; } $pyCmd = ("str(stereoCameraRig.rightCam('" + $parentXform[0] + "'))"); $result = python($pyCmd); if ( $result != "None" ) { $cameras[$cameraCount] = $result; $cameraCount++; } } } } return $cameras; } // Description: Get multi-camera children for camera rig global proc string[] getMultiCameraChildren( string $camera ) { string $cameras[]; $cameras[0] = $camera; if ( `pluginInfo -query -loaded "stereoCamera"` ) { python("import maya.app.stereo.stereoCameraRig as stereoCameraRig"); string $pyCmd = ("stereoCameraRig.isRigRoot('" + $camera + "')"); int $isRig = python( $pyCmd ); if ($isRig) { string $pyCmd = ("str(stereoCameraRig.leftCam('" + $camera + "'))"); string $result = python( $pyCmd ); if ( $result != "None" ) { $cameras[0] = $result; $pyCmd = ("str(stereoCameraRig.rightCam('" + $camera + "'))"); $result = python($pyCmd); if ( $result != "None" ) { $cameras[1] = $result; } } } } return $cameras; } // Check for immediate parent to see if it is a camera rig. If so // return it's name. Otherwise return an empty string. // TODO: remove this proc global proc string getParentCameraRig( string $camera ) { string $parent = ""; if ( `pluginInfo -query -loaded "stereoCamera"` ) { string $parentXform[] = `listRelatives -path -parent $camera`; if ( size($parentXform) > 0 ) { python("import maya.app.stereo.stereoCameraRig as stereoCameraRig"); // Make sure we have a rig before trying to find it's children int $isRig = python("stereoCameraRig.isRigRoot('" + $parentXform[0] + "')"); if ($isRig) { $parent = $parentXform[0]; } } } return $parent; } // Check to see if camera rigs are supported // TODO: remove this global proc int multipleCamerasSupported() { int $supported = 0; if ( `pluginInfo -query -loaded "stereoCamera"` ) { $supported = 1; } return $supported; }