/* rooftop builder v1.1 by ziye liu */ /////////window//////// if (`window -ex tileWindow`) deleteUI tileWindow; window -title "Rooftop Builder" -wh 500 500 tileWindow; columnLayout -adj on; text -l "Tile A" -align "center"; text -l "Control" -align "center"; separator -st "double"; frameLayout -l "Tile A" -bs "in"; intSliderGrp -l "X number" -min 1 -max 100 -v 12 -f on -cc "roofTop" totalXNum; intSliderGrp -l "Y number" -min 1 -max 100 -v 8 -f on -cc "roofTop" totalYNum; floatSliderGrp -l "yOffset" -min -10 -max 10 -v -5 -f on -cc "roofTop" yOffset; floatSliderGrp -l "Tile A Rotate" -min -15 -max 15 -v 0 -f on -cc "roofTop" tileARotate; floatSliderGrp -l "random" -min 0 -max 1 -v 0 -f on -cc "roofTop" tileARotateRand; separator; text -l "Size Control"; floatSliderGrp -l "Tile A Width" -min 1 -max 20 -v 15 -f on -cc "roofTop" tileAWidth; floatSliderGrp -l "Tile A Depth" -min 1 -max 20 -v 13 -f on -cc "roofTop" tileADepth; floatSliderGrp -l "Tile A Height" -min 0.1 -max 10 -v 2 -f on -cc "roofTop" tileAHeight; separator; intSliderGrp -l "Tile A Segment" -min 5 -max 11 -v 6 -f on -cc "roofTop" aSegment; setParent ..; frameLayout -l "Tile B" -bs "in"; floatSliderGrp -l "Tile B Radius" -min 0.1 -max 4 -v 2 -f on -cc "roofTop" tileBRadius; floatSliderGrp -l "Tile B Rotate" -min -15 -max 15 -v -8 -f on -cc "roofTop" tileBRotate; setParent ..; showWindow tileWindow; ///////// global proc tileA () //build the base shape { int $xSideNum = `intSliderGrp -q -v aSegment`; float $tileAW = `floatSliderGrp -q -v tileAWidth`; float $tileAD = `floatSliderGrp -q -v tileADepth`; float $tileAH = `floatSliderGrp -q -v tileAHeight`; string $cube1[] = `polyCube -w $tileAW -h $tileAH -d $tileAD -sx $xSideNum`; int $sideLoop = 2; for ($x = 0; $x < (($xSideNum + 1) * 4); $x += ($xSideNum+1)) { for ($l = 0; $l < ($xSideNum / 3); $l ++) { // move left side edge down move -r 0 ($tileAH / 2 - $tileAH / 5 * $l) 0 ($cube1[0] + ".vtx[" + ($x + $l) + "]"); } for ($r = 0; $r < ($xSideNum / 3); $r ++) { // move right side edge down move -r 0 ($tileAH / 2 - $tileAH / 5 * $r) 0 ($cube1[0] + ".vtx[" + ($x - $r + $xSideNum) + "]"); } } //polyCylinder -r 1; // if i add more objects here, // i will not be able to move all of the objects in this proc } ////////////////////// proc tileB() //build the top tile shape { float $tileAD = `floatSliderGrp -q -v tileADepth`; //get value from interface float $tileBRadius = `floatSliderGrp -q -v tileBRadius`; polyCylinder -r $tileBRadius -h $tileAD; //build a cylinder } ////////// line of tileA ///////// proc roofTop() { select -all; delete; int $totalXNum = `intSliderGrp -q -v totalXNum`; int $totalYNum = `intSliderGrp -q -v totalYNum`; float $tileAXSpace = `floatSliderGrp -q -v tileAWidth`; float $tileAYSpace = 15; float $layerOffset = `floatSliderGrp -q -v yOffset`; float $tileAH = `floatSliderGrp -q -v tileAHeight`; float $tileARotate = `floatSliderGrp -q -v tileARotate`; float $tileARotateRand = `floatSliderGrp -q -v tileARotateRand`; float $tileBRotate = `floatSliderGrp -q -v tileBRotate`; //tile A for ($y = 0; $y < $totalYNum; $y++) { for ($x = 0; $x < $totalXNum; $x++) { tileA(); // build tile part A move -r ($tileAXSpace * $x) ($layerOffset * $y) ($tileAYSpace * $y * 0.80); // move the object, spacing rotate -r ($tileARotate + 15 + 5 * rand(-$tileARotateRand, $tileARotateRand)) (0 + 10 * rand(-$tileARotateRand, $tileARotateRand)) (0 + 15 * rand(-$tileARotateRand, $tileARotateRand)); } } //tile B for ($y = 0; $y < $totalYNum; $y++) { for ($x = 0; $x < ($totalXNum +1); $x++) { tileB(); move -r (-$tileAXSpace /2) $tileAH 2; // align position // build tile part B move -r ($tileAXSpace * $x) ($layerOffset * $y) ($tileAYSpace * $y * 0.80); // move the object, spacing //0.8 is the indent value rotate -r ($tileBRotate + 120) 0 0; } } }