I am trying to playblast multiple Maya scenes in a folder, without bringing up the Maya GUI.
- I have successfully invoked a headless Maya instance with
mayabatch.exe
- That instance calls a script that crawls a folder
- Each scene is opened
- But I cannot playblast the scene file
1. Purple noise
If I simply call pm.playblast(format='movie', filename=some_filepathname, viewer=False, forceOverwrite=True, offScreen=True)
I get an AVI file with purple noise. If I switch to format='image'
I get a sequence of images with purple noise.
2. Cannot lookThru
Based on some sample playblast code, I tried calling pm.lookThru("persp")
first, but this triggers the following traceback:
# File "C:\Users\username\Documents\playbatch\blaster.py", line 23, in blast_file
# pm.lookThru("persp")
# File "C:\Program Files\Autodesk\Maya2016\Python\lib\site-packages\pymel\inte
rnal\pmcmds.py", line 133, in wrappedCmd
# res = new_cmd(*new_args, **new_kwargs)
# RuntimeError: There is no active view.
...presumably because a headless instance has no view.
3. Forcing a single renderable camera has no effect
A relatively recent (2015) post TO [Maya-Python], "Playblasting in standalone" suggests that all that is needed is a single renderable camera.
cams = cmds.ls(type='camera')
for cam in cams:
cmds.setAttr(cam + '.rnd', 0)
cmds.setAttr('persp.rnd', 1)
...but this still renders purple noise.
Calling the playblast command from the Maya Script Editor / GUI works. Is it possible to playblast from a headless/mayabatch instance? If so, what other values need to be set for a successful playblast?