maya tank palet sprit

Upload: ercanarsivyoga

Post on 03-Jun-2018

230 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/12/2019 Maya Tank Palet Sprit

    1/5

    ite maya animasyon en nemli ve dersi denilibilecek bir konuyu anlatacam vede mayakullananlarn yzde 90 bilmedigine eminimdersimiz maya tank paleti animasyonu ve de paletler hic bir deformasyona ugramyordnlerde1-olarak aagdaki text halinde ki spriti koplayan ve hic kaybetmeyin bi daha bulamazsnz

    // Creates The user Interface Windowglobal proc AS_TreadsCreation(){string $pathWin = "pathWin";

    if ( `window -q -exists $pathWin` == 1 )

    deleteUI $pathWin;

    global string $curvePath[];global string $treadObj[];window -sizeable false -wh 317 295 -title "AS_Treads Creation v2.0" $pathWin; columnLayout -rowSpacing 10 ; frameLayout -labelVisible false ; columnLayout -cal "center";

    textField -text ""-w 306

    -editable false -ip 1 -it $curvePath curveName;

    button -label "Load Path Curve" -w 100 -align "center" -ann "Select Path Curve and Press (Load Path Curve) Button" -c "$curvePath = `ls -sl`; textField -e -text $curvePath[0] curveName;" loadCurveButton;

    separator -height 5 -st double -w 310;

    textField -text ""

    -w 306 -editable false -ip 1 -it $treadObj treadName;

    button -label "Load Tread Object" -align "center"

    -ann "Select Tread Object and Press (Load Tread Object) Button" -c "$treadObj = `ls -sl`; textField -e -text $treadObj[0] treadName;" loadTreadButton;

    separator -st double -w 310;

    setParent ..; setParent ..;

  • 8/12/2019 Maya Tank Palet Sprit

    2/5

    frameLayout -label "Treads Depth Direction" ;

    rowColumnLayout -nc 3 -columnWidth 1 110 -columnWidth 2 110 -columnWidth 3110; text -label ""; text -label ""; text -label ""; radioCollection radioScaleCollect;

    $rb1 = `radioButton -label "X Depth" -align "left" -ann "Select When Treads Thickness Depth Is On The X Axis" XDepth`; // $rb2 = `radioButton -label "Y Depth" -align "left"-ann "Select When Treads Thickness Depth Is On The Y Axis" YDepth`; $rb3 = `radioButton -label "Z Depth" -align "left" -ann "Select When Treads Thickness Depth Is On The Z Axis" -sl

    ZDepth`; setParent ..; setParent ..;

    frameLayout -labelVisible false; helpLine -w 306; setParent ..;

    separator -st double -w 310;

    rowColumnLayout -nc 3 -columnWidth 1 103 -columnWidth 2 103 -columnWidth3 103; button -l "Create Treads" -al center -annotation "Creates the Treads Instances On The Curve Path" -c "treads" createTreads;

    button -l "Delete Treads" -al center -annotation "Deletesthe Treads Instances" -c "delTreads" deleteTreads; button -l "Close" -al center -annotation "Closes the window" -c "closeTreads" ClosesTreads; setParent ..;

    separator -st double -w 310;

    showWindow $pathWin;

    }// Creation of the treadsglobal proc treads() {

    int $i,$j;string $expr;float $offset, $objLength;int $frames = 100;

    string $curve = `textField -q -tx curveName`;string $oldCurve;string $tread = `textField -q -tx treadName`;string $folAxis;$oldCurve = $curve;if (size($curve) == 0 || size($tread) == 0 ){ warning("You have to load a PATH CURVE and a TREAD OBJECT!!!"); }else {

  • 8/12/2019 Maya Tank Palet Sprit

    3/5

    if( `objExists ("treadPathCurve"+$oldCurve)`){ warning("Treads already created using that curve, load a different path curve!!!"); } else { duplicate -rr -n ("treadPathCurve"+$oldCurve) $curve; xform -cp ("treadPathCurve"+$curve); setAttr ("treadPathCurve"+$curve+".visibility") 0; float $oldPos[] = `xform -q -ws -rp ("treadPathCurve"+$curve)`; move -rpr 0 0 0 ("treadPathCurve"+$curve); makeIdentity -apply true -t 1 -r 1 -s 1 ("treadPathCurve"+$curve); $curve = ("treadPathCurve"+$oldCurve);

    if( `objExists ($curve +"_curveLength")`) delete ($curve +"_curveLength");

    createNode curveInfo -n ($curve +"_curveLength"); string $pathShape[] = `listRelatives $curve`; string $objShape[] = `listRelatives $tread`;

    connectAttr -f ($pathShape[0] + ".worldSpace[0]") ($curve +"_curveLength.inputCurve"); float $curveLength = `getAttr ($curve +"_curveLength.arcLength")`; if (`getAttr ($tread+".rotateX")` != 0 || `getAttr ($tread+".rotateY")` != 0 || `getAttr ($tread+".rotateZ")` != 0){ select $tread;

    makeIdentity -apply true -t 1 -r 1 -s 1; } select $tread; float $bounding[] = `xform -q -bb`; string $radioScale = `radioCollection -q -select radioScaleCollect`; if ($radioScale == "ZDepth"){ $objLength = abs($bounding[5]-$bounding[2]); $folAxis = "z"; } if ($radioScale == "XDepth"){ $objLength = abs($bounding[3]-$bounding[0]); $folAxis = "x"; }

    if ($radioScale == "YDepth"){ $objLength = abs($bounding[4]-$bounding[1]); $folAxis = "y"; } float $treadsNum = floor(($curveLength / $objLength)); float $distRatio = $frames / $treadsNum; float $dist = $distRatio; float $curvepos[] = `xform -q -ws -rp $curve`; spaceLocator -p $curvepos[0] $curvepos[1] $curvepos[2]-n ($curve+"_speedControl"); xform -cp ($curve+"_speedControl"); xform -cp ($curve+"_speedControl"); select ($curve+"_speedControl");

    string $attr = `addAttr -k 1 -ln "speed" -min -100 -max 100 -dv 5`; $offset = 1/$treadsNum; cycleCheck -e off; select $tread; for ( $i = 0; $i < $treadsNum; $i++){ instance -n ($curve+"_tread"+"_"+$i); select -add $curve; pathAnimation -n ($curve+"_motPath" + $i) -fractionMode true -followtrue -followAxis $folAxis -upAxis y -worldUpType

  • 8/12/2019 Maya Tank Palet Sprit

    4/5

    "object" -worldUpObject $curve -inverseUp false -inverseFront false -bank false-startTimeU $dist -endTimeU ($dist+$frames); selectKey -add -k -t $dist -t ($dist+$frames) ($curve+"_motPath" + $i + ".uValue"); setInfinity -poi cycle;

    setInfinity -pri cycle; $dist = $dist + $distRatio; select ($curve+"_tread"+"_"+$i); }

    select -add ($curve+"_tread*"); group -w -n ($curve+"_TreadsGrp"); select "positionMarker*"; hideKeepSelection `ls -sl`; for ( $j = 0; $j < $treadsNum; $j++){

    select ($curve+"_motPath" + $j + "_uValue"); delete; $expr += ("float $attr = "+$curve+"_speedControl.speed/-100"+";\n"); $expr += ("if ($attr

  • 8/12/2019 Maya Tank Palet Sprit

    5/5

    warning("There are no treads created, use the create treads button first!!!"); }}

    //Creates the button in to the active shelf.global proc addIcon(){ global string $gShelfTopLevel; if (`tabLayout -exists $gShelfTopLevel`) { shelfButton -parent ($gShelfTopLevel + "|" + `tabLayout -q -st $gShelfTopLevel`) -label "Treads" -iol "Treads" -command " AS_TreadsCreation" -image1 "AS_TreadsCreation.bmp" -annotation "Create animated treads along a path"; } else{ error "You Have To open at Least One Shelf!!!"; }}

    addIcon;2-yukarda yazl olan spriti maya da sprit editre yaptrn ve tamamn tekrar secip usu ile rnegin ploygon mensne srkleyerek brakn mel icon bir tu olumu olacaktklayn yann tread diye bir icon olusacak mel isimli iconun yanna imdi ona tklayAS_Treads Creation v2.0 isimli pir pencere aclack3-imdi tank palatinin cizimine gecebiliriz curve ile ister dzgn ister tank palatini zerine dizilecek gibi curve cizin daha sonra tank palati cizin veya uzun ince diktrgen eklinde palet daha sonra.4-son olarak cizdiginiz curve secin yan curve nin agz ack olmasn elips gibi bir cizim veya daha dzgn br ey neyse curvemizi sectiysek biraz nce bahsettigim aclan pencde load path curve tklayn curve secilmi oldu daha sonra palati secin load tread objet tklayn ve son olarak creat treads tklayn sonuc olarak cizdiginiz curveye palatniz dzgnce dizilmi oldu .

    5-imdi animasyon zaman zaman cubugunun en sagdaki iki kutucuktaki degerleri rnegin1000 yazn ikisinede ve playa basn ve greceksiniz ki tam bir askeri tank palati gibihareket ettiklerininot takldgnz yerde bana sorun yapan arkadalar bir video hazrlayp siteye koyarlarr arkadalarda yararlarnr