Can you send events only to a specific node?

messenger.send() broadcasts an event to anyone who cares to accept it. But what if you only want it sent to one node, or to a limited group?

For example: I’m making a little helper framework for mouse picking/interaction. I have a class with the collision handler task, and I’d like it to send a “mouseEnter” event to an object when you touch it. there are a couple ways i could think of to do it.

  1. send the mouseEnter event, everybody accepts it and decides whether they’re the correct recipient

  2. set a pythonTag on the object pointing back from the nodepath to the object which should handle the event, e.g.

pickedNP.getPythonTag("pythonThingy").onMouseOver()

(1) seems like the right way to do it, but is that wasteful. all that extra event sending?

(2), it’s not as graceful if you don’t define the onMouseOver() method or don’t set the python tag, but it’s very direct.

I may also be far too stuck in a Java/JavaScript/ActionScript/C++ paradigm too and not thinking of this pythonically …

(3) synthesize an event name “object-mouseEnter” where object is the name of the object you touched. Each object listens for its own object name.

This is the approach used most commonly within existing Panda code.

David