
Since each multi-use flag’s arguments are provided in a separate list in Python, there is no way to intermix them. This causes a problem for commands in which different multi-use flags must be mixed-and-matched. Again pymel sounds like how nuke uses python so I think I may get the hang of it quicker, and I always wondered why Unicode stuff kept coming up with cmds.ls stuff when it didn’t in nuke.Certain flag changes to Maya commands are necessary because the arguments for multi-use flags in Python must be passed as a list to the flag.

I’ll have to start using it to get my head around it. That’s cool pymel returns an object not just a string. Hey thanks so much for taking the time to describe your workflow which sounds good. I know it seems like a pretty big departure from maya.cmds, and a lot of looking things up, but eventually you just get a feel for it. Say i wanted to set the Translate Z of a object, instead of setAttr i can just look in my channel box and see the longName for it is ‘translateZ’ so ‘(10)’ would set the z translate to 10 or in short form ‘(10)’ If you ever don’t know what the object type is you also can just use the python builtin type() to figure it out and search up the appropriate class in the pymel docs.Īfter this the only add bit is maya attributes, which use the long or short names for attributes but not the nice name since that contains spaces. I still will quite often just use the docs for maya.cmds for getting basic commands than figure out what kinda of object in pymel it makes. All commands will return something from one of these groups. You can see sections for nodetypes, datatypes and uitypes. If you look at the sidebar of the pymel docs site well i know what it returns is a list of objects based on the Transform Class, and i got all the methods and attributes of that class available to me. Say i used pm.ls(sl=True) or pm.selected() to return a list of objects in the scene. Main difference between how pymel and cmds work, is that pymel returns a object instead of just a string like cmds does.Īlmost all the maya.cmds commands got pymel versions that return objects, you just need to know what class those objects are based on. Verts = cmds.polyListComponentConversion( allGeo, tv=True ) If you want to use the index (sometimes you´ll need it) this would be the code: “lect(allGeo)” strange :curious: because the index of an array should be an integer, so you get the error: Error: line 1: TypeError: file line 8: list indices must be integers…

In example, if allGeo = (“jaw_geo”, “head_geo”, “hand_geo”), then if you´re using the old command “lect(allGeo)”, the result would be: So, you dont have to select any element in the array with an index:īecause “i” is not the index of the position in the array, is the element in the list itself. It means that “elem” is going to go trough all the elements in the list, one by one, and automatically is going to change the index of the element that is reading (internally).

Verts = cmds.polyListComponentConversion( geo, tv=True ) # import maya.cmds as cmdsĪllGeo = cmds.ls( "*geo", recursive=True ) Well, the problem is that you´re not using properly the for loop.
