Created
January 14, 2015 15:44
-
-
Save csaez/9b7669303af32f201460 to your computer and use it in GitHub Desktop.
Maya: Remove selected cameras (including startup cameras)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from maya import cmds | |
def is_camera(node): | |
cond = ( | |
"camera" in [cmds.nodeType(x) for x in (cmds.listRelatives(node, s=True, f=True) or [])], | |
cmds.nodeType(node) == "camera", | |
) | |
return any(cond) | |
cameras = [c for c in cmds.ls(sl=True, l=True) if is_camera(c)] | |
print cameras | |
if len(cameras): | |
for c in cameras: | |
cmds.camera(c, e=True, sc=False) | |
cmds.delete(cameras) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment