# python script for making simple playblasts of your animation in maya
# V1.0
# www.jonathantopf.com 2010

def JTplayblast(m=1, h=False, res=[1280,720]):

if (h==True):

print “\nNOTE: a camera must be selected for this all to work\nh=True > show help (duh)\nres=[1280,720] > base resolution defaults are [1280,720]\nm=1 > resolution multiplier, default is 1\n”

else:

import maya.cmds as cmds

JTcamera = cmds.ls(dag=True, cameras=True, sl=True)[0]

# put [0] of selection list into JTcamera

if (cmds.window(‘JTplayblastWindow’, query=True, exists=True)):

cmds.deleteUI(JTplayblastWindow, window=True)

# delete JTplayblastWindow if it exists in memory already

JTplayblastWindow = cmds.window(widthHeight=((res[0]*m)+4, (res[1]*m)+45), title=”playblast view”)

#set size of the window taking into account the bezel etc

cmds.paneLayout()

JTplayblastModelView = cmds.modelPanel(camera=JTcamera)

# create layout

JTplayblastModelEditor = cmds.modelPanel(JTplayblastModelView, query=True, me=True)

cmds.modelEditor(JTplayblastModelEditor, edit=True, da=’smoothShaded’, dl=’all’, nc=False, tx=False)

# find out the name of the modelEditor asociated with the modelView and set it to display all the right things

cmds.showWindow(JTplayblastWindow)

cmds.window(JTplayblastWindow, edit=True, widthHeight=((res[0]*m)+4, (res[1]*m)+45))

# resize window if its been changed taking into account the bezel (2011 forward)

cmds.setFocus(JTplayblastModelView)

# set focus to the JTplayblastmodelView

cmds.setAttr(JTcamera+”.displayResolution”, 0)

# remove the resolution gate

cmds.playblast(fmt=’qt’, widthHeight=[res[0]*m, res[1]*m], p=100)

# playblast the damn thing

cmds.deleteUI(JTplayblastWindow, window=True)

# and close up the window

cmds.setAttr(JTcamera+”.displayResolution”, 1)

# bring back the resolution gate

JTplayblast()