Home

MEL USER INTERFACE

This is the continuation of  previous assignment & in this part I have created a custom user interface for procedural geometry creation which is based on koch fractal algorithm.

Koch Snowflake Procedural Geometry User Interface

Since the explanation of koch fractal and procedural geometry generation is already explained in previous assignment . For the interface to generate procedural geometry the controls that I have provided are as follow:

 

Angle: to control the direction of the curves in degrees , user can specify its own required direction.

 

Generation: Number of iterations ,which each generation it increase the number of curves and derived geometries over it.

 

Axiom: Takes the value from rules and replaces the value.

 

Rule : Defines the shape made by curves.

 

Radius: It controls the radius of the generated cylinders over each curve.

 

Height: Controls the height of the Cylinders.

 

Create L system File : It generates the snowflake.mel at maya's default  script directory which contains all the information of shapes.

 

Draw L-System: It triggers the snowflake.mel code which creates shapes in the viewport.

 

Arrange Hierarchy: The curves are created in groups so that each curves starts at the end of the previous curves and so as the cylinders on top of it, that cause too many transformation nodes, in order to prevent that this button take all the geometries out  from its current heirarchy and create its own clean group.

 

Clean Scene: Sometimes with massive number of generations viewport stops working so it cleans the scene.

 

Exit: Exit the Window.

 

Angle  = 90

Axiom = >zL

Rule = >yL<zL>xL>zL>zL>xL<zL

Angle  = 17

Axiom = >zL

Rule = >yL<zL>xL>zL>zL>xL<zL

Angle  = 35

Axiom = L

Rule = Ly{>zxL}L{<zxL}L

RENDER IMAGES

KochUI.mel

Preamble.mel

How to Run the Code:

 

1- Copy all the codes and paste it in the maya project's script folder.

 

2- Open Run and write KochUI.mel;

 

3- Run the code and play.

Several steps which I followed during the User Interface development are:

 

1- Design a rough layout on paper to decide the number of sliders,text fields, buttons or anything to control the code through interface.

 

2- Make sure everything is inside the global procedure so that when function has been call by the interface it works fine.

 

3- Create the tools step by step , its not a good idea to rush and create everything on the interface first and connect rest of the procedure all at once, it might turn the simple task into complex situation which can cause hours to debug.

 

4- Always use print command to debug the data, by that you can see the flow of data at any point.

 

5-Arrange the data inside frame layouts and write the comments where required, it would be helpful for anyone who wants to use this code in future.

 

 

Conclusion

Usually in studios artists from various 3d departments are always stuck at some point where tools are limited, so in that particular cases It was a good exercise and helps me understanding the purpose of creating UI inside maya.

node_utils.mel