// =========================================================================== // 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. // =========================================================================== // // // Creation Date: 18 May 2005 // // // // // // int renderLayerUnparent( string $parent, string $child ) // // // int : 1 if render layer unparenting was successful, 0 otherwise. // // // This procedure causes render layer node $child to be removed from // render layer node $parent's list of contained render layers. // // See also renderLayerParent(). // // // string $parent The render layer node we want to be the parent. // string $child The render layer node we want to be the child. // // // // Create two render layer nodes. // // // string $parent = `createRenderLayer -name "parent" -empty`; // string $child = `createRenderLayer -name "child" -empty`; // // // Make "parent" contain "child". // // // int $status = renderLayerParent( $parent, $child ); // // // Now unparent. // // // int $status = renderLayerUnparent( $parent, $child ); // // // global proc int renderLayerUnparent( string $parent, string $child ) { int $status = 1; // Remember the current render layer node. Select the default render // layer. This restores any previous adjustments. // string $current = `editRenderLayerGlobals -q -currentRenderLayer`; if(catch(`editRenderLayerGlobals -currentRenderLayer "defaultRenderLayer"`)) { $status = 0; } // Try to perform the disconnection. If the connection doesn't exist // an error will be issued by disconnectAttr and an error condition // will also be caught, setting $status to 0. // string $cmd = "disconnectAttr -na "+$child+".rlp "+$parent+".rlc;"; if ( catch( eval( $cmd ) ) ) { $status = 0; } // Make the previous render layer current again. This sets any // adjustments. // if(catch(`editRenderLayerGlobals -currentRenderLayer $current`)) { $status = 0; } return( $status ); }