Friday, November 22, 2013

Heres the Completed script
I noticed the last script the quit def was in the wrong place and broke the "quit" button.
There was a some trouble with the obj exporter but now it is fixed.

import maya.cmds as cmds
#import maya.mel as mel
#Nicholas_Kirlis
#Special Thanks Morrissey Alexander
#Special Thanks Roman Parez
def ExporterWindow():
    #Checks if a window exists, if it does delete it
    if cmds.window("ExpWin", exists = True):
        #I copied this
        cmds.deleteUI("ExpWin", window = True)
       
    #Create a window
    myWin = cmds.window("ExpWin", t = "Exporter of Kirlis")
    cmds.columnLayout()
    cmds.text(l = "Script of Kirlis")
    cmds.text(l = "Choose Your Export Method")
    cmds.button(l = "FBX", c = "FBXExport()")
    cmds.button(l = "OBJ", c = "OBJExport()")
    cmds.button(l = "Quit", c = "DeleteWindow()")
    cmds.showWindow("ExpWin")
   
def FBXExport():
    #Center selection
    cmds.move(0,0,0, rpr = True)
    #Delete all history
    cmds.delete (ch=True)
    #export selection 
    basicFilter = "*.fbx"
       
    filename = cmds.fileDialog2(fileFilter=basicFilter, fileMode=0, caption="FBX export")
       
    cmds.file (filename[0], force=True,  typ= "FBX export" , pr=1, es=1  )
       
def OBJExport():
       
    #Center selection
    cmds.move(0,0,0, rpr = True)
    #Delete all history
    cmds.delete (ch=True)
    #export selection
    basicFilter = "*.obj"
       
    filename = cmds.fileDialog2(fileFilter=basicFilter, fileMode=0, caption="OBJ export")
       
    cmds.file (filename[0], force=True,  typ= "OBJexport" , pr=1, es=1  )
   
def DeleteWindow():
    # and pasted it here
    cmds.deleteUI("ExpWin", window = True)
   
ExporterWindow()

No comments:

Post a Comment