Flower Creator
Designing a Python-based UI for Flower Creation

As a 3D VFX and Digital Composition artist, I have always been fascinated by the intricacies of flower designs. So, I decided to create a Flower Creator tool that will help me design beautiful flowers quickly and efficiently. The Flower Creator tool is a user-friendly graphical user interface (GUI) built with Python script and designed using Qt Designer.

Key Features and Improvements

The Flower Creator tool has been designed to make flower designing a breeze. With its intuitive user interface, users can create beautiful flowers by simply selecting the desired petal shape, color, and size. The tool allows users to adjust the parameters of the flower petals, including the number of petals, the angle of the petals, and the tilt of the petals.

To use the Flower Creator tool, users must follow a specific folder structure, which is demonstrated in the picture on the left side. Users must also modify the “userSetup.mel” window to change the path to  “C:/Users/”Username”/Documents/maya” + “/Qt_Dev”. This ensures that Maya can locate the “Qt_Dev” file and execute the Python code.

Thanks to TzuHao Chen & YouRan Lu for giving me the the idea of making my project work.

MEL CODE – for making the spiral petals “For Loop” and “Instance”

				
					

// create your own flower petal or anything
global proc petal1(     int    $num, // petal numbers
                               float  $angle,  // 360/ $num
                                float  $tilt,  // 90 / $num
                               float  $start_rad, 
                               float  $end_rad,
                               float  $height, 
                               float  $width, 
                               float  $length)     {
    int    $index = 0;    
    int    $n;
    string $objname[]; // declaring the var
    string $allnames[];
    
float $rad_range = (($end_rad - $start_rad)*2) ;
for($n = 0; $n < $num; $n++) {
        $objname = `instance "petal"`;
        $scale = float($n)/($num*10);
        float $rad = $rad_range * $scale + $start_rad;
        //float  $angle = (360/$num) ;
        //float  $tilt = (90/$num) ;
        
        if ($n >= 5) {
    rotate  ($n * (-$tilt)) ($n * ($angle*10))  0 $objname;
      } else {
    rotate  (($n+1) * (-$tilt)) ($n * ($angle))  0 $objname;
}
        float $d = 0.1;
        float $sin = (($n*$d)*sin(($n*$width)/$width));
        float $cos = (($n*$d)*cos(($n*$length)/$length));
        setAttr ($objname[0] + ".translateX") ($sin*($n/$width));
        setAttr ($objname[0] + ".translateZ") ($cos*($n/$length));
        setAttr ($objname[0] + ".translateY") ($n*(-$height/100)) ;
        setAttr ($objname[0] + ".scaleX") ($rad*0.1) ;
        setAttr ($objname[0] + ".scaleY") ($rad*0.1) ;
        setAttr ($objname[0] + ".scaleZ") ($rad*0.1) ;
        $allnames[$index] = $objname[0];
        $index++;
        }
    group $allnames;
    //setAttr ($objname[0] + ".rotateX", 10);
    //setAttr($obj[0] + ".visibility", 0);
    };