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 ) |
Methods in detail¶
EventDispatcher ( in EventDispatcher other )
copy constructor
default constructor
EventDispatcher.activateManipulation! ()
Reactivate the manipulation, but do not modify the stack. This method should be called by the DCC to activate the currently pushed manipulator.
注釈
The active manipulator should manage hiding and showing its visible manipulation gizmos when it is deactivated/activated.
注釈
Calls into EventDispatcher.activateManipulation
String EventDispatcher.activeManipulator? ()
Returns the name of the currently active manipulator
EventDispatcher EventDispatcher.clone? ()
clone method
EventDispatcher.deactivateManipulation! ()
Temporarily deactivate the manipulation, but do not modify the stack. This method should be called by the DCC when the custom manipulator is disabled to suspend manipulation.
注釈
If a paint manipulator is active, but the user activates a different tool in Maya, then we simply deactivate the manipulation system, but leave the paint manipulator at the top of the stack. The Paint manipulator should then hide its paint brush.
Manipulator EventDispatcher.getManipulator? ( in String name )
Returns the manipulator registered under with the given name.
name | the name of the manipulator. |
Boolean EventDispatcher.hasManipulator? ( in String name )
Returns true if a manipulator with the given name has been registered.
name | the name of the manipulator. |
EventDispatcher.onEvent! ( io Event event )
Send the event to the manipulator
event | The event propagated from the DCC application. |
Boolean EventDispatcher.onEvent! ( io KeyEvent keyEvent )
Called by the Splice plugin in the Host DCC to propagate a KeyEvent to the currently active manipulator.
Boolean EventDispatcher.onEvent! ( io MouseEvent mouseEvent )
Called by the Splice plugin in the Host DCC to propagate a MouseEvent to the currently active manipulator.
Boolean EventDispatcher.onEvent! ( io MouseWheelEvent weelEvent )
Called by the Splice plugin in the Host DCC to propagate a MouseWheelEvent to the currently active manipulator.
EventDispatcher.popManipulator! ()
Pop the current manipulator off the stack. This reverts the active manipulator to the one that was active before the current one was active.
EventDispatcher.pushManipulator! ( in String name )
Push the manipulator onto the stack by name. This makes it the new active manipulator that will receive events.
EventDispatcher.registerManipulator! ( in Manipulator manipulator )
Registers a new manipulator with the EventDispatcher. The name used will be generated from the Manipulator type.
the | manipulator to register. |
EventDispatcher.registerManipulator! ( in String name, in Manipulator manipulator )
Registers a new manipulator with the EventDispatcher with a given name.
manipulator | The manipulator to register. |
name | The name to register the manipulator with. |
EventDispatcher.unregisterManipulator! ( in String name )
Unregisters an existing manipulator from the EventDispatcher.
The | name of the manipulator to unregister. |