// =========================================================================== // 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. // =========================================================================== // // Procedure Name: // makeCameraRenderable // // Description: // This procedure makes the given camera renderable, and any // other camera non renderable. // It unlocks the renderable attribute, // and remove any renderLayerAdjustment // global proc makeCameraRenderable(string $camera) { // // First count how many renderable cameras exist // string $allCameras[] = `ls -cameras`; for ($i = 0; $i < size($allCameras); $i++) { removeRenderLayerAdjustmentAndUnlock ($allCameras[$i] + ".renderable"); catch(`setAttr ($allCameras[$i] + ".renderable") false`); } string $cam[]; if (catchQuiet($cam = `listRelatives -path -type "camera" $camera`)) { string $msg = (uiRes("m_makeCameraRenderable.kNoCamera")); error(`format -stringArg $camera $msg`); } if (size($cam) >= 1) $camera = $cam[0]; else if (! `objectType -isa "camera" $camera`) { string $msg = (uiRes("m_makeCameraRenderable.kNotCamera")); error(`format -stringArg $camera $msg`); } string $msg = (uiRes("m_makeCameraRenderable.kFoundCamera")); warning(`format -stringArg $camera $msg`); catch(`setAttr ($camera + ".renderable") true`); }