// =========================================================================== // 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. // =========================================================================== global proc removeEmptyTracks (string $clipEditor) { // If there is a highlighted character just use that. string $connection = `clipEditor -q -highlightConnection $clipEditor`; string $connObjs[] = `selectionConnection -q -object $connection`; if( size( $connObjs ) == 0 ) { // Otherwise tidy all the characters visible in the editor. $connection = `clipEditor -q -mainListConnection $clipEditor`; $connObjs = `selectionConnection -q -object $connection`; } if( size( $connObjs ) == 0 ) { warning( (uiRes("m_removeEmptyTracks.kNoObjectsToRemoveTracks")) ); return; } string $charsToTidy[]; string $objsToTidy[]; for ($obj in $connObjs) { if (nodeType($obj) == "character") { $charsToTidy[size($charsToTidy)] = $obj; } else { $objsToTidy[size($objsToTidy)] = $obj; } } // Augment the list of characters to include all descendent characters. // int $charIndex = 0; while ( $charIndex < size( $charsToTidy ) ) { string $curCharacter = $charsToTidy[ $charIndex ]; string $allNodes[] = `character -q -nodesOnly $curCharacter`; for ($member in $allNodes) { // add subcharacters to the list of characters // if (nodeType($member) == "character") { $charsToTidy[size($charsToTidy)] = $member; } } $charIndex++; } // clean up the tracks for characters // for ( $char in $charsToTidy ) { string $scheduler = `character -q -scheduler $char`; if( $scheduler != "" ) { clipSchedule -removeEmptyTracks $scheduler; } } for ( $obj in $objsToTidy) { cacheFileTrack -removeEmptyTracks $obj; } }