Btw, if you are not familiar with pymel it's a 3rd party developed
alternative to maya.cmds.  It's much more pythonic and ships with Maya by
default now.  It basically wraps up the default maya python implementation
plus the maya python API and defers to the faster implementation
automatically.  I'm sure it's much more elegant than that, but that's what
it does in a nut shell :).


On Thu, Apr 17, 2014 at 11:07 AM, Tony Barbieri <[email protected]> wrote:

> As far as I can tell the difference is executeDeferred will accept a
> pointer to a callable whereas evalDeferred is the old mel call which
> accepts a string.  Reading the pymel wrapper information, the default
> utils.executeDeferred will not execute when in batch mode:
>
>
> http://download.autodesk.com/global/docs/maya2012/en_us/PyMel/generated/functions/pymel.mayautils/pymel.mayautils.executeDeferred.html
>
>
> On Thu, Apr 17, 2014 at 10:46 AM, Tim Crowson <[email protected]> wrote:
>
>> I'm seeing another example that uses utils.executeDeferred() rather than
>> cmds.evalDeferred(). What's the difference between these two?
>>
>>
>> On Thu, Apr 17, 2014 at 9:37 AM, Tony Barbieri <[email protected]>wrote:
>>
>>> Np!  I'll do my best to help out with additional questions :).  This
>>> list is pretty active so I'm sure someone will be able to help.
>>>
>>>
>>> On Thu, Apr 17, 2014 at 10:19 AM, Tim Crowson <[email protected]>wrote:
>>>
>>>> Gotcha! Thanks Tony! Nice to see a familiar face too. I'm sure I'll
>>>> have plenty more questions as I progress...
>>>>
>>>>
>>>> On Thu, Apr 17, 2014 at 9:18 AM, Tony Barbieri <[email protected]>wrote:
>>>>
>>>>> Hey Tim,
>>>>>
>>>>> You'll want to use evalDeferred.  So for your example above, instead
>>>>> of calling buildMenu directly in the userSetup.py, call it like:
>>>>>
>>>>>
>>>>> # Defer our startup commands until after Maya has finished loading
>>>>> # completely.
>>>>> cmds.evalDeferred("buildMenu()")
>>>>>
>>>>> notice that "buildMenu()" is a string.
>>>>>
>>>>>
>>>>>
>>>>> On Thu, Apr 17, 2014 at 10:08 AM, Tim Crowson <[email protected]>wrote:
>>>>>
>>>>>> Hello all, I'm a Softimage user needing to move over and get familiar
>>>>>> with Maya. I apologize in advance if I post any stupid questions. Does 
>>>>>> this
>>>>>> list have its own search function? I looked for one but couldn't find 
>>>>>> any.
>>>>>>
>>>>>> I'm using Maya 2015 on Windows at the moment and I'm having trouble
>>>>>> with my userSetup.py file. Basically, I want to create a custom menu in 
>>>>>> the
>>>>>> menu bar at launch. After googling some tutorials on the matter, I have
>>>>>> code that works great when fired from the the script editor, but when run
>>>>>> at launch, it bombs. Basically my function to build the window is unable 
>>>>>> to
>>>>>> get a handle on the main Maya window... it gets returned as
>>>>>> *NoneType*. The relevant part of my code looks something like this:
>>>>>>
>>>>>>
>>>>>> def buildMenu():
>>>>>>     ptr = mui.MQtUtil.mainWindow()
>>>>>>     mayaWindow = shiboken.wrapInstance(long(ptr), QtGui.QWidget)
>>>>>>
>>>>>>     mainMenu = cmds.menu('MyMenu', p=mayaWindow, l='My Menu')
>>>>>>     cmds.menuItem(p=mainMenu, d=True, dl='Some Divider')
>>>>>>     cmds.menuItem(p=mainMenu, l='Some Tool')
>>>>>>
>>>>>>
>>>>>> The error comes from *wrapInstance(long(ptr))*, because *ptr *is
>>>>>> being returned as *None*. I'm unsure how to proceed. It basically
>>>>>> seems as though my code is getting run *before *the main window has
>>>>>> initialized, so it doesn't exist yet?
>>>>>>
>>>>>> Thank you for any assistance...
>>>>>>
>>>>>> -Tim Crowson
>>>>>> CG Lead, Magnetic Dreams
>>>>>>
>>>>>> --
>>>>>> 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/cf9a9f08-7a78-44c4-9a6e-c225f50424e4%40googlegroups.com<https://groups.google.com/d/msgid/python_inside_maya/cf9a9f08-7a78-44c4-9a6e-c225f50424e4%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>> .
>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> -tony
>>>>>
>>>>> --
>>>>> 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/CAJhmvsQG0F%3D7Yd7dZMw5r%3DyAd-Zc034tpD3BgifKz2W1xN7YHw%40mail.gmail.com<https://groups.google.com/d/msgid/python_inside_maya/CAJhmvsQG0F%3D7Yd7dZMw5r%3DyAd-Zc034tpD3BgifKz2W1xN7YHw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>>
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>>
>>>>  --
>>>> 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/CAPh%3D1bmtn-sPEt4xMq4szOxKCtuUsABBNNa9LQ_Dq_OjzoeyOg%40mail.gmail.com<https://groups.google.com/d/msgid/python_inside_maya/CAPh%3D1bmtn-sPEt4xMq4szOxKCtuUsABBNNa9LQ_Dq_OjzoeyOg%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>>
>>>
>>> --
>>> -tony
>>>
>>> --
>>> 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/CAJhmvsQw61H8%3DXKHNEhuUhPYWCFL6FOJxcUgPPvg%2Bb4sb0OZ7Q%40mail.gmail.com<https://groups.google.com/d/msgid/python_inside_maya/CAJhmvsQw61H8%3DXKHNEhuUhPYWCFL6FOJxcUgPPvg%2Bb4sb0OZ7Q%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>  --
>> 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/CAPh%3D1bkQPmOaFUiES5hdsneA3HDj7KoyaYQUBX_MZPMYE2p5kA%40mail.gmail.com<https://groups.google.com/d/msgid/python_inside_maya/CAPh%3D1bkQPmOaFUiES5hdsneA3HDj7KoyaYQUBX_MZPMYE2p5kA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> -tony
>



-- 
-tony

-- 
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/CAJhmvsQck_pervHGCR4ie%2B-edrq8poOuAbEfoeeuZ3vgW6Mncg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to