|04 April 2013||#1|
cmds.button (python, callbacks, maya 2013) , takes no arguments, one given
EDIT: I learned some for it to work, but please read nontheless
sorry for the misrable english, I'm dead tired...
Sorry to create one more of these,. I have read the others and read the pymel doc about it but I'm still having issues.
As you can see, I haven't begun using PYMEL so I'm wondering, are there any issues if I should start using it seeing as it's a 3rd party module. I guess the only limitation would be only for earlier Maya versions before python, but I don't plan to switch back to <8.5.
And as far as I can tell, Autodesk are just happy to ship it with Maya seeing as it's quite a big success.
Reason I'm asking is if I should just go ahead and use some of pymels functions or are there other ways by only using maya's python module?
Jeremy Ernst creates a new def() for the purpose of issuing a command to be executed by Mayas button command(26.00 mins in the video below). This works, but I was just looking for a cleaner approach and since I'm learning....
So anyway. This is my code, copied from Jeremy Ernst's vimeo tutorials.
and here's the icons which are just for test. Supposed to be placed in maya/prefs/icons/testIcons/icons.xpm
Thanks for any inputs and ideas.
EDIT: Actually I followed along and tried to just use the one method with partial etc and it works as I had hoped.
PS. I still would like to know the answers to my questions on PYMEL.
Last edited by Geuse : 04 April 2013 at 10:58 PM.
|04 April 2013||#2|
Join Date: Apr 2004
With pymel you can create a cleaner code.
e.g. you can simply create a button:
What is much easier to read than:
Same with windows. You can simply subclass from a pm.Window() class and add your methods. This way you can keep all data in your window class what makes callback handling quite easy without the need of any global variables.
|04 April 2013||#3|
Where's my pony?
vfx & creature td
Join Date: Jun 2003
In your code example you could add "import pymel.core as pm" and then replace all your mc's with pm's and it would probably still work. But if thats all you did it would hardly be worth the effort. The reason I like pymel is that it returns objects (PyNodes) instead of names (strings). Objects (like Classes) have methods that I think are nicer to work with than the mel like functions from maya.cmds.
obj = pm.PyNode('pCube1')
obj = 'pCube1'
Both can get the job done. I prefer object oriented pymel.
|Thread Closed share thread|