SOTIMERSENSOR(3iv)
π SoTimerSensor β the sensor that just keeps going, and going, and going β¨
okay bestie, welcome to the SoTimerSensor page π she's a real one, she shows up on schedule, every time, no cap.
πΈ INHERITS FROM πΈ
SoSensor > SoTimerQueueSensor > SoTimerSensor
so like, she's the grandbaby of the whole sensor bloodline, and she inherited all the family drama (and all the family methods, which we're listing below, don't worry π«Ά).
β¨ SYNOPSIS β¨
#include <Inventor/sensors/SoTimerSensor.h>
Methods from class SoTimerSensor:
SoTimerSensor()
SoTimerSensor(SoSensorCB *func, void *data)
~SoTimerSensor()
void setBaseTime(const SbTime &base)
const SbTime &getBaseTime() const
void setInterval(const SbTime &interval)
const SbTime &getInterval() const
Methods from class SoTimerQueueSensor:
const SbTime &getTriggerTime()
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 π¦
okay so timer sensors trigger their callback function at regular intervals β° like, that's the whole vibe. for example, a timer might be set up to call its callback function every second on the second by setting the base time to SbTime(0.0) and the interval to SbTime(1.0). iconic behaviour honestly.
now here's the part where you gotta pay attention bestie π Timers are guaranteed to be triggered only once when the timer queue is processed. so if the application only processes the timer queue once every 5 seconds (because it's busy doing something else, we've all been there π) then the once-a-second sensor's callback will be called only once every 5 seconds. she's not gonna spam you, she respects your boundaries β
also note bestie:SoTimers always schedule themselves to be triggered the next even multiple of the interval time after the base time. so for example, if the once-a-second sensor is triggered at time2.9(because the application was busy doing something at time2.0and didn't get around to processing the sensor queue for a while) it will reschedule itself to go off at time3.0, not at time3.9. but if the base time was never set, the sensor would be scheduled for time3.9. the way that difference matters π
π METHODS π
SoTimerSensor()SoTimerSensor(SoSensorCB *func, void *data)
creation methods, bestie π the second method takes the callback function and data to be called when the sensor is triggered. that's it, that's the whole thing.
~SoTimerSensor()
destroys the sensor, freeing up any memory associated with it after unscheduling it. so she cleans up after herself, unlike some people π
void setBaseTime(const SbTime &base)const SbTime &getBaseTime() constvoid setInterval(const SbTime &interval)const SbTime &getInterval() const
sets/gets the base time and the interval β¨ now for the defaults, because everyone asks: the default base time is the time when the sensor is scheduled or rescheduled, and the default interval is 1/30th of a second. periodt π
π SEE ALSO π
SoOneShotSensor, SoAlarmSensor, SoTimerQueueSensor, SbTime
like, go read those too, they're all in the same friend group π«Ά
and that's the whole page bestie!! this was SoTimerSensor(3IV) β the (3IV) being the manual section vibe and all that β so yeah, that's the source/version energy right there ππ no cap, you're gonna slay with this sensor. go forth and schedule something iconic πβ¨
π¦ where this page comes from
- debian bookworm: inventor-doc 2.1.5-10+dfsg-2 Β· LGPL-2.0-or-later
- debian trixie: inventor-doc 2.1.6+ds-2 Β· LGPL-2.0-or-later
- ubuntu jammy: inventor-doc 2.1.5-10-24
- ubuntu noble: inventor-doc 2.1.5-10+dfsg-2.1build2 Β· LGPL-2.0-or-later
- ubuntu questing: inventor-doc 2.1.6+ds-2
- ubuntu resolute: inventor-doc 2.1.6.1+ds-1 Β· LGPL-2.0-or-later
- ubuntu stonking: inventor-doc 2.1.6.1+ds-1 Β· LGPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms