//alignScalePivot // // Date: 2004/03/2 // Author: Dai Sato dstruevision@dstruevision.com http://www.dstruevision.com // Procedure Name: alignScalePivot // // Description: This scripts let you align an object scale pivot to a target object's scale pivot. // If you've freezed a target object and make all rotate value zero, this scripts won't work. global proc asa_jobStarter(string $window){ $jobNum = `scriptJob -parent $window -e "SelectionChanged" "asa_showSelection()"`; } global proc asa_showSelection() { string $selection[] = `ls -sl`; if(!($selection[0]==0)) { text -e -label $selection[0] asa_targetObject; if($selection[1]!=0) { text -e -label $selection[1] asa_beAlignedObject; } else { text -e -label "No object is selected" asa_beAlignedObject; } } else { text -e -label "No object is selected" asa_targetObject; } } global proc asa_align() { string $selection[] = `ls -sl`; if(!($selection[0]==0)) { if($selection[1]!=0) { string $checkParent[] = `listRelatives -parent $selection[1]`; float $targetX = `getAttr ($selection[0]+".rotateX")`; float $targetY = `getAttr ($selection[0]+".rotateY")`; float $targetZ = `getAttr ($selection[0]+".rotateZ")`; string $null = `group -em`; setAttr ($null+".rotateX") $targetX; setAttr ($null+".rotateY") $targetY; setAttr ($null+".rotateZ") $targetZ; parent $selection[1] $null; makeIdentity -apply true $selection[1]; parent -w $selection[1]; delete $null; if(!($checkParent[0]=="")) { print $checkParent; parent $selection[1] $checkParent[0]; } } else { text -e -label "No object is selected" asa_beAlignedObject; } } else { text -e -label "No object is selected" asa_targetObject; } } global proc alignScalePivot (){ global float $startTime; if ((`window -ex alignScaleAxisWindow`) == true) deleteUI alignScaleAxisWindow; string $window = `window -t "alignScalePivot" -s false alignScaleAxisWindow`; columnLayout -rs 4 mainColumn; text -label "TARGET OBJECT:"; text -label "No object is selected" asa_targetObject; text -label "OBJECT TO BE ALIGNED:"; text -label "No object is selected" asa_beAlignedObject; setParent mainColumn; columnLayout -rs 8; button -l "Align" -w 50 -h 30 -c "asa_align()"; window -e -width 200 -height 150 alignScaleAxisWindow; showWindow; asa_jobStarter($window); }