// =========================================================================== // 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. // =========================================================================== // // // Creation Date: July, 1997 // // Procedure Name: // AEwireLocatorNew // // Description Name; // Creates the attribute editor controls for the wire.locator Attr // // Input Value: // wireNodeAttribute // // Output Value: // None // global proc AEwireLocatorNew ( string $wireMulti ) { string $buffer[]; tokenize($wireMulti, ".", $buffer); string $nodeName = $buffer[0]; string $att = $buffer[1]; setUITemplate -pst attributeEditorTemplate; columnLayout ($att+"Column"); int $i; string $paramattr = $nodeName+ ".wlp"; string $multis[] = `listAttr -multi $paramattr`; for ($i=0; $i < size($multis); $i++) { string $wm = ($nodeName+"."+$multis[$i]); string $conns[] =`listConnections $wm`; tokenize($multis[$i], "[]", $buffer); int $ind = $buffer[1]; int $wireIndex=$ind/100; string $curve[]=`listConnections ($nodeName+".dw["+$wireIndex+"]")`; // $curve[0] is the curve you are looking for float $curveMinValue = `getAttr ($curve[0] +".minValue")`; float $curveMaxValue = `getAttr ($curve[0] +".maxValue")`; setUITemplate -pst attributeEditorTemplate; string $textName = ("locatortext"+$i); if (size($conns)) { text -label $conns[0] $textName; } $sliderLabel = ("Param["+$ind+"]"); $sliderName = "locatorparm"+$i; attrFieldSliderGrp -min $curveMinValue -max $curveMaxValue -s 0.1 -label $sliderLabel $sliderName; $sliderLabel = ("Percent["+$ind+"]"); $sliderName = "locatorperc"+$i; attrFieldSliderGrp -min 0.0 -max 5 -s 0.1 -label $sliderLabel $sliderName; $sliderLabel = ("Twist["+$ind+"]"); $sliderName = "locatortwist"+$i; attrFieldSliderGrp -min -360 -max 360 -s 1 -label $sliderLabel $sliderName; $sliderLabel = ("Envelope["+$ind+"]"); $sliderName = "locatorenv"+$i; attrFieldSliderGrp -min 0.0 -max 2 -s 0.1 -label $sliderLabel $sliderName; string $sepname = ("locator" + $i + "separator" ); separator $sepname; setUITemplate -ppt; } setParent ..; setUITemplate -ppt; AEwireLocatorReplace $wireMulti; } global proc AEwireLocatorReplace ( string $wireMulti ) { string $buffer[]; tokenize($wireMulti, ".", $buffer); string $nodeName = $buffer[0]; string $att = $buffer[1]; setUITemplate -pst attributeEditorTemplate; setParent ($att+"Column"); $layoutName=`setParent -q`; int $oldCount=`columnLayout -q -nch $layoutName`; int $i; string $attr=$nodeName+".wlp"; string $multis[] = `listAttr -multi $attr`; for ($i=0; $i < size($multis); $i++) { string $wm = ($nodeName+"."+$multis[$i]); string $conns[] =`listConnections $wm`; tokenize($multis[$i], "[]", $buffer); int $ind = $buffer[1]; int $wireIndex=$ind/100; // Get the wire curve min and max values to set the slider extents // string $curve[]=`listConnections ($nodeName+".dw["+$wireIndex+"]")`; float $curveMinValue = `getAttr ($curve[0] +".minValue")`; float $curveMaxValue = `getAttr ($curve[0] +".maxValue")`; // Param // string $textName = ("locatortext"+$i); $sliderName="locatorparm"+$i; $sliderLabel = ("Param["+$ind+"]"); if (size($conns)) { $attr = $conns[0]+".pr"; } else { $attr = $nodeName+$multis[$i]; } if ( `attrFieldSliderGrp -ex $sliderName` ) { text -e -label $conns[0] $textName; attrFieldSliderGrp -e -min $curveMinValue -max $curveMaxValue -label $sliderLabel -at $attr $sliderName; } else { setUITemplate -pst attributeEditorTemplate; if (size($conns)) { text -label $conns[0] $textName; } attrFieldSliderGrp -min $curveMinValue -max $curveMaxValue -s 0.1 -label $sliderLabel -at $attr $sliderName; setUITemplate -ppt; } // Percentage // $sliderName="locatorperc"+$i; $sliderLabel = ("Percent["+$ind+"]"); $attr = $nodeName+".wlpc["+$ind+"]"; $conns =`listConnections -p true $attr`; if (size($conns)) { $attr= $conns[0]; } if ( `attrFieldSliderGrp -ex $sliderName` ) { attrFieldSliderGrp -e -label $sliderLabel -at $attr -min 0.0 -max 5 -s 0.1 $sliderName; } else { setUITemplate -pst attributeEditorTemplate; attrFieldSliderGrp -min 0.0 -max 5 -s 0.1 -l $sliderLabel -at $attr $sliderName; setUITemplate -ppt; } // Twist // $sliderName="locatortwist"+$i; $sliderLabel = ("Twist["+$ind+"]"); $attr= $nodeName+".wlt[" + $ind + "]"; if ( `attrFieldSliderGrp -ex $sliderName` ) { attrFieldSliderGrp -e -label $sliderLabel -at $attr -min -360 -max 360 -s 1 $sliderName; } else { setUITemplate -pst attributeEditorTemplate; attrFieldSliderGrp -min -360 -max 360 -s 1 -l $sliderLabel -at $attr $sliderName; setUITemplate -ppt; } // Envelope // $sliderName="locatorenv"+$i; $sliderLabel = ("Envelope["+$ind+"]"); $attr= $nodeName+".wle[" + $ind + "]"; if ( `attrFieldSliderGrp -ex $sliderName` ) { attrFieldSliderGrp -e -label $sliderLabel -at $attr $sliderName; } else { setUITemplate -pst attributeEditorTemplate; attrFieldSliderGrp -min 0.0 -max 2 -s 0.1 -l $sliderLabel -at $attr $sliderName; string $sepname = ("locator" + $i + "separator" ); separator $sepname; setUITemplate -ppt; } } for ($i=size($multis); $i < $oldCount; $i++) { string $textName = ("locatortext"+$i); $sliderName="locatorparm"+$i; if ( `text -ex $textName` ) deleteUI $textName; if ( `attrFieldSliderGrp -ex $sliderName` ) deleteUI $sliderName; $sliderName="locatorperc"+$i; if ( `attrFieldSliderGrp -ex $sliderName` ) deleteUI $sliderName; $sliderName="locatortwist"+$i; if ( `attrFieldSliderGrp -ex $sliderName` ) deleteUI $sliderName; $sliderName="locatorenv"+$i; if ( `attrFieldSliderGrp -ex $sliderName` ) { deleteUI $sliderName; string $sepname = ("locator" + $i + "separator" ); if (`separator -ex $sepname`) { deleteUI $sepname; } } } setParent ..; setUITemplate -ppt; }