EventDispatcher.kl¶
Types¶
EventDispatcher (object)¶
バージョン 1.12.0 で追加.
The EventDispatcher manages a set of manipulators and dispatching events to the currently active manipulator. Custom manipulators can be defined supporting the Manipulator interface. These custom manipulator objects can be registered with the EventDispatcher and then pushed onto the manipulator stack to become activated. The active manipulator then receives KeyEvent, MouseEvent and MouseWheelEvent events as they are propagated from the host application.
Example¶
A custom Manipulator can be defined that handles mouse events. Manipulators are free to interpret mouse events in any way they require.
/* ** Example: EventLogger */ // Define a custom manipulator that simply reports events. object EventLogger : Manipulator { }; function EventLogger.onEvent!(io Event event){ report("EventLogger.onEvent:" + event); } function EventLogger.onEnable!(){ report("EventLogger.onEnable"); } function EventLogger.onDisable!(){ report("EventLogger.onDisable" ); }
This custom manipulator can now be created and registered with the EventDispatcher.
/* ** Example: EventLoggerRegistration */ EventDispatcher dispatcher = EventDispatcher_GetInstance(); Manipulator manipulator = EventLogger(); // Register and Activate the EventLogger so that it starts receiving // events from the DCC (Maya, Softimage or 3dsmax). dispatcher.registerManipulator('EventLogger', manipulator); // Push the manipulator so that it is the currently active manipulator. eventDispatcher.pushManipulator('EventLogger');
Members¶
Manipulator[String] | manipulators | The library of registered manipulators. |
Manipulator[] | stack | The stack of active manipulators. The last manpulator in the array is the currently active manipulator. |
Boolean | active |
Methods¶
EventDispatcher ( in EventDispatcher other ) | |
EventDispatcher () | |
activateManipulation ! () | |
String | activeManipulator ? () |
EventDispatcher | clone ? () |
deactivateManipulation ! () | |
Manipulator | getManipulator ? ( in String name ) |
Boolean | hasManipulator ? ( in String name ) |
onEvent ! ( io Event event ) | |
Boolean | onEvent ! ( io KeyEvent keyEvent ) |
Boolean | onEvent ! ( io MouseEvent mouseEvent ) |
Boolean | onEvent ! ( io MouseWheelEvent weelEvent ) |
popManipulator ! () | |
pushManipulator ! ( in String name ) | |
registerManipulator ! ( in Manipulator manipulator ) | |
registerManipulator ! ( in String name, in Manipulator manipulator ) | |
unregisterManipulator ! ( in String name ) |
Functions¶
EventDispatcher_GetInstance¶
EventDispatcher EventDispatcher_GetInstance ()
Get the EventDispatcher singleton, or construct it if it didn’t already exist.