// =========================================================================== // 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: // doCreatePointOnPolyConstraintArgList // // Description: // Create a PointOnPoly 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] $axisX : if true to skip constraining on X axis // [1] $axisY : if true to skip constraining on Y axis // [2] $axisZ : if true to skip constraining on Z axis // [3] $weight : the weight to use for the PointOnPoly constraint // [4] $animLayer : if a layer is specified, the anim layer to put this constraint on. // [5] $overrideMode : whether to set the layer to override mode. // // Version 2 // [6] $maintainOffset : whether to maintain the offset // [7] $offsetX : x offset // [8] $offsetY : Y offset // [9] $offsetZ : Z offset // // Return Value: // none // global proc doCreatePointOnPolyConstraintArgList( string $version, string $args[] ) { int $nargs = size($args); if( ($version == 1 && $nargs != 6) || ($version == 2 && $nargs != 10)) { string $msg = (uiRes("m_doCreatePointOnPolyConstraintArgList.kPointOnPolyConstraintArgListWrongLength")); error($msg); } float $axisX = $args[0]; float $axisY = $args[1]; float $axisZ = $args[2]; float $weight = $args[3]; string $animLayer = $args[4]; int $overrideMode = $args[5]; int $maintainOffset = ($version == 2) ? $args[6] : false; float $offsetX = ($version == 2) ? $args[7] : 0.; float $offsetY = ($version == 2) ? $args[8] : 0.; float $offsetZ = ($version == 2) ? $args[9] : 0.; string $cmd = "pointOnPolyConstraint"; if( size($animLayer)>0 && size(`ls -type animLayer $animLayer`) > 0 ) { if(!askUserIfLayerModeChangeIsOK($animLayer,$overrideMode)) return; animLayer -e -override $overrideMode $animLayer; $cmd = ($cmd + " -layer " + $animLayer ); } if ($version == 2) { if ($maintainOffset) { $cmd += " -maintainOffset "; } else { $cmd += " -offset "; $cmd += ($offsetX + " "); $cmd += ($offsetY + " "); $cmd += ($offsetZ + " "); } } // Axis values // // 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); }