Some notes about Maya and MEL. Like haiddasalami mentioned global proc means you can call the procedures directly but you do not get direct access to variables inside it. The variables will stay in their scope. If you define a variable in the MEL window those variables will become globals for the session. I noticed a nasty…
Okay, next issue!!! Cubes using this plane vert placement mode don't seem to want to place properly when using the code from the simple move x rand version. The cubes are all being placed in the correct amount, but ontop of each other and the script is failing at moving each cube as it gets created. Heres my code.. Where…
Thanks for the help so far guys. Ok so i still have;nt manage to figure out the overlapping i am about as useful as a bag of hammers when it comes to Mel. I have a new question either way, i want to create a boundry which is adjustable using two intSLiderGrp. So say a limit on the x and z axis which the user dictates. Then…
For my university assignment i have to make a script that scatters tree's across a scene randomly. The script has to include: · "Simple User Interface (GUI) to include the following options: [FONT="]o [/FONT]Select species of tree to use – i.e. Oak / Beech / Pine etc [FONT="]o [/FONT]Number of trees to generate…
You'll have to make a general procedure which in turn calls several other; global proc dragCommandProc(){ maxPinevalue(); maxMaplevalue();}global proc UI_Proc(){ // Some code intSliderGrp -label "Oak Percentage" -value 0 -fieldMinValue 0 -fieldMaxValue 100.0 -dragCommand "dragCommandProc()" -field true oak;} Alternative…
The easiest way to avoid overlapping is to do a distance check between the tree you're placing and all existing trees. If it's placed too close to another, remove it, or rather compare positions before placing the tree. Here's a code example on how to determine distance between two objects with vectors.// Get object…
I really recommend you read the error it gives. If you have code that gives you source errors, look for the specific part raising that error. If you have a runtime error it's recommended to add a print("--Some debug message begin--\n") and print("--Some debug message end--\n") in your code and place the prints so you can…
int $vertCount[] = `polyEvaluate -v $placementHelper`; polyEvaluate returns an array so you need to make the variable an array. Also watch the closing of tilda's. That's why there's a syntax error and on another note, dont assume the mesh will be selected always, I know you're making it in the script etc. This is more of a…
reply to post #1: maybe it'S smarter to randomly assign them to the vertices of your plane. check for dupes and you're fine. of course you might not get the denseness you like, but a helper mesh with more verts could do the job... there are a bunch of scripts on creativecrash.com who do exactly this(search for scatter..).…
I found the problem, it seems the programmers at Autodesk has been inconsistent regarding syntax for intSlider. Original:intSliderGrp -e -v Pine $maxPine; New:intSliderGrp -e -v $maxPine Pine; It is standard to set the value last, like with setAttr, but not with intSlider. The code below is a working example. //…