// =========================================================================== // 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. // =========================================================================== // // Procedure Name: // doCreateParentConstraintArgList // // Description: // Create a Parent constraint // // Input Arguments: // $version: The version of this option box. Used to know how to // interpret the $args array. // "1" : first verison of shot creation command // // $args // Version 1 // // [0] $maintainOffset : whether to maintain offset // [1] $rotateDecomp : rotation decompostion target, if true, decompose rotation to original object rotation when maintaining offset // [2] $axisTranslateX : if true to skip constraining translation on X axis // [3] $axisTranslateY : if true to skip constraining translation on Y axis // [4] $axisTranslateZ : if true to skip constraining translation on Z axis // [5] $axisRotateX : if true to skip constraining rotation on X axis // [6] $axisRotateY : if true to skip constraining rotation on Y axis // [7] $axisRotateZ : if true to skip constraining rotation on Z axis // [8] $weight : the weight to use for the Parent constraint // [9] $animLayer : if a layer is specified, the anim layer to put this constraint on. // [10] $overrideMode : whether to set the layer to override mode. // // Return Value: // none // global proc doCreateParentConstraintArgList( string $version, string $args[] ) { if( $version == 1 && size($args) != 11 ) { print (uiRes("m_doCreateParentConstraintArgList.kParentConstraintArgListWrongLength")); return; } string $cmd = "parentConstraint"; int $maintainOffset = $args[0]; int $rotateDecomp = $args[1]; float $axisTranslateX = $args[2]; float $axisTranslateY = $args[3]; float $axisTranslateZ = $args[4]; float $axisRotateX = $args[5]; float $axisRotateY = $args[6]; float $axisRotateZ = $args[7]; float $weight = $args[8]; string $animLayer = $args[9]; int $overrideMode = $args[10]; // Offset if ($maintainOffset) { $cmd = ($cmd + " -mo"); } // Rotation decomposition target if ( $rotateDecomp) { $cmd = ($cmd + " -dr"); } // AnimLayer if( size($animLayer)>0 && size(`ls -type animLayer $animLayer`) > 0 ) { if(!askUserIfLayerModeChangeIsOK($animLayer,$overrideMode)) return; animLayer -e -override $overrideMode $animLayer; $cmd = ($cmd + " -layer " + $animLayer ); } // Axis values // // AxisTranslate // If any of these values is true, that means that one // or more axes are to be skipped. if ($axisTranslateX) $cmd = ($cmd + " -skipTranslate x"); if ($axisTranslateY) $cmd = ($cmd + " -skipTranslate y"); if ($axisTranslateZ) $cmd = ($cmd + " -skipTranslate z"); // Axis Rotate // If any of these values is true, that means that one // or more axes are to be skipped. if ($axisRotateX) $cmd = ($cmd + " -skipRotate x"); if ($axisRotateY) $cmd = ($cmd + " -skipRotate y"); if ($axisRotateZ) $cmd = ($cmd + " -skipRotate z"); $cmd = ($cmd + " -weight " + $weight); evalEcho($cmd); }