Playblast multiple views in maya

Hello, first post here… need some help on creating a small tool.
I was trying to create a tool to playblast all the views in maya for the animators at work.

Here is what am doing so far…


import maya.cmds as cmds
import maya.mel as mel

viewPanels = cmds.getPanel(type="modelPanel")
visiblePanels = cmds.getPanel(visiblePanels=True)
renderPanels = list( set(viewPanels) & set(visiblePanels) ) 

for panel in renderPanels:
	cmds.setFocus(panel)
	panelName = cmds.panel(panel, q=True, label=True).split(" ")[0]
	print panelName
	renderPath = "~/Desktop/test/playblast/%s.mov"%panelName
	mel.eval('playblast  -format qt -filename "'+renderPath+'" -sequenceTime 0 -clearCache 1 -viewer 1 -showOrnaments 1 -offScreen  -fp 4 -percent 100 -compression "jpeg" -quality 100;')

This works fine if I have a quad view… where all the views will be rendering by their actual names. Side, Front, Top and Persp.

But it fails to recognize the view name if I have two views.
If I have just perspective and side view it renders both the views properly, but the panelName is returned as Top instead of Side.

Am I missing something… please point out if there is any better way of doing it.

1 Like

Instead of getting the label for the panel, you can get the camera associated with the panel:

cameraName = cmds.modelEditor(panel, q=True, camera=True)
renderPath = "~/Desktop/test/playblast/%s.mov"%cameraName

That solves the problem. Thanks.

Hey I have a quick question for you, why are you using mel.eval for the playblast when you can use cmds.playblast as well?
Does this change something? I’m currently trying to write a tool using playblast and I’m having some trouble.