// =========================================================================== // 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: // doCreateScaleConstraintArgList // // Description: // Create a Scale 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] $sx : if maintain offset is off, the x value of scale component // [2] $sy : if maintain offset is off, the y value of scale component // [3] $sz : if maintain offset is off, the z value of scale component // [4] $axisX : if true to skip constraining scale on X axis // [5] $axisY : if true to skip constraining scale on Y axis // [6] $axisZ : if true to skip constraining scale on Z axis // [7] $weight : the weight to use for the Scale 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 doCreateScaleConstraintArgList( string $version, string $args[] ) { if( $version == 1 && size($args) != 10 ) { print (uiRes("m_doCreateScaleConstraintArgList.kScaleConstraintArgListWrongLength")); return; } string $cmd = "scaleConstraint"; int $maintainOffset = $args[0]; float $sx = $args[1]; float $sy = $args[2]; float $sz = $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 { // Translate values // $cmd = ($cmd + " -offset " + $sx + " " + $sy + " " + $sz ); } // 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 // // 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); }