To learn how to use python scripting in Maya, I worked on a tool that gives the user the ability to scatter and make slight surface level edits to meshes.
In the beginning from class, we developed a very simple mesh scatter tool that generates only a hand full of meshes and does so from the command prompt.
Using this as a good jumping off point, I began to work on improving it by adding new code that would adjust rotation, material color, and position, number spawned, and the UI. This would be done through new lines of code as well as changes to the orignal.
I decided to move the code down so that I can focus on adding the UI features. In these lines, you can see that I added necessary items to the tool, including numer slider, mesh type dropdown menu, text boxes to change the mesh names and group names, a scale and rotation drop down menu, and a scatter button that will spawn the meshes in the world.
In this code, I set the spawning conditions for the meshes and how they randomly appear, including shader color, rotations, scale, and locations.
Here in this final bunch of code, is where the spawning of the meshes occures. Through using if and elif statements, the tool will randomly spawn multiple different meshes, including spheres, torus's, cubes, cones, and cylinders, as well as give users the ability to rename the meshes and the groups they spawn in to keep them organized.