inventor.Sensor
class Sensor(object)
Represents node, field, timer and alarm sensors. Sensors can be used to observe changes in scene graphs or to trigger actions at given times.Methods defined here:
attach(...)
Attaches sensor/callback to node or field. The callback is triggered when the attached node or field changes. If only a Node instance is given then the sensor triggers on any change of that node or children. If both a scene object instance and a field or callback name are passed, the sensor triggers on field changes only. For Selection nodes the names 'selection', 'deselection', 'start' 'finish' are also accepted to register the corresponding callbacks.Args:
- node: Scene object instance to attach to.
- name: Optional field name (or callback for Selection node).
- func: The callback function can also be passed as argument instead of assigning the callback property.
detach(...)
Deactivates a sensor.is_scheduled(...)
Returns scheduled state of the sensor.Returns:
-
True is sensor is currently scheduled, otherwise False.
schedule(...)
Schedules a timer sensor.set_interval(...)
Sets up a timer sensor with a regular interval.Args:
-
Timer interval in milliseconds.
set_time(...)
Sets up an alarm sensor that is trigegred at a given time from now.Args:
-
Timer from now in milliseconds when the sensor will be triggered.
unschedule(...)
Unschedules a timer sensor.Data descriptors defined here:
callback
Sensor callback function.An object can be assigned to that property which is called when a sensor is triggered.