// =========================================================================== // 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. // =========================================================================== // // This procedure removes any render layer adjustment // and unlocks the attr, // so that command line rendering can override the value. // global proc removeRenderLayerAdjustmentAndUnlock(string $plug) { global string $gRenderLayersForCmdLineRender[]; // Keep track of the attributes we are removing from render layers. // These will be applied after render layers are activated at batch render time. global string $gMayaBatchRenderIgnoreOverridesForAttributes[]; $overideArraySize = size($gMayaBatchRenderIgnoreOverridesForAttributes); $gMayaBatchRenderIgnoreOverridesForAttributes[$overideArraySize] = $plug; if (`getAttr -lock $plug`) { // If the plug is from a referenced file this will fail, but we // catch the exception which allows our script to continue. catchQuiet(`setAttr -lock off $plug`); } // list of render layers in the scene if( size($gRenderLayersForCmdLineRender) == 0 ) { $gRenderLayersForCmdLineRender = `listConnections renderLayerManager.renderLayerId`; } // for each render layer, // call editRenderLayerAdjustment for($layer in $gRenderLayersForCmdLineRender) { // skip defaultRenderLayer if( $layer != "defaultRenderLayer" ) { editRenderLayerAdjustment -layer $layer -remove $plug; } } }