SOIDLESENSOR(3iv)

πŸ’– SoIdleSensor πŸ’–

okay bestie, welcome to the SoIdleSensor(3IV) page β€” yes that's the manual name, section IV, and we're gonna get into it together 🫢


✨ NAME ✨

SoIdleSensor β€” a sensor for one-time only callbacks when the application is idle πŸ’€βœ¨


🌸 INHERITS FROM 🌸

SoSensor > SoDelayQueueSensor > SoIdleSensor

yep, it's giving three generations of sensor ancestry, the whole family tree is iconic πŸ‘‘


πŸŽ€ SYNOPSIS πŸŽ€

#include <Inventor/sensors/SoIdleSensor.h>

Methods from class SoIdleSensor:

SoIdleSensor()
SoIdleSensor(SoSensorCB *func, void *data)
~SoIdleSensor()

Methods from class SoDelayQueueSensor:

void                setPriority(uint32_t pri)
uint32_t            getPriority()
static uint32_t     getDefaultPriority()
virtual void        schedule()
virtual void        unschedule()
virtual SbBool      isScheduled()

Methods from class SoSensor:

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

πŸ’… DESCRIPTION πŸ’…

So an idle sensor is almost exactly like an SoOneShotSensor… except bestie, there's a vibe check involved 😌. It only gets triggered when there are no timer queue sensors waiting to be triggered and there are no events waiting to be processed. Basically: only when everything is chill and idle. It's giving patient main character energy πŸ’€

Which means β€” and this is the important part β€” idle sensors will not be triggered if the delay queue is processed because the delay queue timeout expires. Like, that's not its moment, okay? πŸ™ˆ

But wait, plot twist 🌈: if the delay queue timeout is disabled (see SoDB::setDelaySensorTimeout().), then idle and one-shot sensors are exactly the same. no cap, literally identical fr fr.

⚠️ Note that idle sensors do not reschedule themselves. In Inventor 1, idle sensors were always scheduled. So if you want that old behavior back, call schedule() in the callback function β€” that's how you duplicate it πŸ’–

See the SoOneShotSensor manual page for more information πŸ‘€


🌟 METHODS 🌟

  • SoIdleSensor()
  • SoIdleSensor(SoSensorCB *func, void *data)

Creation methods ✨ The second method takes the callback function and data to be called when the sensor is triggered. so you hand it the function, you hand it the data, and it handles the rest 🫢

  • ~SoIdleSensor()

Destroys the sensor, freeing up any memory associated with it after unscheduling it πŸ’€βž‘οΈπŸ§Ή. it's the clean-exit queen, no memory leaks on her watch.


πŸ¦‹ SEE ALSO πŸ¦‹

SoOneShotSensor, SoDelayQueueSensor

go read those too, they're the supporting cast and they ate πŸ’…


and that's the whole page bestie!! this was SoIdleSensor(3IV) β€” source/version slot on the footer is just chillin' empty, date slot too, so like… timeless behavior honestly 😭✨ stay idle, stay iconic, mwah πŸ’–πŸŽ€πŸ¦‹