I'm working on a custom playblast tool for Maya and I'm running into a little problem on how to query the available compressions for each format to perform the playblast.
I can use:
import pymel.core as pm
availableFormats = pm.playblast(query = True, format = True)
print availableFormats
The result I get is ['qt','avi','image']
. That is fine but now I need the compression options.
When I use
import pymel.core as pm
availableCompressions = pm.playblast(query = True, compression= True)
print availableCompressions
I get:
[u'Codec IYUV', u'MS-RLE', u'MS-CRAM', u'MS-YUV', u'Toshiba YUV411', u'TSCC', u'TSC2', u'none']
Which are the compressions options for the 'avi' format.
So, question:
How can I query the compressions for a specific format?
I tried passing:
pm.playblast(query = True, format = 'qt', compression = True)
but it does not work, because, of course, query flag only permits booleans...
It seems to be a python binding bug. Doing in Mel :
whatIs changePlayblastFormat;
// Result: Mel procedure found in: /path/mayaxxxx/scripts/others/performPlayblast.mel //
you can find that they query the encoding formats like this :
string $selectedFormat = `optionMenuGrp -q -value playblastFormatWidget`;
string $lEncodings[] = `playblast -format $selectedFormat -q -compression`;
So my suggestion would be be to use a mel eval for this case :
pm.mel.eval('playblast -format "{0}" -q -compression;'.format('qt'))