Re: [Flightgear-devel] Clickable 3D panel
Julian Foad wrote: > For those who were wondering why it seems intermittently broken, what > seems to be happening is the 2D panel hotspots are always active as > well, and they pick up the mouse clicks as well (or instead, if the 2D > hotspot area overlaps a 3D hotspot area). Are you sure? I thought this might be it too, and tried tracking it down. The 3D panels are loaded through the model code, and never get a chance to register themselves as the "current_panel" object in globals. Is there an invisible 2D panel loaded from somewhere else? FWIW, I still haven't been able to duplicate the rogue mouse click problem. If you're right, though, good catch. :) Andy -- Andrew J. RossNextBus Information Systems Senior Software Engineer Emeryville, CA [EMAIL PROTECTED] http://www.nextbus.com "Men go crazy in conflagrations. They only get better one by one." - Sting (misquoted) ___ Flightgear-devel mailing list [EMAIL PROTECTED] http://mail.flightgear.org/mailman/listinfo/flightgear-devel
Re: [Flightgear-devel] Clickable 3D panel
Andy Ross writes: > FWIW, I still haven't been able to duplicate the rogue mouse click > problem. Try this: fgfs --aircraft=c172p-3d Don't change the view direction or FOV. Click on the ident switch or the hi/low/off knob on the ADF and watch what happens. All the best, David -- David Megginson, [EMAIL PROTECTED], http://www.megginson.com/ ___ Flightgear-devel mailing list [EMAIL PROTECTED] http://mail.flightgear.org/mailman/listinfo/flightgear-devel
Re: [Flightgear-devel] Clickable 3D panel
Andy Ross wrote: Julian Foad wrote: > For those who were wondering why it seems intermittently broken, what > seems to be happening is the 2D panel hotspots are always active as > well, and they pick up the mouse clicks as well (or instead, if the 2D > hotspot area overlaps a 3D hotspot area). Are you sure? I thought this might be it too, and tried tracking it down. The 3D panels are loaded through the model code, and never get a chance to register themselves as the "current_panel" object in globals. Is there an invisible 2D panel loaded from somewhere else? FWIW, I still haven't been able to duplicate the rogue mouse click problem. Well, I'll put it this way: If I turn the 2D panel on and off with "P" while flying "--aircraft=c172-3d", and note where a particular button is, and then turn it off so that only the 3D panel is visible, I can still click where the 2D button was as well as where the 3D button is visible. Clicking in either place has the same result of activating the feature. As I said, if the position of one of these invisible 2D hot-spots obscures a 3D hot-spot, then the 3D one appears not to be working, until you change view direction a bit or zoom so it is in a different area of the screen. - Julian ___ Flightgear-devel mailing list [EMAIL PROTECTED] http://mail.flightgear.org/mailman/listinfo/flightgear-devel
Re: [Flightgear-devel] Clickable 3D panel
Julian Foad wrote: > Well, I'll put it this way: If I turn the 2D panel on and off with "P" > while flying "--aircraft=c172-3d", and note where a particular button > is, and then turn it off so that only the 3D panel is visible, I can > still click where the 2D button was as well as where the 3D button is > visible. Heh, hard to argue with that. Indeed, there was no check for panel visibility in the input code. I guess we've never noticed because nothing was fighting for the same real estate in the past. This one-liner appears to fix the problem. And, since you were right, good catch. :) Andy RCS file: /var/cvs/FlightGear-0.9/FlightGear/src/Input/input.cxx,v retrieving revision 1.4 diff -u -r1.4 input.cxx --- src/Input/input.cxx 29 Oct 2002 19:44:03 - 1.4 +++ src/Input/input.cxx 5 Nov 2002 01:38:23 - @@ -379,6 +379,7 @@ if (puMouse(b, updown, x, y)) return; else if ((current_panel != 0) && + current_panel->getVisibility() && current_panel->doMouseAction(b, updown, x, y)) return; else if (fgHandle3DPanelMouseEvent(b, updown, x, y)) ___ Flightgear-devel mailing list [EMAIL PROTECTED] http://mail.flightgear.org/mailman/listinfo/flightgear-devel
Re: [Flightgear-devel] Clickable 3D panel
Andy Ross writes: > Heh, hard to argue with that. Indeed, there was no check for panel > visibility in the input code. I guess we've never noticed because > nothing was fighting for the same real estate in the past. This > one-liner appears to fix the problem. Committed. All the best, David -- David Megginson, [EMAIL PROTECTED], http://www.megginson.com/ ___ Flightgear-devel mailing list [EMAIL PROTECTED] http://mail.flightgear.org/mailman/listinfo/flightgear-devel
Re: [Flightgear-devel] Clickable 3D panel
How hard would it be to have a property that toggles hotspot visibility? It'd be nice to be able to turn it on and have yellow rectangles show up on the hotspots...or something like that. Thinking about making hotspots to control some of the 3D instrumentation. Best, Jim Andy Ross <[EMAIL PROTECTED]> said: > Julian Foad wrote: > > Well, I'll put it this way: If I turn the 2D panel on and off with "P" > > while flying "--aircraft=c172-3d", and note where a particular button > > is, and then turn it off so that only the 3D panel is visible, I can > > still click where the 2D button was as well as where the 3D button is > > visible. > > Heh, hard to argue with that. Indeed, there was no check for panel > visibility in the input code. I guess we've never noticed because > nothing was fighting for the same real estate in the past. This > one-liner appears to fix the problem. > > And, since you were right, good catch. :) > > Andy > > RCS file: /var/cvs/FlightGear-0.9/FlightGear/src/Input/input.cxx,v > retrieving revision 1.4 > diff -u -r1.4 input.cxx > --- src/Input/input.cxx 29 Oct 2002 19:44:03 - 1.4 > +++ src/Input/input.cxx 5 Nov 2002 01:38:23 - > @@ -379,6 +379,7 @@ > if (puMouse(b, updown, x, y)) > return; > else if ((current_panel != 0) && > + current_panel->getVisibility() && >current_panel->doMouseAction(b, updown, x, y)) > return; > else if (fgHandle3DPanelMouseEvent(b, updown, x, y)) > > ___ Flightgear-devel mailing list [EMAIL PROTECTED] http://mail.flightgear.org/mailman/listinfo/flightgear-devel
Re: [Flightgear-devel] Clickable 3D panel
Jim Wilson wrote: > How hard would it be to have a property that toggles hotspot > visibility? It'd be nice to be able to turn it on and have yellow > rectangles show up on the hotspots...or something like that. Thinking > about making hotspots to control some of the 3D instrumentation. That's not a bad idea. It shouldn't be that hard, actually. Just draw a final layer around the hotspots with some OpenGL lines. The existing layer offset code would insure it gets drawn on top of the rest of the panel, and the matrix environment is already set up so you can draw 2D panel coordinates directly. Andy -- Andrew J. RossNextBus Information Systems Senior Software Engineer Emeryville, CA [EMAIL PROTECTED] http://www.nextbus.com "Men go crazy in conflagrations. They only get better one by one." - Sting (misquoted) ___ Flightgear-devel mailing list [EMAIL PROTECTED] http://mail.flightgear.org/mailman/listinfo/flightgear-devel
Re: [Flightgear-devel] Clickable 3D panel
I wrote: > Jim Wilson wrote: > > How hard would it be to have a property that toggles hotspot > > visibility? It'd be nice to be able to turn it on and have yellow > > rectangles show up on the hotspots... > > That's not a bad idea. It's actually an astoundingly good idea, and implementable over lunch to boot. :) Try the attached patch, which predicates the boxes on the /sim/panel-hotspots property. I mapped a toggle event on this to a spare joystick button, and had fun. :) Andy -- Andrew J. RossNextBus Information Systems Senior Software Engineer Emeryville, CA [EMAIL PROTECTED] http://www.nextbus.com "Men go crazy in conflagrations. They only get better one by one." - Sting (misquoted) Index: panel.hxx === RCS file: /var/cvs/FlightGear-0.9/FlightGear/src/Cockpit/panel.hxx,v retrieving revision 1.2 diff -u -r1.2 panel.hxx --- panel.hxx 29 Oct 2002 19:44:03 - 1.2 +++ panel.hxx 5 Nov 2002 21:38:59 - @@ -370,6 +370,7 @@ virtual ~FGPanelInstrument (); virtual void draw () = 0; + virtual void drawHotspots(); virtual void setPosition(int x, int y); virtual void setSize(int w, int h); Index: panel.cxx === RCS file: /var/cvs/FlightGear-0.9/FlightGear/src/Cockpit/panel.cxx,v retrieving revision 1.3 diff -u -r1.3 panel.cxx --- panel.cxx 29 Oct 2002 19:44:03 - 1.3 +++ panel.cxx 5 Nov 2002 21:38:59 - @@ -436,6 +436,21 @@ glPopMatrix(); } + // Draw yellow "hotspots" if directed to. This is a panel authoring + // feature; not intended to be high performance or to look good. + if(fgGetBool("/sim/panel-hotspots")) { +glPushAttrib(GL_ALL_ATTRIB_BITS); +glDisable(GL_DEPTH_TEST); +glDisable(GL_TEXTURE_2D); +glColor3f(1, 1, 0); + +for(int i=0; i<_instruments.size(); i++) + _instruments[i]->drawHotspots(); + +glPopAttrib(); + } + + // restore some original state glPopAttrib(); glPolygonOffset(0, 0); @@ -647,6 +662,25 @@ it++) { delete *it; *it = 0; + } +} + +void +FGPanelInstrument::drawHotspots() +{ + for(int i=0; i<_actions.size(); i++) { +FGPanelAction* a = _actions[i]; +float x1 = getXPos() + a->getX(); +float x2 = x1 + a->getWidth(); +float y1 = getYPos() + a->getY(); +float y2 = y1 + a->getHeight(); + +glBegin(GL_LINE_LOOP); +glVertex2f(x1, y1); +glVertex2f(x1, y2); +glVertex2f(x2, y2); +glVertex2f(x2, y1); +glEnd(); } }
RE: [Flightgear-devel] Clickable 3D panel
Andy, > Try the attached patch, which predicates the boxes on the > /sim/panel-hotspots property. I mapped a toggle event on this to a > spare joystick button, and had fun. :) Up until we'll have that pretty menu system soon ;-) would it be hard to bind a spare key to this by default? Sincerely, Michael -- Michael Basler, Jena, Germany [EMAIL PROTECTED] http://www.geocities.com/pmb.geo/ ___ Flightgear-devel mailing list [EMAIL PROTECTED] http://mail.flightgear.org/mailman/listinfo/flightgear-devel
Re: [Flightgear-devel] Clickable 3D panel
Michael Basler wrote: > Andy Ross wrote: > > Try the attached patch, which predicates the boxes on the > > /sim/panel-hotspots property. I mapped a toggle event on this to a > > spare joystick button, and had fun. :) > > Up until we'll have that pretty menu system soon ;-) would it be hard to > bind a spare key to this by default? The toggling bit was mostly a joke. :) This is really only useful to people designing and debugging panels, and they're not likely to decide to do that in the middle of a long flight. They'll start up fgfs with a --prop:/sim/panel-hotspots=1 on the command line, edit their panels, and do a "reset" to see their changes. Unless there are applications for this feature that I don't see, they'll never want to turn the feature on and off interactively. There are a limited number of keys available. IMHO, panel hotspots aren't important enough to a general user to justify getting a key assigned to them by default. As you said, a menu option would make a lot more sense. Andy -- Andrew J. RossNextBus Information Systems Senior Software Engineer Emeryville, CA [EMAIL PROTECTED] http://www.nextbus.com "Men go crazy in conflagrations. They only get better one by one." - Sting (misquoted) ___ Flightgear-devel mailing list [EMAIL PROTECTED] http://mail.flightgear.org/mailman/listinfo/flightgear-devel
Re: [Flightgear-devel] Clickable 3D panel
Andy Ross wrote: [about making the panel hot spots visible] Try the attached patch, which predicates the boxes on the /sim/panel-hotspots property. That is excellent! So simple, and in conjunction with David's recent zoom in/out/normal (+/-/=) bindings, it immediately makes clear what's going on with the hot spots, and shows up the existing mistakes. Everyone designing clickable instruments will benefit from this, so I think your patch should go into CVS permanently. I was just trying to sort some hot spots out by editing the numbers, when I remembered that you'd just sent this patch. What a powerful tool visualisation is! - Julian Index: panel.hxx === RCS file: /var/cvs/FlightGear-0.9/FlightGear/src/Cockpit/panel.hxx,v retrieving revision 1.2 diff -u -r1.2 panel.hxx --- panel.hxx 29 Oct 2002 19:44:03 - 1.2 +++ panel.hxx 5 Nov 2002 21:38:59 - @@ -370,6 +370,7 @@ virtual ~FGPanelInstrument (); virtual void draw () = 0; + virtual void drawHotspots(); virtual void setPosition(int x, int y); virtual void setSize(int w, int h); Index: panel.cxx === RCS file: /var/cvs/FlightGear-0.9/FlightGear/src/Cockpit/panel.cxx,v retrieving revision 1.3 diff -u -r1.3 panel.cxx --- panel.cxx 29 Oct 2002 19:44:03 - 1.3 +++ panel.cxx 5 Nov 2002 21:38:59 - @@ -436,6 +436,21 @@ glPopMatrix(); } + // Draw yellow "hotspots" if directed to. This is a panel authoring + // feature; not intended to be high performance or to look good. + if(fgGetBool("/sim/panel-hotspots")) { +glPushAttrib(GL_ALL_ATTRIB_BITS); +glDisable(GL_DEPTH_TEST); +glDisable(GL_TEXTURE_2D); +glColor3f(1, 1, 0); + +for(int i=0; i<_instruments.size(); i++) + _instruments[i]->drawHotspots(); + +glPopAttrib(); + } + + // restore some original state glPopAttrib(); glPolygonOffset(0, 0); @@ -647,6 +662,25 @@ it++) { delete *it; *it = 0; + } +} + +void +FGPanelInstrument::drawHotspots() +{ + for(int i=0; i<_actions.size(); i++) { +FGPanelAction* a = _actions[i]; +float x1 = getXPos() + a->getX(); +float x2 = x1 + a->getWidth(); +float y1 = getYPos() + a->getY(); +float y2 = y1 + a->getHeight(); + +glBegin(GL_LINE_LOOP); +glVertex2f(x1, y1); +glVertex2f(x1, y2); +glVertex2f(x2, y2); +glVertex2f(x2, y1); +glEnd(); } }
Re: [Flightgear-devel] Clickable 3D panel
Andy Ross writes: > I wrote: > > Jim Wilson wrote: > > > How hard would it be to have a property that toggles hotspot > > > visibility? It'd be nice to be able to turn it on and have yellow > > > rectangles show up on the hotspots... > > > > That's not a bad idea. > > It's actually an astoundingly good idea, and implementable over lunch > to boot. :) > > Try the attached patch, which predicates the boxes on the > /sim/panel-hotspots property. I mapped a toggle event on this to a > spare joystick button, and had fun. :) This is now in the CVS, and is bound to Ctrl-C temporarily (it will probably get washed out when the Great Reorg finally arrives). All the best, David -- David Megginson, [EMAIL PROTECTED], http://www.megginson.com/ ___ Flightgear-devel mailing list [EMAIL PROTECTED] http://mail.flightgear.org/mailman/listinfo/flightgear-devel