This new plugin allows you to handle the interaction events such as mouse and keyboard. By this plugin, you could also know the selected object.
Firstly, create a class deriving from InputPlugin. It is a kind of implicit plugin which has no interface. So the attribute DisplayName is useless.
// The InputPlugin example. [Plugin("MyInputPlugin", "ADSK")] public class InputPluginExample : InputPlugin { }
Next, override the events you want to use. The plugin provides various events. It is not difficult to know what they fire for from their names.
KeyDown
KeyDrag
KeyUp
ModifierKeyDown
ModifierKeyUp
MouseDown
MouseDrag
MouseLeave
MouseMove
MouseUp
WheelDrag
I’d introduce MouseDown and KeyDown. The last argument timeOffset is not clear to me. I will update this post when I figure it out.
public override bool MouseDown( //the current view when mouse down View view, //Enumerates key modifiers used in input: //None, Ctrl,Alt,Shift KeyModifiers modifiers, //left mouse button:1, //middle mouse button:2, //right mouse button:3 ushort button, //screen coordinate x int x, //screen coordinate y int y, // not clear to me :-( double timeOffset) public override bool KeyDown( //the current view when mouse down View view, //Enumerates key modifiers used in input: //None, Ctrl,Alt,Shift KeyModifiers modifier, //the key pressed ushort key, // not clear to me :-( double timeOffset)

Leave a Reply