http://therenderblog.com/maya-viewport-render/
This is a bit of a cop out as I haven't had the chance to give it a shot with Octane. But I was wondering if anyone else would be interested or if Jimstar would know if this is truly compatible with Octane or not.
To switch between renders you can do a basic test like so:
currentRender = cmds.getAttr(‘defaultRenderGlobals.currentRenderer’)
#later in the script
if currentRender == ‘arnold’:
# arnold render command
elif currentRender == ‘vray’:
# vray render command
elif currentRender == ‘mentalRay’:
# mr render command
else:
cmds.warning( ‘render engine not supported’ )