// =========================================================================== // 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: 27 November 1998 // // Procedure Name: // removeFromCharacter // // Description: // remove the given list of items from the given character. If a node is // is included in the items passed in, then all attributes of that node // will be removed from the character. This procedure will not search // sub characters. // // Input Arguments: // $character - character to remove from // $items[] - items to remove // // Return Value: // None. // global proc removeFromCharacter( string $character, string $items[] ) { if (nodeType($character) != "character") { error( (uiRes("m_removeFromCharacter.kACharInTheList")) ); return; } string $removeList[]; for ( $item in $items ) { if ( ( `gmatch $item "*.*"` ) || ( "character" == `nodeType $item` ) ) { // Item is a specific attribute, or it is another character. // Try to remove it as is // $removeList[size($removeList)] = $item; } else { // We have a node. We should remove any attributes of the // node from the character // string $setContents[] = `character -query $character`; $matchString = ( $item + ".*" ); for ( $setItem in $setContents ) { if ( `gmatch $setItem $matchString` ) { // We have an attribute of the given node // in the character // $removeList[size($removeList)] = $setItem; } } } } character -remove $character $removeList; }