global proc FNDAverage(int $nSmooth, string $inter, string $subd, string $FNDUndo, string $FNDHis) { int $UndoR = `checkBox -q -v $FNDUndo`; int $HisR = `checkBox -q -v $FNDHis`; if ($UndoR==0) {undoInfo -state off;} int $IntInt = `intField -q -value $inter`; int $IntSds = `intField -q -value $subd`; ConvertSelectionToVertices; string $startVertex[] = `ls -sl -fl`; SelectToggleMode; if ($HisR==1) {DeleteHistory;} string $startObj[] = `ls -sl -fl`; duplicate; if ($nSmooth==1) {polySmooth -mth 1 -dv 1 -c 1 -kb 1 -ksb 1 -khe 0 -kt 1 -kmb 1 -suv 1 -sl $IntSds -dpe 1 -ps 1 -ro 1 -ch 0 ;} if ($nSmooth==2) {polySmooth -mth 0 -dv $IntSds -c 1 -kb 1 -ksb 1 -khe 0 -kt 1 -kmb 1 -suv 1 -sl 2 -dpe 1 -ps 1 -ro 1 -ch 0 ;} string $dupObj[] = `ls -sl -fl`; select $startVertex; int $i; for ($i = $IntInt; $i > 0; $i--) { polyAverageVertex -i 18 -ch 0; } string $forVertex; for ($forVertex in $startVertex) { select $forVertex; vector $xform = `xform -ws -q -t`; spaceLocator -n "FNDHelper"; move -ws ($xform.x) ($xform.y) ($xform.z); select $dupObj[0] "FNDHelper"; geometryConstraint -weight 1; select "FNDHelper"; vector $xform = `xform -ws -q -t`; doDelete; select $forVertex; move -ws ($xform.x) ($xform.y) ($xform.z); } delete $dupObj[0]; SelectVertexMask; hilite $startObj[0]; select $startVertex; if ($UndoR==0) {undoInfo -state on;} } global proc FNDVAverage() { if (`window -exists FNDVAverage`) {deleteUI FNDVAverage;} string $window = `window -title "Vertex Average" -iconName "VAverage" FNDVAverage`; columnLayout -adjustableColumn true; setParent ..; rowColumnLayout -numberOfColumns 2; text -label "Iterations:"; global string $FNDIterationsAver; string $FNDIterationsAver = `intField -v 10`; text -label "Subdivision Levels:"; global string $FNDSubdivisionAver; string $FNDSubdivisionAver = `intField -v 2`; global string $FNDUndoV; string $FNDUndoV = `checkBox -l "Undo" -align "left" -v 0`; global string $FNDHisV; string $FNDHisV = `checkBox -l "DeleteHistory" -align "left" -v 1`; button -l "Linear" -c "FNDAverage(1, $FNDIterationsAver, $FNDSubdivisionAver,$FNDUndoV,$FNDHisV); "; button -l "Exponential" -c "FNDAverage(2, $FNDIterationsAver, $FNDSubdivisionAver,$FNDUndoV,$FNDHisV); "; setParent ..; showWindow $window; }