A. Ryan Rodriguez
08-21-2009, 04:17 PM
Hey, all. I'm trying to create a simple City Generator using MEL in Maya 2009, and I've run into some trouble/confusion on where to go next. I've made a script that makes a basic randomized city, but I want to be able to control it using an UI window. I've created a simple script that would make a window (I want it to control the Number of Buildings you make, and Tall, and how Wide they are) a window pop up that has the attributes I want controllable on them, but I'm stumped on how I connect the two, and actually get them to work with one another.
Any help would be GREEEEATLY appreciated. Here's what I have so far, if you want to take a look first-hand for yourself..... Also, any links to other sites that you know of that explain the process of city generators would help, as well....
Thanks!
RANDOMIZED CITY:
========================================
proc createCity(int $city)
{
int $A=0;
while($A < 2000){
polyCube;
int $MoveRandZ=gauss(20);
int $MoveRandX=gauss(20);
int $Hdistrib=abs($MoveRandZ) + abs($MoveRandX);
float $ScaleRandY=(sqrt((rand(5,20)) / $Hdistrib)) * 1.5;
float $MoveY=($ScaleRandY)/2;
move $MoveRandX $MoveY $MoveRandZ;
scale .5 $ScaleRandY .5;
$A++;
print($A + "n");
};
}
createCity(10);
===================================
BASIC WINDOW:
===================================
proc addFloat(int $af)
{
$myDialog = `window -h 150 -w 400 -title "City Generator Box"`;
columnLayout;
intSliderGrp -l "Number of Buildings" -f true -min 0 -max 255 -v 1 rint1;
intSliderGrp -l "Building Height" -f true -min 0 -max 1000 -v 1000 rint2;
intSliderGrp -l "Building Width" -f true -min 0 -max 1000 -v 500 rint3;
string $currentOptions = "";
$currentOptions += `intSliderGrp - q -v rint1`;
print ($currentOptions + "\n");
showWindow;
}
addFloat(3);
======================================
Any help would be GREEEEATLY appreciated. Here's what I have so far, if you want to take a look first-hand for yourself..... Also, any links to other sites that you know of that explain the process of city generators would help, as well....
Thanks!
RANDOMIZED CITY:
========================================
proc createCity(int $city)
{
int $A=0;
while($A < 2000){
polyCube;
int $MoveRandZ=gauss(20);
int $MoveRandX=gauss(20);
int $Hdistrib=abs($MoveRandZ) + abs($MoveRandX);
float $ScaleRandY=(sqrt((rand(5,20)) / $Hdistrib)) * 1.5;
float $MoveY=($ScaleRandY)/2;
move $MoveRandX $MoveY $MoveRandZ;
scale .5 $ScaleRandY .5;
$A++;
print($A + "n");
};
}
createCity(10);
===================================
BASIC WINDOW:
===================================
proc addFloat(int $af)
{
$myDialog = `window -h 150 -w 400 -title "City Generator Box"`;
columnLayout;
intSliderGrp -l "Number of Buildings" -f true -min 0 -max 255 -v 1 rint1;
intSliderGrp -l "Building Height" -f true -min 0 -max 1000 -v 1000 rint2;
intSliderGrp -l "Building Width" -f true -min 0 -max 1000 -v 500 rint3;
string $currentOptions = "";
$currentOptions += `intSliderGrp - q -v rint1`;
print ($currentOptions + "\n");
showWindow;
}
addFloat(3);
======================================