city button test


import maya.cmds #import maya

def floor():

    cmds.polyPlane(w=30, h=30, sx=1, sy=1)

    cmds.move(7,0,7)

    

def building():

    cmds.polyCube(w=5, h=20, d=5)

    cmds.move(7,10,7)

    

def car():

    cmds.polyCube(d=2, w=5, h=2)

    cmds.move(0,1,0)

def del_all():

    cmds.select( all=True )

    cmds.delete()

  

def close_delete_all():

    cmds.deleteUI("new_window", window=True) #close window

    del_all()

def view():

    cmds.viewFit(all=True) #selected only

#width - x, height - y, depth - z

if cmds.window("new_window", exists=True):

    cmds.deleteUI("new_window", window=True)

the_window=cmds.window( "new_window", title="Cit(.p)y", widthHeight=(300, 300), bgc=(1,0.8,0.7)) #defining window

cmds.columnLayout( adjustableColumn=True )

cmds.button( label='Create Floor',c='floor()', height=30, bgc=(1,0.2,0.2))

cmds.button( label='Create Buildings',c='building()', height=30, bgc=(1,0.85,0))

cmds.button( label='Create Cars',c='car()', height=50, bgc=(0.1,0.35,1))

cmds.button( label='Fit all to View',c='view()', height=50, bgc=(0.4,0.4,0.4))

cmds.button( label='Delete',c='del_all()', height=50, bgc=(0.2,0.2,0.2))

cmds.button( label='Close Menu and Delete',c='close_delete_all()', height=50, bgc=(0,0,0))#buttons

cmds.setParent( '..' )

cmds.showWindow( window )

Leave a comment

Log in with itch.io to leave a comment.