Open Inventor Release 2023.2.3
 
Loading...
Searching...
No Matches
SoNodeSensor Class Reference

Sensor class that can be attached to Open Inventor nodes. More...

#include <Inventor/sensors/SoNodeSensor.h>

+ Inheritance diagram for SoNodeSensor:

Public Member Functions

 SoNodeSensor ()
 Default constructor.
 
 SoNodeSensor (SoSensorCB *func, void *data)
 Constructor that takes the callback function and data to be called when the sensor is triggered.
 
virtual ~SoNodeSensor ()
 Destroys the sensor, freeing up any memory associated with it after unscheduling it.
 
void attach (SoNode *node)
 Makes this sensor detect changes to the given node.
 
void detach ()
 Unschedules this sensor (if it is scheduled) and makes it ignore changes to the scene graph.
 
SoNodegetAttachedNode () const
 Returns the node that this sensor is sensing, or NULL if it is not attached to any node.
 
- Public Member Functions inherited from SoDataSensor
 SoDataSensor ()
 Constructor.
 
 SoDataSensor (SoSensorCB *func, void *data)
 Constructor that takes standard callback function and data.
 
void setDeleteCallback (SoSensorCB *f, void *data=NULL)
 Sets a callback that will be called when the object the sensor is sensing is deleted.
 
SoNodegetTriggerNode () const
 If this is a priority 0 data sensor, returns the node that was modified that caused this sensor to trigger.
 
SoFieldgetTriggerField () const
 If this is a priority 0 data sensor, returns the field that was modified that caused this sensor to trigger.
 
SoPathgetTriggerPath () const
 If this is a priority 0 data sensor, returns a path to the node that caused this sensor to trigger.
 
void setTriggerPathFlag (SbBool flag)
 Sets the flag that indicates whether the trigger path (see getTriggerPath()) is available to callback methods.
 
void setTriggerFastEditInfoFlag (SbBool flag)
 Sets the flag that indicates whether the trigger path fastEdit info (see getTriggerFastEditInfo()) is available to callback methods.
 
SbBool getTriggerPathFlag () const
 Queries the flag that indicates whether the trigger path (see getTriggerPath()) is available to callbacks .
 
SbBool getTriggerFastEditInfoFlag () const
 Queries the flag that indicates whether the trigger path fastEdit info (see getTriggerFastEditInfo()) is available to callbacks .
 
ChangeType getTriggerType () const
 If this is a priority 0 data sensor, returns the type of change that occurred.
 
SoNodegetTriggerChild () const
 If this is a priority 0 data sensor, and a change to a group node's children caused this sensor to be triggered (getTriggerType returns GROUP_ADD_CHILD, GROUP_INSERT_CHILD, or GROUP_REPLACE_CHILD), returns the node that was added to the group, and NULL in all other cases.
 
int getTriggerChildIndex () const
 If this is a priority 0 data sensor, and a change to a group node's children caused this sensor to be triggered (getTriggerType returns GROUP_ADD_CHILD, GROUP_INSERT_CHILD, or GROUP_REPLACE_CHILD), returns the index of the node that was added or removed, and -1 in all other cases.
 
int getTriggerMFieldStartIndex () const
 If this is a priority 0 data sensor, and a change in the data values of a multiple field (e.g., SoMFVec3f) caused this sensor to be triggered, returns the first index of the range of the potentially changed values.
 
int getTriggerMFieldNumValues () const
 If this is a priority 0 data sensor, and a change in the data values of a multiple field (e.g., SoMFVec3f) caused this sensor to be triggered, returns the size of the range of the potentially changed values.
 
int getTriggerFastEditInfo () const
 Returns true if the triggered changes come from a field or node that was below a Separator with a fastEditPolicy field with a value different than OFF.
 
virtual void unschedule ()
 If this sensor is scheduled, removes it from the delay queue so that it will not be triggered.
 
- Public Member Functions inherited from SoDelayQueueSensor
 SoDelayQueueSensor ()
 Constructor.
 
 SoDelayQueueSensor (SoSensorCB *func, void *data)
 Constructor that takes standard callback and data.
 
