// =========================================================================== // 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: Dec, 1999 // // Procedure Name: // doActivateClipArgList // // Description: // Activate/Deactivate 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 = de-activate // 1 = activate // 2 = toggle state // [1] $selectedClips : true/false, whether to also toggle selected clips // [2] $clip : single clip to operate upon, if not empty // global proc doActivateClipArgList( string $version, string $args[] ) { int $versionNum = $version; int $op; int $workOnSelection = 1; string $clip; if ($versionNum == 1) { $op = $args[1]; } else { $op = $args[0]; $workOnSelection = $args[1]; if (size($args) > 2) { $clip = $args[2]; } } string $selClips[]; if ($workOnSelection) { $selClips = getSelectedClips("noOptions"); } if (size($clip) > 0) { if (AWNumberOfOccurrencesInStringArray($clip,$selClips) == 0) { $selClips[size($selClips)] = $clip; } } string $removedClips[]; int $removeCount = 0; int $nclips = size($selClips); if ($nclips == 0) { if ($op == 0) { error((uiRes("m_doActivateClipArgList.kSelectClipDeactivate"))); } else if ($op == 1) { error((uiRes("m_doActivateClipArgList.kSelectClipActivate"))); } else { error((uiRes("m_doActivateClipArgList.kMustSelectClip"))); } } else { string $clip; for ($clip in $selClips) { string $sch = getClipScheduler($clip); int $clipIndex = getClipIndex($clip, $sch); string $clipName = `clipSchedule -ci $clipIndex -q -n $sch`; string $clipSource = `clip -q -scn $clipName`; string $ch[] = `listConnections -type character $sch`; if ("" != $clipSource && size($ch)) { string $cmdString; if ($op == 0) { $cmdString = ("clip -e -active \"default\" "+$ch[0]); } else if ($op == 1) { $cmdString = ("clip -e -active "+$clipSource+" "+$ch[0]); } else { string $activeClip = `clip -q -active $ch[0]`; if ($activeClip == $clipSource) { $cmdString = ("clip -e -active \"default\" "+$ch[0]); } else { $cmdString = ("clip -e -active "+$clipSource+" "+$ch[0]); } } evalEcho($cmdString); } } } string $operName = (uiRes("m_doActivateClipArgList.kActivated")); if ($op == 0) { $operName = (uiRes("m_doActivateClipArgList.kDeactivated")); } else if ($op == 2) { $operName = (uiRes("m_doActivateClipArgList.kToggled")); } string $numClips = size($selClips); string $msg = `format -stringArg $numClips $operName`; print $msg; }