import_cookies : Python
This project is a script I wrote in Python for mass-producing chocolate chip cookies. I came up with the idea for the project while modeling a bakery scene– I wanted to model a huge tray of 50 or more chocolate chip cookies and realized doing so woulc actually require a tremendous amount of time to do well. To help with the process, when a sphere (the cookie) is selected, the script randomly places chocolate chips within the object.
I used two third party Maya packages: maya.cmds and pymel.core, as well as the Python packages random and functools. I used random to randomly generate vertex positions, chocolate chip positions, chocolate chip sizes, and chocolate chip angles, creating variation among the different chips. To parameterize chip generation, I used three factors– number of chips, chip size (decimal value referring to scale of chip relative to cookie), and the actual location of the cookie object selected– from the user using a pop-up user interface window. I used functools to apply these parameters in a function to execute the script.
In order to get some chips embedded inside the cookie, the method also creates a hidden piece of cookie geometry within the selected cookie that the chips are constrained to. Each of the chocolate chips are created as separate objects with subtle differences in their geometries, and each "set" of chocolate chips created is automatically organized into a group.