// =========================================================================== // 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: 25 Jan 2008 // // Description: // doAnimLayerAddObjectsArgList does the actual work of adding an object // to animation layers. // // Input Arguments: // $version: The version of this option box. Used to know how to // interpret the $args array. // // $args // Version 1 // [0] $whichAttrsToAdd - can be 0,1,2. 0 == Add all keyable attributes, // 1 == from channel box, // 2 == Add all keyable except // [1] $excludeTranslate - if $whichAttrsToAdd == 2, will exclude adding the translate attr // [2] $excludeRotate - if $whichAttrsToAdd == 2, will exclude adding the rotate attr // [3] $excludeScale - if $whichAttrsToAdd == 2, will exclude adding the scale attr // [4] $excludeDynamic - if $whichAttrsToAdd == 2, will exclude adding the dynamic attr // [5] $excludeBool - if $whichAttrsToAdd == 2, will exclude adding the Boolean attr // [6] $excludeEnum - if $whichAttrsToAdd == 2, will exclude adding the Enum attr // // global proc int doAnimLayerAddObjectsArgList( string $version, string $args[] ) { int $versionNum = $version; int $whichAttrsToAdd = $args[0]; int $excludeTranslate = $args[1]; int $excludeRotate = $args[2]; int $excludeScale = $args[3]; int $excludeDynamic = $args[4]; int $excludeBool = $args[5]; int $excludeEnum = $args[6]; global string $gSelectedAnimLayers[]; if(size($gSelectedAnimLayers) < 1) { string $errMsg = (uiRes("m_doAnimLayerAddObjectsArgList.kAnimLayerAddObjectsNoLayerSelected")); error($errMsg); return 0; } if($whichAttrsToAdd==0 || $whichAttrsToAdd==2) { for($layer in $gSelectedAnimLayers) { if (`objectType $layer` == "animLayer") { string $cmd = "animLayer -e -addSelectedObjects "; if($whichAttrsToAdd==2 && $excludeTranslate) { $cmd += "-excludeTranslate "; } if($whichAttrsToAdd==2 && $excludeRotate) { $cmd += "-excludeRotate "; } if($whichAttrsToAdd==2 && $excludeScale) { $cmd += "-excludeScale "; } if($whichAttrsToAdd==2 && $excludeDynamic) { $cmd += "-excludeDynamic "; } if($whichAttrsToAdd==2 && $excludeBool) { $cmd += "-excludeBoolean "; } if($whichAttrsToAdd==2 && $excludeEnum) { $cmd += "-excludeEnum "; } $cmd += $layer; evalEcho($cmd); } } return 0; } else { string $sel[] = `ls -sl`; for($obj in $sel) { string $attrs[]; $attrs = `selectedChannelBoxPlugs`; if(size($attrs) < 1) { string $format = (uiRes("m_doAnimLayerAddObjectsArgList.kAnimLayerAddObjectsNoAttrsToAdd")); string $errMsg = `format -stringArg $obj $format`; warning($errMsg); continue; } for($layer in $gSelectedAnimLayers) { if (`objectType $layer` == "animLayer") { for($attrToAdd in $attrs) { //selectedChannelBoxPlugs returns plugs not attrs evalEcho( "animLayer -edit -attribute "+$attrToAdd+" "+$layer ); } } } } } return 0; }