PyMEL is all OOP. Every maya node type is wrapped by a class and has all 
maya.cmds relevant to that object attached as methods to it. You can even 
create custom sub-classes that inherit all methods and attach your own.

We use it for 99.9% of our tools. It only slows down a lot when iterating 
over tons of objects; like mesh iteration or something like that (reason is 
it instantiates a new object for every single vert, this is cool because 
every vert is a MeshVertex object with a hundred handy methods on it, like 
.getNormal() etc. but this can be slow if you have a large mesh).

Enjoy OOP land in Maya! It's pretty damn fun and fast to code. Try setting 
up a nice IDE too for some awesome command completion, code inspection, 
real-time debugging, etc. (couple tips on my blog if you need it: 
artoftech.co)

-jason

On Thursday, December 19, 2013 1:46:51 PM UTC-8, Eric Thivierge wrote:
>
> Hey Jer,
>
> Not doing any really heavy lifting with it. I'm staying as far away from 
> mel as possible and have decided to go the pymel route. I'm already much 
> happier with that at the moment than mel and OpenMaya 2.0 as well. I would 
> really just like a proper object model in Maya.
>
> Thanks for the info.
>
> Eric T.
>
> --------------------------------------------
> Eric Thivierge
> http://www.ethivierge.com
>
>
> On Thu, Dec 19, 2013 at 4:06 PM, Jeremy YeoKhoo 
> <[email protected]<javascript:>
> > wrote:
>
>> Hey Eric,
>>
>> Hows it going? 
>>
>> It really depends on what you need. Using OpenMaya (or python for that 
>> matter) doesnt necessarily make things faster in maya. It really depends on 
>> whether youre trying to make a plugin or youre executing a command. Using 
>> OpenMaya with with python uses a wrapper (SWIG) anyway, but there is a new 
>> python API 2.0, but Im not sure how much faster it is but its better in 
>> with the implementation of python's syntax. 
>>
>> If youre trying to get the shape node after creating a transform, then I 
>> would do....
>>
>> import maya.cmds as cmds
>>
>> myLoc= cmds.spaceLocator('')[0]
>> myLocShape= cmds.listRelatives(myLoc, s=1)[0]
>>
>>
>> But if youre creating a plugin or your own custom locator with a 
>> shape(that does something) then you have to use 
>>
>> import maya.OpenMayaMPx as OpenMayaMPx 
>>
>> class myClass(OpenMayaMPx.MPxLocatorNode):
>>     def __init__(OpenMayaMPx.MPxLocatorNode.__init__, self):
>>
>> And etc..............
>>
>> Write that plugin so it returns a shape node and then execute your 
>> command that created the plugin and node... And away you go, but I reckon 
>> thats not what you want to achieve.
>>
>> -Jeremy
>>
>>
>> On Thursday, 19 December 2013 05:34:33 UTC+11, Eric Thivierge wrote:
>>>
>>>  Hey all,
>>>
>>> Been lurking here for a long time but just now picking up some Maya 
>>> programming for some rigging tools here at work. I've been a long time 
>>> Softimage user and am used to the OM they have there so it's a bit of an 
>>> uphill battle trying to make heads or tails of some of the stuff in 
>>> OpenMaya.
>>>
>>> Is this the simplest way to get to the shape node after it's created 
>>> from the transform node?
>>>
>>> # Sample Python
>>> import maya.OpenMaya as om
>>>
>>> dagModifier = om.MDagModifier()
>>>
>>> locator = dagModifier.createNode('transform')
>>> dagModifier.renameNode(locator, "myLocator")
>>> dagModifier.createNode('locator', locator) # create locator shape under 
>>> transform
>>> dagModifier.doIt()
>>>
>>> locatorDagPath = om.MDagPath()
>>> locatorDag = om.MFnDagNode(locator)
>>> locatorDag.getPath(locatorDagPath)
>>> locatorDagPath.extendToShape()
>>>  
>>> shapeDag = om.MFnDagNode()
>>> shapeDag.setObject(locatorDagPath.node())
>>> shapeNode = om.MObject()
>>> shapeNode = locatorDagPath.node()
>>>
>>> dagModifier.renameNode(shapeNode, "myLocatorShape")
>>> dagModifier.doIt()
>>>
>>> --------------------------------------------
>>> Eric Thivierge
>>> http://www.ethivierge.com
>>>  
>>  -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Python Programming for Autodesk Maya" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>>  To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/python_inside_maya/8fc33ef0-6cff-4cc3-8c31-34eea1fa2250%40googlegroups.com
>> .
>>
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/fc8e0df3-9a02-4997-8124-db88956be470%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to