Pymel is more pythonic than cmds. Also pymel is object oriented. There are only adventages of using pymel istead of cmds. In this simple above example, you doesn't see it, I can write it strice in MEL, or maya cmds.
But this example, should work in more OOP way: import pymel.core as pm # Get the panel pan = pm.getPanel(withFocus=True) # Name pan.getCamera() But I have a problem, because the getPanel(), allways return me ui.Panel objects, even when I use the "all=True" flag. It's strange becasue it should return the ui.ModelEditor object when I have viewport actived. I use the last version of pymel from git repo (1.0.4 (8cfdc8c) 2012/1/19, Stephen <[email protected]>: > I'm in the early steps of learning python in maya and was curious why you > are using pymel for this , rather than just maya.cmds. > (it's the exact same in maya.cmds) > -s > > Sent from blackberry > > On Jan 19, 2012, at 7:53 AM, Kamil Hepner <[email protected]> wrote: > >> Try this: >> >> import pymel.core as pm >> >> # Get the panel >> pan = pm.getPanel(withFocus=True) >> >> # Name >> print pm.windows.modelPanel(pan, query=True, camera=True) >> >> >> Should work. >> Cya! >> >> 2012/1/10, deadparticle <[email protected]>: >>> i can hardly find infomation of this >>> >>> -- >>> view archives: http://groups.google.com/group/python_inside_maya >>> change your subscription settings: >>> http://groups.google.com/group/python_inside_maya/subscribe >>> >> >> -- >> view archives: http://groups.google.com/group/python_inside_maya >> change your subscription settings: >> http://groups.google.com/group/python_inside_maya/subscribe > > -- > view archives: http://groups.google.com/group/python_inside_maya > change your subscription settings: > http://groups.google.com/group/python_inside_maya/subscribe > -- view archives: http://groups.google.com/group/python_inside_maya change your subscription settings: http://groups.google.com/group/python_inside_maya/subscribe
