Ugh… I haven’t been working on my own game for a while, as I have a networking issue that cropped up a bit ago and I really haven’t felt like dealing with it… until last night.
Long story short… I fired up the sever, launched the client and BEHOLD MY WONER!!! when I realize that Nifty is consuming events by default again! WOOOHOOOO!!! (This is sarcasm) So, right-click no longer works and half my game’s UI is f**ked seeing as it relies on this.
Anyone have a clue as to why this is happening? It worked fine as it was… and serious… having Nifty decide what events I want JME to see borderlines on stupidity.
Any chance this will get fixed?
A bit more info… All components in my UI have the following settings (I use a custom method of handing events as Nifty does not recognize many mouse events)
[java]someObj.setVisibleToMouse("false");[/java]
This no longer has any effect on wether or not Nifty handles the events. If the mouse is over a Nifty element, it now consumes them by default
I know there was some changes to Nifty recently to have events consumed by the first object handling them (to avoid duplicate events on the event bus). Maybe this is an unintended side effect of that? @void256 may know.
@zarch said:
I know there was some changes to Nifty recently to have events consumed by the first object handling them (to avoid duplicate events on the event bus). Maybe this is an unintended side effect of that? @void256 may know.
/sigh... I appreciate the info. This is extremely unfortunate, as it pretty much makes Nifty useless for anyone trying to implement advanced GUI interaction. I guess it's time to start looking into alternatives. This was implemented once before and there was no way around it while it was in place. I spent about a month tearing my hair out looking for one. The way I implemented handling of events Nifty was unaware of was already enough of a mess to begin with >.< Seriously... this one change pretty much trashed a good year+ development on the game I was working on (operative word being WAS).
Well don’t panic too much based on just my half remembering of something read in passing a few weeks ago
Yeah, no need to switch the GUI lib because of this… If it was fixed once it can be fixed again As stated in the blog post, a cleanup/checking of nifty is still due, we basically only updated the libraries in nightly.
Thanks… I’ll hold out hope! I have plenty of other things to work on in the meantime.
o_O Actually event processing should work a lot better now in Nifty 1.3.2!
I’ve even added a new “Event Consuming” example to the standard controls example demo which you can find here: http://nifty-gui.sourceforge.net/webstart/nifty-default-controls-examples-1.3.2.jnlp The processing works as expected in the demo, e.g. panels with visibleToMouse=“false” are ignored by Nifty and will not be processed by Nifty. Additionally the demo shows the new possibility how to tell Nifty to ignore events for individual elements while I’m still working on an updated 1.3.2 Nifty Manual.
Not sure what’s happening in your case
What you can eventually do in the meantime is to completely shut off Niftys event processing by calling new 1.3.2 methods on the Nifty instance:
[java]nifty.setIgnoreMouseEvents(true);
nifty.setIgnoreKeyboardEvents(true;)[/java]
With that set to true, Nifty will return “processed = false” for all events which in turn should make jme to forward all the events to your game.