Community
Maya Programming
Welcome to Autodesk’s Maya Forums. Share your knowledge, ask questions, and explore popular Maya SDK topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Query currently active viewport camera

1 REPLY 1
SOLVED
Reply
Message 1 of 2
Anonymous
4789 Views, 1 Reply

Query currently active viewport camera

Anonymous
Not applicable

How do I query the current active camera in the viewport by code?
So the camera you currently see the viewport through?

0 Likes

Query currently active viewport camera

How do I query the current active camera in the viewport by code?
So the camera you currently see the viewport through?

Tags (3)
1 REPLY 1
Message 2 of 2
g2m.agent
in reply to: Anonymous

g2m.agent
Collaborator
Collaborator
Accepted solution
import maya.cmds as cmds
curCamera = 'persp'
for vp in cmds.getPanel(type="modelPanel"):
    curCamera=cmds.modelEditor(vp,q=1,av=1,cam=1)

see here:

https://stackoverflow.com/questions/27290602/how-to-query-current-viewport-renderer-in-maya

import maya.cmds as cmds
curCamera = 'persp'
for vp in cmds.getPanel(type="modelPanel"):
    curCamera=cmds.modelEditor(vp,q=1,av=1,cam=1)

see here:

https://stackoverflow.com/questions/27290602/how-to-query-current-viewport-renderer-in-maya

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report