Return to site

Snowflake Making Tool | Maya | Python

    This is my first tool on Technical Art class. I made a snowflake generate tool, use the given object from the user, to generate a beautiful piece of snowflake. This project is mainly for getting familiar with Python scripting in Maya.
    User interface:
    See how it works on Youtube:
    Python scripts sample:
def on_click_run(slider_scale, slider_angle, slider_level, snow_win):
    ### get values from sliders
    snow_scale = slider_scale.getValue()
    snow_angle = slider_angle.getValue()
    snow_level = slider_level.getValue()
#
    ### list for 1/6 snow piece
    snow_list = []
    snow_list.append(snow_obj)
#
    ### list for 6 parts of the snow piece
    snow_joint_list = []
#
    ### rename the origin object
    pm.rename(snow_obj, 's0')
#
    ### draw 1/6 snow piece
    for i in range(1, snow_level):
        tmp = pm.duplicate(snow_list[i-1])
        snow_list.append(tmp[0])
        pm.rotate(snow_list[i], 0, snow_angle, 0, r = True)
        pm.scale(snow_list[i], snow_scale, 1, snow_scale, r = True)
        pos = pm.xform('%s.vtx[%d]'%(snow_list[i], to_point_index), q = 1, t = 1, ws = 1)
        pm.xform(snow_list[i], t = (pos[0], 0, pos[2]), ws = 1)
#
    ### unite the 1/6 snow piece
    tmpunit = snow_list[0]
    for i in range(1, snow_level):
        tmpunit = pm.polyUnite(tmpunit, snow_list[i])
#
    ### draw all 6 parts
    snow_joint_list.append(tmpunit[0])
    for i in range(1, 6):
        tmp = pm.duplicate(tmpunit[0])
        snow_joint_list.append(tmp)
        pm.rotate(tmp, 0, 60*i, 0, r = True)
#
    ### unite the whole snow piece
    snow_final = snow_joint_list[0]
    for i in range(1,6):
        snow_final = pm.polyUnite(snow_final, snow_joint_list[i])
#
    ### delete the menu window
    snow_win.delete()
All Posts
×

Almost done…

We just sent you an email. Please click the link in the email to confirm your subscription!

OKSubscriptions powered by Strikingly