UI (Buttons & Sliders)
For the UI to generate the city I wanted to create a button for each feature that being for buildings, weather, day and night cycle and so on, but also to have a slider system to have some editing control to it's generation. The main idea I went with however was to create two buttons, one for the weather particle system and one for the main city generation and this is the following code the I made:
cmds.window( width=150 )
cmds.columnLayout( adjustableColumn=True )
cmds.text( label='This slider dictates the size of the buildings and city', align='center' )
width_slider = cmds.intSlider(minValue = 1, maxValue = 20)
cmds.button( label='Create City',command = "createCity(width_slider)")
cmds.text( label='This slider dictates the size of the weather generation', align='center' )
width_slider = cmds.intSlider(minValue = 5, maxValue = 10)
cmds.button( label='Create Clouds',command = "Clouds(width_slider)")
cmds.text( label='This button resets the entire scene', align='center' )
cmds.button( label='Reset',command = "DeleteAll()")
cmds.showWindow()
The following code when executed creates a UI which has two sliders and three buttons which link to the three separate functions for the weather simulation, city generation and city clean up, where the buttons execute the creation of both elements the slider will dictate the size of the weather simulation and the city's size and the delete button clears the entire scene so you can generate a completely new form of the previous city. This works nicely so that you can increase and decrease for different sized scenes with simple text guides above each button.
Programming for Computer Animation and VFX - Maya Python City
Status | Released |
Author | Aronne_Monk |
More posts
- FunctionsApr 24, 2023
- BuildingsApr 24, 2023
- Day and Night CycleApr 24, 2023
- Snow SimulationApr 24, 2023
Leave a comment
Log in with itch.io to leave a comment.