nanoblock_mel(); global proc nanoblock_mel(){ if (`window -q -ex createNanoblockUI`)deleteUI createNanoblockUI; window -t "Nanoblock_工具" -w 200 -h 30 createNanoblockUI; rowColumnLayout -nc 1 ; rowColumnLayout -nc 7 -bgc 0 1 1; button -l "1x1" -c "importA1"; button "1x2"; button "1x3"; button "1x4"; button "1x5"; button "2x2"; button "2x3"; button "2x4"; button "1x1"; button "1x1"; setParent..; setParent..; rowColumnLayout -nc 6 -bgc 0.5 0.5 1; button -l "向左" -c "moveLeft"; button -l "向右" -c "moveRight"; button -l "向前" -c "moveFront"; button -l "向后" -c "moveBack"; button -l "向上" -c "moveUp"; button -l "向下" -c "moveDown"; button -l "左转" -c "rotationLeft" ; button -l "右转" -c "rotationRight"; setParent..; showWindow createNanoblockUI; } proc importA1(){ file -import -type "mayaBinary" -gr -ra true -rpr "A1" -options "v=0" -pr -loadReferenceDepth "all" "D:/Work/Liucong/A1.mb"; } proc moveUp(){ string $sel[]=`ls -sl`; for ($aa in $sel){ float $objY[]=`xform -q -ws -t $aa`; $objY[1]+=1f; xform -ws -t $objY[0] $objY[1] $objY[2] $aa; } } proc moveDown(){ string $sel[]=`ls -sl`; for ($aa in $sel){ float $objY[]=`xform -q -ws -t $aa`; $objY[1]-=1f; xform -ws -t $objY[0] $objY[1] $objY[2] $aa; } } proc moveFront (){ string $sel[]=`ls -sl`; for ($aa in $sel){ float $objY[]=`xform -q -ws -t $aa`; $objY[2]+=1f; xform -ws -t $objY[0] $objY[1] $objY[2] $aa; } } proc moveBack (){ string $sel[]=`ls -sl`; for ($aa in $sel){ float $objY[]=`xform -q -ws -t $aa`; $objY[2]-=1f; xform -ws -t $objY[0] $objY[1] $objY[2] $aa; } } proc moveLeft(){ string $sel[]=`ls -sl`; for ($aa in $sel){ float $objY[]=`xform -q -ws -t $aa`; $objY[0]-=1f; xform -ws -t $objY[0] $objY[1] $objY[2] $aa; } } proc moveRight (){ string $sel[]=`ls -sl`; for ($aa in $sel){ float $objY[]=`xform -q -ws -t $aa`; $objY[0]-=1f; xform -ws -t $objY[0] $objY[1] $objY[2] $aa; } } proc rotationLeft (){ string $sel[]=`ls -sl`; for ($aa in $sel){ float $objY[]=`xform -q -ws -ro $aa`; $objY[1]-=90f; xform -ws -ro $objY[0] $objY[1] $objY[2] $aa; } } proc rotationRight (){ string $sel[]=`ls -sl`; for ($aa in $sel){ float $objY[]=`xform -q -ws -ro $aa`; $objY[1]+=90f; xform -ws -ro $objY[0] $objY[1] $objY[2] $aa; } }
时间: 2024-10-29 19:05:33