void setPriority (uint32_t pri)
 Sets the priority of the sensor.
 
uint32_t getPriority () const
 Gets the priority of the sensor.
 
virtual void schedule ()
 If this sensor's priority is non-zero, adds this sensor to the list of delay queue sensors ready to be triggered.
 
virtual SbBool isIdleOnly () const
 
- Public Member Functions inherited from SoSensor
 SoSensor ()
 Constructor.
 
 SoSensor (SoSensorCB *f, void *d)
 Constructor that takes standard callback function and data.
 
void setFunction (SoSensorCB *f, void *userData)
 
void setFunction (SoSensorCB *f)
 Sets the callback function that is called when the sensor is triggered.
 
void setData (void *d)
 Sets the callback data passed to the callback function.
 
SoSensorCBgetFunction () const
 Returns the callback that will be called when the sensor is triggered.
 
void * getData () const
 Returns the user-supplied pointer that will be passed to the callback function.
 
virtual SbBool isScheduled () const
 Returns TRUE if this sensor has been scheduled and is waiting in a sensor queue to be triggered.
 

Additional Inherited Members

- Public Types inherited from SoDataSensor
enum  ChangeType {
  UNSPECIFIED ,
  GROUP_ADD_CHILD ,
  GROUP_INSERT_CHILD ,
  GROUP_REPLACE_CHILD ,
  GROUP_REMOVE_CHILD ,
  GROUP_REMOVE_ALL_CHILDREN ,
  FIELD_MULTIVALUE
}
 Change type. More...
 
- Static Public Member Functions inherited from SoDelayQueueSensor
static uint32_t getDefaultPriority ()
 Returns the default delay queue sensor priority, which is 100.
 

Detailed Description

Sensor class that can be attached to Open Inventor nodes.

Node sensors detect changes to nodes, calling a callback whenever any field of the node or, if the node is a group node, any children of the node change. The Open Inventor viewer classes, for example, attach a node sensor to the root of the application's scene graph in order to know when any part of the scene graph has been modified and a redraw is needed.

Node sensors provide methods that can be called in the callback to determine exactly which node or field caused the sensor to be triggered. However these methods only return valid information if the sensor priority was explicitly set to zero (default is 100). Depending on the type of attached node, there are multiple possible triggers and only some of the get trigger info methods will return useful information.

Priority zero sensors are triggered immediately after the change. Normal priority sensors are not triggered until the next time the "delay queue" is processed. Normally this happens when the viewer / renderArea is not rendering and there are no input events to be processed.

The node sensor will be triggered if its schedule() method is called. But the trigger node, trigger field, etc. queries will return null. Generally this method is only useful for "at some future time" sensors like SoIdleSensor or SoAlarmSensor.

Node sensors provide a delete callback that is called just before the object the data sensor is attached to is deleted. The callback should not attempt to modify the object in any way.

See SoDataSensor for general information and code example.

SEE ALSO

SoFieldSensor, SoPathSensor, SoDataSensor

Definition at line 99 of file SoNodeSensor.h.

Constructor & Destructor Documentation

◆ SoNodeSensor() [1/2]

SoNodeSensor::SoNodeSensor ( )

Default constructor.

◆ SoNodeSensor() [2/2]

SoNodeSensor::SoNodeSensor ( SoSensorCB func,
void *  data 
)

Constructor that takes the callback function and data to be called when the sensor is triggered.

◆ ~SoNodeSensor()

virtual SoNodeSensor::~SoNodeSensor ( )
virtual

Destroys the sensor, freeing up any memory associated with it after unscheduling it.

Member Function Documentation

◆ attach()

void SoNodeSensor::attach ( SoNode node)

Makes this sensor detect changes to the given node.

◆ detach()

void SoNodeSensor::detach ( )

Unschedules this sensor (if it is scheduled) and makes it ignore changes to the scene graph.

◆ getAttachedNode()

SoNode * SoNodeSensor::getAttachedNode ( ) const
inline

Returns the node that this sensor is sensing, or NULL if it is not attached to any node.

Definition at line 133 of file SoNodeSensor.h.


The documentation for this class was generated from the following file: