// =========================================================================== // 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: Nov, 1999 // // Procedure Name: // doEnableClipArgList // // Description: // Remove a clip // // Input Arguments: // $version: The version of this option box. Used to know how to // interpret the $args array. // // $args // Version 1 // [0] $name : name of the clip window // [1] $op : type of enable operation: // 0 = disable // 1 = enable // 2 = toggle state // Version 2 // [0] $op : type of enable operation: // 0 = disable // 1 = enable // 2 = toggle state // [1] $selectedClips : true/false, whether to also toggle selected clips // [2] $clip : specific clip to enable, or "" // global proc doEnableClipArgList( string $version, string $args[] ) { int $versionNo = $version; int $op; int $workOnSelection = 1; string $clip; if ($versionNo == 1) { $op = $args[1]; } else { $op = $args[0]; $workOnSelection = $args[1]; if (size($args) > 2) { $clip = $args[2]; } } string $selClips[]; if ($workOnSelection) { $selClips = getSelectedClips("allowCache"); string $selCache[] = `ls -sl -type cacheFile`; for ($cache in $selCache) { $selClips[size($selClips)] = $cache; } } if (size($clip) > 0) { if (AWNumberOfOccurrencesInStringArray($clip,$selClips) == 0) { $selClips[size($selClips)] = $clip; } } int $tclips = 0; int $nclips = size($selClips); if ($nclips == 0) { if ($op == 0) { error( (uiRes("m_doEnableClipArgList.kSelectTheClipsDisabledErr")) ); } else if ($op == 1) { error( (uiRes("m_doEnableClipArgList.kSelectTheClipsEnabledErr")) ); } else if ($op == 2) { error( (uiRes("m_doEnableClipArgList.kEnabledOrDisabledErr")) ); } } else { string $clip; for ($clip in $selClips) { if (nodeType($clip) == "animClip") { string $sch = getClipScheduler($clip); int $clipIndex = getClipIndex($clip, $sch); int $newState; if ($op == 2) { int $current = `clipSchedule -ci $clipIndex -q -enable $sch`; $newState = !($current); } else { $newState = $op; } clipSchedule -ci $clipIndex -enable $newState $sch; } else { int $newState = $op; if ($op == 2) { int $current = `getAttr ($clip+".enable")`; $newState = !($current); } setAttr ($clip+".enable") $newState; } $tclips++; } } string $operName = (uiRes("m_doEnableClipArgList.kEnabled")); if ($op == 0) { $operName = (uiRes("m_doEnableClipArgList.kDisabled")); } else if ($op == 2) { $operName = (uiRes("m_doEnableClipArgList.kToggleEnableStateOn")); } string $print = (uiRes("m_doEnableClipArgList.kClips")); $print = `format -s $operName -s $tclips $print`; print($print); }