//transparent glass shader added //duplication of beam and panel added. //make sure to select the objects first //The order of your selection will affect the order of animation //use undo if you want to clean the keyframs generated //Ming Tang. 2007 proc builder () { //-------construction sequence auto keyframe //-------copyright Ming Tang. 2007 int $startFrame = `intSliderGrp -q -v startFrame`; int $internalFrame = `intSliderGrp -q -v internalFrame`; int $dropDuration = `intSliderGrp -q -v dropDuration`; //float $dropHeight = `intSliderGrp -q -v dropHeight`; float $dropX = `textField -q -text dropX`; float $dropY = `textField -q -text dropY`; float $dropZ = `textField -q -text dropZ`; string $list[] = {}; string $list[] = `ls -sl`; //define the start frame of animtion int $start=$startFrame; //define the time length between two structures generation int $interval=$internalFrame; //define the time length of drop translation //int $drop=$dropDuration; int $drop=$dropDuration; //define the distance of movement //$distance=$dropHeight; //int $distance=10; //define the axis of movement //not avaliable right now //string $profile; //print($list); //-------don't change the code below $i = 0; while($i < size($list)){ //create keyframe animation setAttr ($list[$i] + ".visibility") 0; //set visiblility and the first keyframe currentTime (0+$start); setKeyframe ($list[$i]+".v"); //set visibility and the second keyframe currentTime ($i*$interval+$start); setAttr ($list[$i] + ".visibility") 1; setKeyframe ($list[$i]+".v"); //set move values select -r ($list[$i]); //move -r 0 $distance 0; //setKeyframe ($list[$i]+".ty"); move -r $dropX $dropY $dropZ; setKeyframe ($list[$i]+".tx"); setKeyframe ($list[$i]+".ty"); setKeyframe ($list[$i]+".tz"); //set move values for the third keyframe currentTime ($i*$interval+$start+$drop); //move -r 0 (-$distance) 0; //setKeyframe ($list[$i]+".ty"); move -r (-$dropX) (-$dropY) (-$dropZ); setKeyframe ($list[$i]+".tx"); setKeyframe ($list[$i]+".ty"); setKeyframe ($list[$i]+".tz"); $i++; } //---change the time line $maxtime = $startFrame + $internalFrame * size($list) + $dropDuration; playbackOptions -min 1 -max $maxtime ; } //builder; //--------------------------- //--------create break proc breakIt () { string $myobject[] = `ls -sl`; //---assign a transparent glass shadingNode -asShader blinn -n glass; setAttr "glass.transparency" -type double3 0.5 0.5 0.5 ; setAttr "glass.color" -type double3 0.4 0.5 0.7 ; select -r $myobject[0] ; rename "roof_panel"; //--roof_panel is the name comes from beam generation defaultNavigation -source glass -destination |roof_panel|roof_panelShape.instObjGroups[0] -connectToExisting; //print ("the quary name is" + $myobject[0]); $item = "roof_panel" + ".f[0:9999]"; select -cl; select -r $item; polyChipOff -kft 0 -dup 0 -ls 0.95 0.95 0.95; polyPerformAction polySeparate o 0; //find the root node of a curve transformation node string $shape[] = `listRelatives -shapes roof_panel`; polySeparate -ch 1 $shape[0]; } //-----proc building beams proc beam () { //select faces string $myobject[] = `ls -sl`; print ("the quary name is" + $myobject[0]); //---duplicate the roof-- duplicate; string $roof[] = `ls -sl`; //----------- $item = $myobject[0] + ".f[0:9999]"; select -cl; select -r $item; //extrude along y to get the height, double faces were made polyExtrudeFacet -ch 1 -kft 0 -t 0 -1 0; doDelete; select -r $item ; //triangulate the beam into a diagonal structure polyTriangulate -ch 1 $item ; //create the hole inside the beams polyExtrudeFacet -ch 1 -kft 0 -lsx 0.8 -lsy 0.8 -lsz 0.8; doDelete; //extrude the beam to create thickness select -r $item ; polyExtrudeFacet -ch 1 -kft 0 -ltx 0 -lty 0 -ltz 0.02; //----rename the beam select -r $myobject[0]; rename "beam01"; //----reselect the roof for the next operation select -r $roof[0]; rename "roof_panel"; } //------------create UI window global proc construction () { if (`window -exists constructionWindow`) { deleteUI constructionWindow; } window -widthHeight 300 300 -title "construction animation Builder" -sizeable true constructionWindow; //scrollLayout; columnLayout; //break text -l "Step 1: Define the timeline of animation"; text -l ""; intSliderGrp -label "start Frame" -field true -fieldStep 1 -sliderStep 1 -value 2 -fieldMinValue -100 -fieldMaxValue 1000 startFrame; intSliderGrp -label "internal Frame" -field true -value 3 internalFrame; intSliderGrp -label "drop duration" -field true -value 5 dropDuration; setParent ..; /* intSliderGrp -label "drop Height" -field true -value 5 dropHeight; */ //break columnLayout; text -l ""; separator -w 800; text -l "Step 2: Define the distance of movement. Accept negative value"; text -l ""; setParent ..; //add three drop values rowColumnLayout -numberOfColumns 2 -columnWidth 1 120 -columnSpacing 1 20 -columnWidth 2 120 -columnSpacing 2 20; text -l "drop along X"; textField -tx 0 dropX ; text -l "drop along Y"; textField -tx 5 dropY ; text -l "drop along Z"; textField -tx 0 dropZ ; setParent ..; //----break text -l ""; separator -w 800; text -l "Step 3: The first two buttons only work for polygon model"; text -l ""; //three buttons rowColumnLayout -numberOfColumns 3 -cs 1 20 -cs 2 20 -cs 3 20 -cw 2 150 -cw 3 150; //---create button 1 button -label "Create Beams" -command "beam" beam; //---create button 2 button -label "Create Panels" -command "breakIt" breakIt; //---create button 3 button -label "Animate Construction" -command "builder" buildIt; setParent ..; //break columnLayout; text -l ""; separator -w 800; text -l "Ming Tang. 2007"; showWindow; } construction;