cmds.playblast and VP2.0, processing nag

591 views
Skip to first unread message

Fredrik Averpil

unread,
May 25, 2016, 10:10:11 AM5/25/16
to python_in...@googlegroups.com

Hey all,

We’ve got a “nag” in Maya 2015 where you need to sit and look at “Viewport 2.0 processing…” for at least a minute when you execute cmds.playblast and when using VP2.0/OpenGL.

Here’s the code which is part of an application which grabs the active viewport and saves it down to a small PNG image:

import maya.cmds as cmds

active_panel = cmds.playblast( activeEditor=True )
current_frame = cmds.currentTime(q=True)

cmds.modelEditor(active_panel, edit=True, hud=False) # hide HUD
cmds.playblast(frame=[current_frame], percent=100, offScreen=True, width=300, height=169, widthHeight=[300,169], format='image', compression='png', completeFilename='c:/users/fredrik/desktop/playblast.png', viewer=False)
cmds.modelEditor(active_panel, edit=True, hud=True) # show HUD

I really don’t understand why and when the processing bit is required by Maya. If you run this code a second time, the processing nag isn’t there anymore and the PNG is generated within a couple of seconds. However, artists in my studio say that it’s not only the first time you do the playblast that the processing happens. So perhaps if you make changes to the scene or moves the camera around, the processing happens again. Not really sure.

If I quickly change the viewport into the Legacy one (via cmds.modelEditor), the PNG is generated within seconds at all times. So this could be one approach to avoid the minute-long wait to screenshot the active viewport in Maya 2015.

Can anyone shed some light on what’s going on, and if there’s a way to avoid the processing wait?
Perhaps there’s a more clever way to get a quick screenshot of the viewport? – For example, does anyone know how the snapshot feature work in Maya’s render view and if it could be accessible through Python/MEL?

Regards,
Fredrik

Marcus Ottosson

unread,
May 25, 2016, 10:42:22 AM5/25/16
to python_in...@googlegroups.com
My bet is one the performance options in the Viewport 2 option dialog, such as Vertex Cache and Consolidate World. I suspect there might be some refreshing going on.

Does it still happen if you most of those those off?

--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAD%3DwhWOjVv7j_zkMbNuHAXQTZ5B2AVj%3Dx6XYpyNM2tP65Q_OxA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.



--
Marcus Ottosson
konstr...@gmail.com

Dylan Neill

unread,
May 25, 2016, 9:23:29 PM5/25/16
to Python Programming for Autodesk Maya
Hey Fredrick,

Not really an answer for the VP2 issue but I haven't experienced these pauses you mention by using the Maya API to grab the images instead:

import maya.OpenMaya as om
import maya.OpenMayaUI as omui

view
= omui.M3dView.active3dView()
image
= om.MImage()
view
.readColorBuffer(image, True)
image
.resize(300, 169)
image
.writeToFile('/path/goes/here', 'png')



Fredrik Averpil

unread,
May 26, 2016, 2:05:54 AM5/26/16
to python_in...@googlegroups.com
@marcus - those settings didn't seem to make a difference, unfortunately. I really don't get what's going on. Anyone on here from Autodesk who might take a stab at guessing why this "VP2 processing" is happening when you playblast a still frame?

@dylan - that was awesome. Thanks so much for that. Your code works right out of the box for me. I really need to look into the Maya Python API and stop relying on maya.cmds... :)





Reply all
Reply to author
Forward
0 new messages