// =========================================================================== // 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: // doCreatePointConstraintArgList // // Description: // Create a point 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] $tx : if maintain offset is off, the x value of translation component // [2] $ty : if maintain offset is off, the y value of translation component // [3] $tz : if maintain offset is off, the z value of translation 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 point 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 doCreatePointConstraintArgList( string $version, string $args[] ) { if( $version == 1 && size($args) != 10 ) { print (uiRes("m_doCreatePointConstraintArgList.kPointConstraintArgListWrongLength")); return; } int $maintainOffset = $args[0]; float $tx = $args[1]; float $ty = $args[2]; float $tz = $args[3]; int $axisX = $args[4]; int $axisY = $args[5]; int $axisZ = $args[6]; float $weight = $args[7]; string $animLayer = $args[8]; int $overrideMode = $args[9]; string $cmd = "pointConstraint"; if ($maintainOffset) { $cmd = ($cmd + " -mo"); } else { // Translate values // $cmd = ($cmd + " -offset " + $tx + " " + $ty + " " + $tz ); } 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); }