// =========================================================================== // 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: // doCreateOrientConstraintArgList // // Description: // Create a Orient 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] $rx : if maintain offset is off, the x value of rotation component // [2] $ry : if maintain offset is off, the y value of rotation component // [3] $rz : if maintain offset is off, the z value of rotation component // [4] $axisX : if true to skip constraining on X axis // [5] $axisY : if true to skip constraining on Y axis // [6] $axisZ : if true to skip constraining on Z axis // [7] $weight : the weight to use for the Orient constraint // [8] $animLayer : if a layer is specified, the anim layer to put this constraint on. // [9] $overrideMode : whether to set the layer to override mode. // // Return Value: // none // global proc doCreateOrientConstraintArgList( string $version, string $args[] ) { if( $version == 1 && size($args) != 10 ) { print (uiRes("m_doCreateOrientConstraintArgList.kOrientConstraintArgListWrongLength")); return; } string $cmd = "orientConstraint"; int $maintainOffset = $args[0]; float $rx = $args[1]; float $ry = $args[2]; float $rz = $args[3]; float $axisX = $args[4]; float $axisY = $args[5]; float $axisZ = $args[6]; float $weight = $args[7]; string $animLayer = $args[8]; int $overrideMode = $args[9]; if ($maintainOffset) { $cmd = ($cmd + " -mo"); } else { // Rotation values // $cmd = ($cmd + " -offset " + $rx + " " + $ry + " " + $rz ); } // AnimLayer if( size($animLayer)>0 && size(`ls -type animLayer $animLayer`) > 0 ) { if(!askUserIfLayerModeChangeIsOK($animLayer,$overrideMode)) return; if($overrideMode) { animLayer -e -override 1 $animLayer; } else { animLayer -e -override 0 $animLayer; } $cmd = ($cmd + " -layer " + $animLayer ); } // Axis values // // The axis values are inverted so that they represent // which axes to *skip* as opposed to which axes are on. // If any of these values is true, that means that one // or more axes are to be skipped. if ($axisX) $cmd = ($cmd + " -skip x"); if ($axisY) $cmd = ($cmd + " -skip y"); if ($axisZ) $cmd = ($cmd + " -skip z"); $cmd = ($cmd + " -weight " + $weight); evalEcho($cmd); }