Found it here <https://knowledge.autodesk.com/search-result/caas/CloudHelp/cloudhelp/2016/ENU/Maya-Tech-Docs/PyMel/generated/functions/pymel-core-windows/pymel-core-windows-dockControl-html.html> - I'm using PyMel's dockControl.
closeCommand Thanks for the tip, Joe! On Sunday, October 9, 2016 at 4:20:12 PM UTC-7, Kevin C. Burke wrote: > > Hi Joe! > Thanks for weighing in. I have experienced exactly what you're describing > already. > > I need the callbacks to fire as long as my script's window is open. Do you > know of an event that fires when my window is closed? I could remove the > callbacks then? > > > On Sunday, October 9, 2016 at 3:58:34 PM UTC-7, Joe Weidenbach wrote: >> >> The only thing I would add to this is to remember to remove your callback >> when you're done with it, otherwise Maya can have issues with potential >> crashes, for example if you've closed your UI but the callback is still in >> place. I'm not positive that this is as critical in the python side as it >> is on the C++ side, but it's a good practice at the very least. >> On Mon, 10 Oct 2016 at 10:35 AM, Justin Israel <[email protected]> >> wrote: >> >>> >>> >>> On Mon, 10 Oct 2016, 10:31 AM Kevin C. Burke <[email protected]> wrote: >>> >>>> This is exactly what I needed, Justin, *thank you so much*! >>>> >>> >>> Welcome! >>> >>> >>>> On Sunday, October 9, 2016 at 2:25:43 PM UTC-7, Justin Israel wrote: >>>> >>>>> >>>>> >>>>> On Mon, Oct 10, 2016 at 10:04 AM Kevin C. Burke <[email protected]> >>>>> wrote: >>>>> >>>>>> Thanks again for the reply! You've been very helpful. >>>>>> >>>>>> I have a follow-up question...*DagObjectCreated *will fire when any >>>>>> object is created. Am I correct that I'd need to specify a node for >>>>>> *nodeDeleted >>>>>> *to fire? e.g. >>>>>> cmds.scriptJob(nodeDeleted=["pCube1",myFunction]) >>>>>> >>>>>> I only ask because it seems very resource-intensive to add a *scriptJob >>>>>> *to every object in the scene to detect a node deletion. >>>>>> >>>>> >>>>> It would depend on what your application is. When you are notified >>>>> about nodes being created, if your goal was to inspect them and >>>>> conditionally want to register interested when particular nodes are >>>>> removed, then you could go with the script job. >>>>> >>>>> If you want to know when any node is removed, then you could move to >>>>> the Maya API and use the MDGMessage callbacks directly: >>>>> >>>>> import maya.OpenMaya as om >>>>> def node_added(node, *args): >>>>> print "added!", node >>>>> def node_removed(node, *args): >>>>> print "removed!", node >>>>> >>>>> add_id = om.MDGMessage.addNodeAddedCallback(node_added) >>>>> rem_id = om.MDGMessage.addNodeRemovedCallback(node_removed) >>>>> >>>>> >>>>> >>>>> Now you can receive an MObject and inspect each one to take action. >>>>> >>>>> Justin >>>>> >>>>> >>>>>> >>>>>> Thanks! >>>>>> >>>>>> On Sunday, October 9, 2016 at 1:54:05 PM UTC-7, Justin Israel wrote: >>>>>> >>>>>>> >>>>>>> >>>>>>> On Mon, Oct 10, 2016 at 9:48 AM Kevin C. Burke <[email protected]> >>>>>>> wrote: >>>>>>> >>>>>>>> Hi Justin, >>>>>>>> Thanks a lot for the quick reply!!! I found the event " >>>>>>>> *DagObjectCreated" *for when an object is created; am I missing >>>>>>>> the equivalent for when they are removed? >>>>>>>> >>>>>>> >>>>>>> >>>>>>> http://help.autodesk.com/cloudhelp/2016/ENU/Maya-Tech-Docs/CommandsPython/scriptJob.html#flagnodeDeleted >>>>>>> >>>>>>> >>>>>>>> >>>>>>>> Thank you! >>>>>>>> >>>>>>>> >>>>>>>> On Sunday, October 9, 2016 at 1:41:59 PM UTC-7, Justin Israel wrote: >>>>>>>> >>>>>>>>> Hi, >>>>>>>>> >>>>>>>>> Take a look at scriptJobs >>>>>>>>> <http://help.autodesk.com/cloudhelp/2016/ENU/Maya-Tech-Docs/CommandsPython/scriptJob.html>. >>>>>>>>> >>>>>>>>> There are events for when DAG nodes are created, and when nodes are >>>>>>>>> deleted. scriptJob is effectively a high level wrapper around >>>>>>>>> MMessage >>>>>>>>> callbacks. >>>>>>>>> >>>>>>>>> Justin >>>>>>>>> >>>>>>>>> >>>>>>>>> On Mon, Oct 10, 2016 at 9:33 AM Kevin C. Burke <[email protected]> >>>>>>>>> wrote: >>>>>>>>> >>>>>>>>>> Hi, >>>>>>>>>> I have a list that I want to update when objects have been added >>>>>>>>>> or deleted from the Maya scene. >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> Is there some kind of global event or perhaps an Outliner event >>>>>>>>>> that fires when a change like this happens? >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> I am working in PyMel. Thank you! :) >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> -- >>>>>>>>>> >>>>>>>>>> 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/6a3f27b3-02fa-450e-83cf-69c7f200d45c%40googlegroups.com >>>>>>>>>> >>>>>>>>>> <https://groups.google.com/d/msgid/python_inside_maya/6a3f27b3-02fa-450e-83cf-69c7f200d45c%40googlegroups.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/86bb5514-2390-4a7d-b54a-bfe1c3f56e58%40googlegroups.com >>>>>>>> >>>>>>>> <https://groups.google.com/d/msgid/python_inside_maya/86bb5514-2390-4a7d-b54a-bfe1c3f56e58%40googlegroups.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/34397c23-08a8-4c86-8106-ff7fb3672fb7%40googlegroups.com >>>>>> >>>>>> <https://groups.google.com/d/msgid/python_inside_maya/34397c23-08a8-4c86-8106-ff7fb3672fb7%40googlegroups.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/1184b5e1-d9f1-42f0-bef6-8bcfc29b533a%40googlegroups.com >>>> >>>> <https://groups.google.com/d/msgid/python_inside_maya/1184b5e1-d9f1-42f0-bef6-8bcfc29b533a%40googlegroups.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/CAPGFgA3WA2DNs84JGNg2GCSFFz-WN1nBOvyFjgCO8bdNx2XX_A%40mail.gmail.com >>> >>> <https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA3WA2DNs84JGNg2GCSFFz-WN1nBOvyFjgCO8bdNx2XX_A%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/59a80d94-34eb-4cce-ae66-67b98116606b%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
