SOHANDLEEVENTACTION(3iv)

✨ NAME ✨

okay bestie, so SoHandleEventAction β€” it's the whole vibe of letting nodes in a scene graph receive input events πŸ’… (this is from the SoHandleEventAction(3IV) manual page, just so we're clear about who we're stanning)


🌸 INHERITS FROM 🌸

SoAction > SoHandleEventAction

it's giving "child of SoAction, main character energy, but still respects the family tree" 🫢


πŸŽ€ SYNOPSIS πŸŽ€

#include <Inventor/actions/SoHandleEventAction.h>

Methods from class SoHandleEventAction:

                          SoHandleEventAction(const SbViewportRegion
                               &viewportRegion)
void                       setViewportRegion(const SbViewportRegion
                               &newRegion)
const SbViewportRegion &   getViewportRegion() const
void                       setEvent(const SoEvent *ev)
const SoEvent *            getEvent() const
void                       setHandled()
SbBool                     isHandled() const
void                       setGrabber(SoNode *node)
void                       releaseGrabber()
SoNode *                   getGrabber() const
void                       setPickRoot(SoNode *node)
SoNode *                   getPickRoot() const
void                       setPickRadius(float radiusInPixels)
const SoPickedPoint *      getPickedPoint()
const SoPickedPointList &  getPickedPointList()

Methods from class SoAction:

virtual void        apply(SoNode *node)
virtual void        apply(SoPath *path)
virtual void        apply(const SoPathList &pathList, SbBool obeysRules =
                     FALSE)
static SoType       getClassTypeId()
virtual SoType      getTypeId()
virtual SbBool      isOfType(SoType type)
virtual void        invalidateState()

πŸ¦‹ DESCRIPTION πŸ¦‹

so basically this class is THE plug πŸ”Œ β€” it lets nodes in a scene graph handle input events. it's usually invoked from a component derived from SoXtRenderArea when that component receives a window system event. periodt.

manipulator, dragger and selection nodes? they respond to and process events, they're the ones actually doing the work πŸ’… most other group nodes just pass the event along to their children (very "not my problem, go ask my kids"), while most other nodes simply ignore the action entirely. rude but valid πŸ™ˆ

once a node has indicated to the action that it has handled the event, traversal stops. that's it. done. no more scrolling. βœ‹

and here's the spicy part: a node that handles an event can also grab future events. once it's done that, ALL events get sent directly to that node, with no traversal taking place, until the node releases the grab. it's giving "I'm holding the aux cord and nobody else is touching it" πŸ”₯


πŸ’– METHODS πŸ’–

SoHandleEventAction(const SbViewportRegion &viewportRegion)

                          SoHandleEventAction(const SbViewportRegion
                               &viewportRegion)

constructor bestie πŸŽ€ it takes the viewport region to use; this is needed to perform a pick operation when requested. no region, no picking, that's the deal.


setViewportRegion(), getViewportRegion()

void                       setViewportRegion(const SbViewportRegion
                               &newRegion)
const SbViewportRegion &   getViewportRegion() const

sets / returns the current viewport region to use for the action. getter-setters, iconic, we love a matched pair 🫢


setEvent(), getEvent()

void                       setEvent(const SoEvent *ev)
const SoEvent *            getEvent() const

sets / returns the event being handled. literally just the event, in and out, no cap ✨


setHandled(), isHandled()

void                       setHandled()
SbBool                     isHandled() const

sets / returns whether any node has yet handled the event. the SbBool is the vibe check: has anyone claimed this yet or are we all just standing here 😭


setGrabber()

void                       setGrabber(SoNode *node)

initiates grabbing of future events πŸ”₯ all events will be sent to the given node until the grab is released. yep, ALL of them. the node is now the main character.


releaseGrabber()

void                       releaseGrabber()

releases the grab. handing the aux cord back, so generous of you πŸ’œ


getGrabber()

SoNode *                   getGrabber() const

returns the node that is currently grabbing events, or NULL if there is none. NULL = nobody's holding it, everybody's free, go wild 🌈


setPickRoot(), getPickRoot()

void                       setPickRoot(SoNode *node)
SoNode *                   getPickRoot() const

sets / returns the root node used for initiating a pick action for those nodes that want to know what is under the cursor. it's the "who's under the cursor" starting point, bestie πŸ‘‘


setPickRadius()

void                       setPickRadius(float radiusInPixels)

set the radius (in pixels) around the viewport-space point through which the ray passes when doing ray picking 🎯 ray picking is performed when getPickedPoint() is called. the pick radius set here is used when testing the ray against lines and points.


getPickedPoint()

const SoPickedPoint *      getPickedPoint()

returns the frontmost object hit (as an SoPickedPoint) by performing a pick based on the mouse location specified in the event for which the action is being applied. the first time this is called for a particular event, a SoRayPickAction is applied to find this object; subsequent calls for the same event return the same information. it caches, it's efficient, it ate πŸ’…

heads up fr fr: the storage for the picked point remains valid only as long as the action is not re-applied or deleted. don't go keeping that pointer around like it's gonna live forever 😭

getPickedPointList()

const SoPickedPointList &  getPickedPointList()

returns a list of objects intersected by a picking operation, sorted from nearest to farthest πŸ“‹ closest first, farthest last, organised queen behavior ⭐


πŸ‘‘ SEE ALSO πŸ‘‘

  • SoEvent
  • SoPickedPoint
  • SoRayPickAction

okay that's the whole page, we made it πŸŽ€ that footer stamp said SoHandleEventAction(3IV)() β€” that's the version tag at the bottom, and there's no date on it, so we're just gonna say this manual page is timeless, as it should be. go handle some events, bestie, you're gonna slay πŸ’–βœ¨πŸ¦‹πŸŒΈ