Class SoNodeSensor
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 "final" task that is called when the object the data sensor is attached to is finalized. This task should not attempt to modify the object in any way. (see setFinalTask(Runnable)) 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:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.openinventor.inventor.sensors.SoDataSensor
SoDataSensor.ChangeTypes
Nested classes/interfaces inherited from class com.openinventor.inventor.Inventor
Inventor.ConstructorCommand
-
Field Summary
Fields inherited from class com.openinventor.inventor.Inventor
VERBOSE_LEVEL, ZeroHandle
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.SoNodeSensor
(Runnable task) Builds a new node sensor with the task to be executed when the sensor is triggered. -
Method Summary
Modifier and TypeMethodDescriptionvoid
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.Returns the node that this sensor is sensing, or NULL if it is not attached to any node.Methods inherited from class com.openinventor.inventor.sensors.SoDataSensor
getTriggerChild, getTriggerChildIndex, getTriggerFastEditInfo, getTriggerFastEditInfoFlag, getTriggerField, getTriggerMFieldNumValues, getTriggerMFieldStartIndex, getTriggerNode, getTriggerPath, getTriggerPathFlag, getTriggerType, setFinalTask, setTriggerFastEditInfoFlag, setTriggerPathFlag
Methods inherited from class com.openinventor.inventor.sensors.SoDelayQueueSensor
getDefaultPriority, getPriority, isIdleOnly, setPriority
Methods inherited from class com.openinventor.inventor.sensors.SoSensor
isScheduled, schedule, setTask, unschedule
Methods inherited from class com.openinventor.inventor.Inventor
dispose, getNativeResourceHandle
-
Constructor Details
-
SoNodeSensor
Builds a new node sensor with the task to be executed when the sensor is triggered. -
SoNodeSensor
public SoNodeSensor()Default constructor.
-
-
Method Details
-
detach
public void detach()Unschedules this sensor (if it is scheduled) and makes it ignore changes to the scene graph. -
getAttachedNode
Returns the node that this sensor is sensing, or NULL if it is not attached to any node. -
attach
Makes this sensor detect changes to the given node.
-