Capture mouse events


#1

What dos the function Controller.captureMouseEvents()?
I would await, that the mouse events go then only to this script.
I have used it in this way:

if (event.text == “b”)
{ mode=radialMode;
Controller.captureMouseEvents();
}

But it doesn’t work.


#2

Capture*Events just routes the events to the script (MousePress, MouseRelease, etc.), but I do not think it is exclusive.


#3

Well this happens already with Controller.mouseMoveEvent.connect(mouseMoveEvent);
I haven’t found a script, which uses Controller.captureMouseEvents();
So if this function really would work exclusive for example as long as a key is pressed, it could end many collisions with other scripts. But sure, maybe new problems will come, if more scripts at the same time capture the event.


#4

The only thing is that currently, you can only have one script per object. So not quite sure in what case can a mouse click go through an object.


#5

Right now captureMouseEvents() basically prevents the keyboard/mouse input device from receiving mouse events. There’s a similar captureKeyEvents(), I believe. So, for example, if you capture mouse events, the mouse should no longer let you right click and drag to pitch and yaw, and if you capture key events, WASD/arrow keys should stop moving you (and might also stop menu items from being toggled). There’s also a captureActionEvents(), I think, and there are release****Events() methods that you should make sure to use so nothing gets broken.


#6

Well right now Controller.captureMouseEvents() seems to do nothing. All mouse events are active, when I use it (Mac build 2661)


#7

If you type “Controller.captureMouseEvents()” into the console, right click + drag should stop working until you releaseMouseEvents(). That being said, it’s completely possible that other aspects of some of the capture/release methods are broken. I will try to confirm that they behave as expected when I get the chance.