SOSENSOR(3iv)

✨ NAME ✨

SoSensor β€” the abstract base class for alllll the Inventor sensors πŸ’– (yes bestie, it's abstract, meaning you don't just go make one of these and vibe, it's the blueprint the other sensors inherit from 🫢)


🌸 INHERITS FROM

SoSensor

(no cap, that's the whole lineage β€” she's the top of the family tree πŸ‘‘)


πŸ’… SYNOPSIS πŸ’…

#include <Inventor/sensors/SoSensor.h>
typedef void        SoSensorCB(void *data, SoSensor *sensor)

Methods from class SoSensor:

void                setFunction(SoSensorCB *callbackFunction)
SoSensorCB *        getFunction() const
void                setData(void *callbackData)
void *              getData() const

πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so here's the whole vibe πŸŽ€ β€” sensors detect changes. Changes to time, or changes to Inventor objects in a scene graph. And when they catch one? They call a user-defined callback function. That's the entire point of their existence, slay πŸ’….

So the lifecycle goes like this: a sensor gets scheduled when the thing it's attached to changes, and then sometime after it's scheduled, it gets triggered β€” and that's when your callback function gets called. That's it, that's the tea β˜•. Scheduled β†’ triggered β†’ your function runs. Periodt.


🌈 METHODS 🌈

void setFunction(SoSensorCB *callbackFunction)

Sets the callback function that gets called when the sensor is triggered πŸ”₯. Important: that function must take two arguments β€”

  • the user-supplied callback data (of type void *), and
  • a pointer to the sensor that's triggering the function (of type SoSensor *).

Two args, no exceptions bestie 😭

SoSensorCB * getFunction() const

Hands you back the callback function that will be called when the sensor is triggered πŸ’–. Like, "who's on aux?" but for callbacks.

void setData(void *callbackData)

Sets the callback data that gets passed to the callback function 🫢. This is the stuff you want your function to know about when it fires.

void * getData() const

Returns that user-supplied pointer β€” the one that's gonna get passed to the callback function ✨. She gives it back exactly how you set it, iconic.


πŸ‘‘ SEE ALSO πŸ‘‘

The whole sensor friend group, go say hi:

  • SoAlarmSensor
  • SoDataSensor
  • SoFieldSensor
  • SoIdleSensor
  • SoNodeSensor
  • SoPathSensor
  • SoSensorManager

And that's the page, bestie 🫢 this was SoSensor(3IV) β€” the manual page tag reads SoSensor(3IV)() with the date slot left blank, so no timestamp tea today, she's mysterious like that πŸ’€βœ¨ go forth and schedule responsibly 🌸