OK just to wrap up this days-long conversation with myself, I finally got this working. Been down the rabbit hole and back with all these stupid flags and attributes.
It wasn't the arnold renderer like I thought yesterday. I'd always been using the hardware renderer. The rendermode of '4' is what tells it to use the textures. But I couldn't get it to use the gamma I wanted. I would have thought that setting the colorManagementPrefs outputTransform for the 'playblast' target would have worked, but it wouldn't, for me.
Finally what worked was changing the settings on the 'renderer' target. Like this:
colorManagementPrefs -e -outputTransformEnabled true -outputTarget "renderer";
colorManagementPrefs -e -outputUseViewTransform -outputTarget "renderer";
so my whole playblast output script looks like this:
if(`objExists Playblast_Camera`)
{
string $cams[] = `lsType("camera")`;
for ($cam in $cams)
{
catchQuiet(`setAttr ($cam + ".rnd") 0`);
}
catchQuiet(`setAttr ("Playblast_Camera.rnd") 1`);
}
else
{
print ("Could not find Playblast_Camera\n");
}
catchQuiet(`setAttr ("defaultResolution.width") 1280`);
catchQuiet(`setAttr ("defaultResolution.height") 1280`);
setCurrentRenderer "mayaHardware2";
catchQuiet(`setAttr ("hardwareRenderingGlobals.renderMode") 4`);
colorManagementPrefs -e -outputTransformEnabled true -outputTarget "renderer";
colorManagementPrefs -e -outputUseViewTransform -outputTarget "renderer";
playblast -clearCache 1 -viewer 0 -showOrnaments 0 -percent 100 -quality 100 -width 1280 -height 1280 -offScreen -forceOverwrite -format "avi" -filename $DestFullFilePath;