Miyagi: cursor problem with multiple viewports


26-12-2012 18:05:49

I have a single viewport with multiple GUIs on the main Mogre render window, and these GUIs behave like a single GUI that the user can interact with using mouse and keyboard.

I also have multiple render-to-texture objects in my 3D world, some of them displaying a Miyagi GUI.

The cursor is displayed on the main render window and not on the other viewports, as expected, because I want the cursor (for now) to work only on the main window and not interact with the controls displayed on my other 3D objects with a RTT texture.

Now my problem is that, while the cursor is indeed displayed only on the viewport displayed on the main render window, the cursor actually can interact with controls displayed on other GUIs which are being rendered onto different viewports.

I cannot find a way to deactivate mouse/keyboard actions on specific GUIs, that is, on the GUIs that are not rendered on the same viewport as the cursor.

Even worse, if for example I have one GUI rendered on the main viewport (main render window, with cursor) with 1 button, and another GUI rendered on another viewport, also with 1 button at the same coordinates as the first button, then whenever I move the cursor over the button on the main viewport and click on it, in reality the hovered and clicked button is the one rendered on the other viewport. Therefore I have a "ghost" behavior where controls rendered on non-main viewports are invisibly hiding the controls on the main viewport.

I have partially fixed this problem by forcing the ZOrder of GUIs rendered on non-main viewports to int.MinValue. This allows me to properly interact with controls on the main viewport, but I can still interact with controls on other viewports when these are not covered by controls on the main one.

The only fix I can think of is to draw an invisible layer on the non-main viewports with ZOrder = int.MinValue+1, so all non-main viewports would be effectively un-clickable but this seems like a very bad and dirty solution.

Is there a way to manually deactivate per-GUI or per-viewport mouse/keyboard inputs, or automatically disable inputs on all GUIs not rendered on the main viewport (where the cursor is rendered)?

MiyagiSystem.GUIManager.CheckCursorVisibility=true does not solve this problem.

Thank you!


26-12-2012 18:54:39

You can make a control invisible to the cursor by setting 'Control.HitTestVisible' to false.


26-12-2012 19:06:40

You can make a control invisible to the cursor by setting 'Control.HitTestVisible' to false.

That did the trick. Thank you very much.