Observer system
The observation system is a simplified event mechanism that links a property state to one or more corresponding actions. These states and actions may not belong to the same entity.
Observation system
The observation system is available in MindDev version 2025.
Observation system
The observation system is not a global mechanism. Each node has its own observation system.
Principle
As with the custom attributes system, only certain node types are compatible with the observation system. As a general rule, any type outside the lists and a few specific types are compatible.
The observation system is divided into two sub-systems for each compatible node:
- The Source system
- The Target system
The two systems work with each other, and it is necessary to use both systems together for the mechanism to work.
When a Source event is activated, it activates all the targets to which it is linked. In both systems, an identifier (the name) is used to create the links between Source and Target.
Source system
The source system is used to send events. Each event is identified by its name. An event source has the following parameters:
- A name
- A trigger condition
- A trigger logic
The source event trigger checks the trigger condition at each frame and activates all the targets if the condition is met. This condition can be :
- A function (the function is a condition belonging to the parent object)
- A timecode (a time given by the parent time reference, i.e. the parent test if it exists, the parent experiment if it exists, or the protocol as a last resort).
Depending on the triggering logic, the event can be :
- Continuous (it is then restarted at each frame)
- Resettable (in this case, the condition must be invalidated once before it can be reactivated)
- Simple (In this case, it is executed once and only once)
Trigger function
Relatively few functions are available in older versions of MindDev 2025. New functions are added as updates are released.
Source event name
It is possible to assign the same name to several event sources. In this way, a target will register with all the identified sources.
The internal mechanism is as follows: When the protocol is executed, each target will check all the trigger conditions, and will execute all the target functions that registered with this Source when the protocol was launched.
The Target system
The target system receives events and executes a function belonging to the parent node. Each target has the following parameters:
- A Source event name to which it is linked
- A function to execute
- A function parameter if necessary
The internal mechanism is as follows: When the protocol is launched, each Target registers with all the sources whose name corresponds to the source event name parameter. The Targets are not updated in real time.
Event Target
It is possible for a target to be linked to several events of the same name, in order to execute a function when one or more Source events are executed.
General observation window
The organisation of Sources and Targets can become complex when the environment becomes more substantial. To enable a more global view of all events, MindDev has a global viewing and editing tool.
This global view tool allows you to:
- Modify all the Sources and Targets of a protocol.
- Select the parent object (if the protocol selected in the protocol tree matches).
- Refresh the window if a new source or target is created externally, or if the selected protocol is changed.