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

Reply via email to