Changing camera type via python

Is there a way to change the camera type via python(see picture)?

This probably isn’t much help, but I don’t think there is a simple way. Perhaps someone will have an alternative method.

There is no attribute for Camera Type so you can’t use setAttr like the below.

import maya.cmds as cmds
cmds.setAttr (("cameraShape1._ATTRIBUTE_"), 0) 

You can run this MEL to get a list of attributes:

for($at in `listAttr cameraShape1`){
     print($at+"\n");
}

Hopefully someone finds a way to help

setAttr “sideShape.orthographic” 1; << orthographic
setAttr “sideShape.orthographic” 0; << perspective

import maya.cmds as cmds
cmds.setAttr(“cameraShape.orthographic”,1)
cmds.setAttr(“cameraShape.orthographic”,0)

1 Like

This works for ‘orthographic’.
But how do I switch to other modes(see screenshot)?


especially vr_camera…

This topic was automatically closed after 87 days. New replies are no longer allowed.