SOFIELDSENSOR(3iv)

πŸ’– SoFieldSensor πŸ’–

okay so bestie, you found the SoFieldSensor(3IV) page, and honestly? iconic. this is the sensor class that can be attached to Inventor fields, and we're gonna go through the whole thing together, no skipping, no skimming, periodt. grab a strawberry πŸ“ and let's go.


πŸ¦‹ INHERITS FROM πŸ¦‹

the family tree, the lineage, the bloodline:

SoSensor > SoDelayQueueSensor > SoDataSensor > SoFieldSensor

so yes, your girl inherits from SoSensor, which inherits from SoDelayQueueSensor, which inherits from SoDataSensor, which inherits from SoFieldSensor. it's giving noble ancestry πŸ’…


✨ SYNOPSIS ✨

first things first, the include. copy it exactly, don't be cute with it:

#include <Inventor/sensors/SoFieldSensor.h>

the methods from class SoFieldSensor πŸŽ€

                         SoFieldSensor()
                         SoFieldSensor(SoSensorCB *func, void *data)
                         ~SoFieldSensor()
     void                attach(SoField *field)
     void                detach()
     SoField *           getAttachedField() const

and the methods from class SoDataSensor 🌸

     void                setDeleteCallback(SoSensorCB *function, void *data)
     SoNode *            getTriggerNode() const
     SoField *           getTriggerField() const
     SoPath *            getTriggerPath() const
     void                setTriggerPathFlag(SbBool flag)
     SbBool              getTriggerPathFlag() const

plus the 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()

and finally the methods from class SoSensor ⭐

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

🌈 DESCRIPTION 🌈

so what is this thing, bestie? Field sensors detect changes to fields, and they call a callback function whenever the field changes. that's the whole vibe. the way that a field can be part of a node, an input of an engine, or a global field β€” literally any of those. you attach a sensor, you get told when stuff moves. it's giving main character energy, fr fr.


πŸ’… METHODS πŸ’…

okay now the good part. buckle up.

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

these are the creation methods, the origin story. the second one takes the callback function and the data that gets called when the sensor is triggered. so you hand it func and data and it knows what to do when the tea gets spilled. πŸ«–

  • ~SoFieldSensor()

the destructor. it destroys the sensor, and it frees up any memory associated with it after unscheduling it. so like, it cleans up after itself, which is honestly more than most of us can say 😭

  • void attach(SoField *field)
  • void detach()
  • SoField *getAttachedField() const

the trio, the friend group, the holy trinity of attachment:

  • the attach() method makes this sensor detect changes to the given field. you're basically saying "hey bestie, watch this one for me" πŸ‘€
  • the detach() method unschedules this sensor (if it is scheduled) and makes it ignore changes to the scene graph. it's the "we're not doing this anymore" of methods, no hard feelings.
  • the getAttachedField() method returns the field that this sensor is sensing, or NULL if it is not attached to any field. so if you forgot what you attached it to, this tells you. very "who did i text at 3am" energy.
ngl the NULL case matters: no attached field, no field returned, that's just how it is.

πŸ‘‘ SEE ALSO πŸ‘‘

go read these next, they're all in the same friend group:

  • SoNodeSensor
  • SoPathSensor
  • SoDataSensor

and that's the whole page, bestie!! πŸŽ€ no cap, you now know SoFieldSensor better than most people know themselves. this adorable lil' page signs off as SoFieldSensor(3IV)() β€” that's the source and the version stamp, right there at the bottom, and yes it's the same as the title because that's just the format, okay?? slay. bye!! πŸ’–βœ¨πŸ¦‹πŸŒΈπŸ’…πŸ«Ά