onRightMouseUp is not functioning (the way I want) - NOT A BUG
by Richard Ranft · in Torque 3D Professional · 01/17/2011 (3:19 pm) · 6 replies
Torque 3D 1.1 b3
This code is appended to playGui.cs.
The console receives echo for onMouseDown, onMouseUp, onRightMouseDown but not onRightMouseUp.
For the record I browsed through guiMouseEventCtrl.h/cpp, guiControl.h/cpp and guiCanvas.h/cpp, but everything appears to be in order there so I'm not sure where the issue lies. Could be Operator Head Space....
Anyway, the idea is to put the mouse into mouse-look while the right button is held and to let the camera go back to fixed mode when the right button is released to facilitate issuing movement commands via left-click.
Clarification - Mouse behavior like Dragon Age: Origins, that's what I'm thinking here.
function PlayGui::onRightMouseDown(%this, %val)
{
echo("onRightMouseDown");
if(%val)
{
hideCursor();
}
}
function PlayGui::onRightMouseUp(%this, %val)
{
echo("onRightMouseUp");
if(%val)
{
showCursor();
}
}
function PlayGui::onMouseDown(%this, %val)
{
echo("onMouseDown");
}
function PlayGui::onMouseUp(%this, %val)
{
echo("onMouseUp");
}This code is appended to playGui.cs.
The console receives echo for onMouseDown, onMouseUp, onRightMouseDown but not onRightMouseUp.
For the record I browsed through guiMouseEventCtrl.h/cpp, guiControl.h/cpp and guiCanvas.h/cpp, but everything appears to be in order there so I'm not sure where the issue lies. Could be Operator Head Space....
Anyway, the idea is to put the mouse into mouse-look while the right button is held and to let the camera go back to fixed mode when the right button is released to facilitate issuing movement commands via left-click.
Clarification - Mouse behavior like Dragon Age: Origins, that's what I'm thinking here.
About the author
I was a soldier, then a computer technician, an electrician, a technical writer, game programmer, and now software test/tools developer. I've been a hobbyist programmer since the age of 13.
#2
The other problem you'll see is the right mouse up will be ignored from the action map because it will see a mouse up event w/o a matching mouse down event...
01/22/2011 (11:38 pm)
I've tried implementing this...and gave up to work on other features...The other problem you'll see is the right mouse up will be ignored from the action map because it will see a mouse up event w/o a matching mouse down event...
#3
Thanks guys! And if anyone at GG is watching, maybe think about changing that behavior. This and a few other scenarios are examples of checking for every input option even if they're usually not used....
01/23/2011 (9:38 am)
Ok, that actually is good - I also stopped after a cursory examination of the problem but your input gives me a few places to look. Perhaps I'll see if I can't change that behavior directly in the GUI code - drop that 'if' or change the way it handles it.Thanks guys! And if anyone at GG is watching, maybe think about changing that behavior. This and a few other scenarios are examples of checking for every input option even if they're usually not used....
#4
Anyway, still chasing it part-time - working on other stuff at the same time to keep from getting too frustrated... lol.
01/28/2011 (12:54 pm)
EditTSCtrl::onRightMouseDown() is entirely different from EditTSCtrl::onMouseDown() in editTSCtrl.cpp. I think this might be to catch the right mouse for the editor. Basically, I'm wanting the right mouse button to work like it does in the editor, really.Anyway, still chasing it part-time - working on other stuff at the same time to keep from getting too frustrated... lol.
#5
Right now it seems that "that's the way it is". I'm tempted to dig around in the source code to change it but I just don't have the time. As a simple hack, I've done the following...
It doesn't quite provide all of the functionality in that it doesn't provide the clicked vectors but those can be grabbed in the event. I just needed mine for a context menu option.
01/28/2011 (1:11 pm)
I've run into the same problem. Take a look at the discussion on this thread: www.garagegames.com/community/forums/viewthread/111587Right now it seems that "that's the way it is". I'm tempted to dig around in the source code to change it but I just don't have the time. As a simple hack, I've done the following...
$GUI::RClickTimerID = 0;
function toggleFreeLook( %val )
{
if ( %val ) {
$mvFreeLook = true;
hideCursor();
$GUI::RClickTimerID = startPrecisionTimer();
}
else {
$mvFreeLook = false;
showCursor();
%elapsed = stopPrecisionTimer($GUI::RClickTimerID);
if (%elapsed <250)
{
// consider this a right-click
echo("RClick time elapesed " @ %elapsed);
PlayGui.onRightMouseClick();
}
$GUI::RClickTimerID = 0;
}
}
GlobalActionMap.bind( mouse, button1, toggleFreeLook );It doesn't quite provide all of the functionality in that it doesn't provide the clicked vectors but those can be grabbed in the event. I just needed mine for a context menu option.
#6
01/28/2011 (1:54 pm)
Well, heck - if that works for a context menu then it'll be good for another idea I was going to play with. Thanks!
Torque 3D Owner David Draheim
Only when you display the cursor should mouse events normally flow to the PlayGui here. (rest still flow to the Action Map).
There is a big if statement early on input model that redirect mouse events depending on this. I would have said Right Mouse button was working correctly following the code.
I've never tried the mouse up like this, so perhaps identify where the code is allowing exception of MouseUp to still propagate tot he Active PlayGui.
But I'm with you, be nice if the Up event would occur in the Gui. It would be ok even if the Action Map caught this events, but from what I seen the Action Map throws away RightMouse Up event if the down didn't occur originally in the ActionMap. Perhaps in the same place its discarding this up event is also where if decides to push the MouseUp event (working above) to the Gui.
Sorry no solution, tis the wrong day for me to chase code.