cyclops cyclops - 4 months ago 71
Python Question

Maya Python change current renderer in render setting

How to change current renderer in maya by python commands.
for example : "maya software" to "mental ray" or vice versa
any python or pymel command.?

import pymel.core as pm
import maya.cmds as cmds

Answer
import maya.cmds as cmds

Switch to mental ray

cmds.setAttr("defaultRenderGlobals.currentRenderer", "mentalRay", type="string")

Switch to maya software

cmds.setAttr("defaultRenderGlobals.currentRenderer", "mayaSoftware", type="string")