View Full Version : get active camera pymel maya 2011

04-13-2010, 11:55 PM
so in maya 2010 this line gave me my camera
currentCam = PyNode(modelPanel(getPanel(wf=True), q=True, cam=True))
but in 2011 seems to be giving an error?
# Error: RuntimeError: file C:\Program Files\Autodesk\Maya2011\Python\lib\site-packages\pymel\internal\pmcmds.py line 98: modelPanel: Object 'viewPanes|modelPanel4' not found. #
in mel i would have gone
$cam = modelPanel("-q", "-cam", getPanel("-wf"));
is there a better way of getting the camera?

04-14-2010, 08:33 AM
I'm not so familiar with pyMel, but I thought the point of it was that it made everything more OO style, so accessing stuff like a panel's camera is done via methods and attributes e.g:

camera = getPanel(wf=1).getCamera() # pseudocode!!

what you have there looks more like basic maya python code James:

currentCam = mc.modelPanel(mc.getPanel(wf=True), q=True, cam=True)


04-14-2010, 09:45 AM
yeah im kinda getting the vibe that im doing this wrong time to dive in to the docs a little further i think

04-14-2010, 04:35 PM
unfortunately, i think this may be a bug in pymel. UI elements changed a lot in 2011, and certain paths that were valid became invalid, hence the error. none of the beta testers caught the bug until it was too late to submit changes. sucks, i know. we just released 1.0.2 which has a lot of bug fixes. i'll post the official release on this forum now.


04-14-2010, 05:16 PM
thanks for the reply chad, and a big thanks to you and the rest of the guys who made pymel i've been having quite alot of fun messing about with it :thumbsup:


CGTalk Moderation
04-14-2010, 05:16 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.