Changes to Nifty for JME3? O.o

@void256 : :stuck_out_tongue: I don’t really know how to edit the wiki and I’m kind of bad at English …

My SF.net account :

atomixbomb



But I love to help and if you can point me a right way to make the control work , may be I can make a “quick and dirt” GUI Editor in JMP if the “offical” one in low progress…

The Exception you get seems to point to an element that is not correctly initialized (I think the screen membervariable might be null). The creation of elements/controls in Nifty 1.3 will now set this screen member variable. This is something new. Maybe there is something missing somewhere. Can you at least confirm that the screen member of the element is null? Maybe with the help of the debugger or something?



Please make sure that all of your controls have a elementId!



No idea whats the matter with your camera. Maybe all of the events are consumed by Nifty now. I’m not sure how Momoko_Fan is handling the events currently.



I’ve commited this to Nifty SVN now (this will prevent your first exception and is more friendly that way anyway :slight_smile: … thanks for posting that btw!



@public

make sure no one subscribes/unsubscribes elements with id null (because the EventBus will crash otherwise)

instead of crashing the following WARNING is being logged:

“WARNING [de.lessvoid.nifty.Nifty] trying to subscribe events for an element with elementId = null. this won’t work. offending class “class de.lessvoid.nifty.input.NiftyMouseClickedEvent” and offending subscriber “de.lessvoid.nifty.controls.button.ButtonControl$1@5e4b2b75”. try to find the offending element/control and give it an id!”

@atomix: "There is no user by the name “atomixbomb”. Check your spelling. " - the sf.net wiki complains. any typos or is this a new user? maybe it takes time that all hosted applications know you :slight_smile:



creating a custom control in Nifty 1.3 is not different from 1.2. the progressbar control should still work as is in 1.3. the chatarea example would be best updated by ractoc. I think he has a working 1.3 implementation of something similar already :slight_smile:



creating a control that confirms to the new Nifty 1.3 control API is not that hard. the main difference is that the control should now have it’s own dedicated Interface with the interface it wants to provide. you can find the source of the nifty-default-controls project at the sf.net project page.

Ok…



The lack of an id on 3 controls created via XML were creating both of the errors (on load and the crashes).



Here are the biggest problems I am still facing:


  1. All left-click mouse interaction is being stifled by Nifty. Right-click doesn’t seem to have the same issue, though it is now lagged significantly. It seems like the <layer> element is catching mouse interaction and not passing them to jme. I tried setting visibleToMouse=“false” with no luck :frowning:


  2. All textfield cursors are visible at all times. Not sure what has changed there. The way Focus is handled seems to have been changed or something?


  3. The scrollPanel control, used to have a method called … um… initializeScrollPanel?? or some such thing that you could call to update the scroll panel. This isn’t there anymore? The placement of the ScrollPanelControl elements, used to be relative (which allowed for proper resizing, they seem to be fixed now… um… i.e. when I resize the hooked “window” (not the Nifty control window) the scroll thumb is all the way to the left side of the screen, the textarea doesn’t resize, the textfield input doesn’t resize… however the scrolltrack does but only vertically… not the horizontal placement (I assume this is because the text area isn’t resizing the way it used to)… strange stuff.

It actually is much easier to set everything up, and the ListBox controls are definitely a huge improvement. I’ve encountered an odd problem though.



When developing controls, I use a blank project only showing the nifty components that I’m working on. I was able to convert my old code to Nifty 1.3 in these conditions rather easily. However, when I placed the modified code in my project (which previously had a 1.2 implementation), I encountered a problem with the button of my login screen. It does recognize the onClick, but the onClick invokes a function in my LoginScreencontroller class. When used in my project, it results in a large amount of warnings-- mostly something like:



[java]Feb 27, 2011 2:24:10 PM de.lessvoid.nifty.NiftyMethodInvoker callMethod

WARNING: Exception: java.lang.reflect.InvocationTargetException

Feb 27, 2011 2:53:40 PM de.lessvoid.nifty.NiftyMethodInvoker logException

WARNING: sun.reflect.NativeMethodAccessorImpl invoke0 (null:-2)[/java]



It appears that the interact is unable to invoke the function for some reason. As I said earlier though, it works when I test it alone. Aside from the fact that I’m including it in an actual project, the conditions are the same. I’m pretty baffled by this. Any insight in to what can cause this?

@void256: Yes , I’ve just make a user in SF.net :stuck_out_tongue:Atomixbomb or atomixbomb (i’m afraid it’s not very clear)

And I really not good at English anyway , so …



Now I really want to make a custom control like this “manipulate widget” which can manipulate GUI’s object by mouse (essential):







This is for the GUI editor thing …



And … is there a “zoom scene” function in the future plan…?

or is there something can make the zoom effect via Camera …?

@apok: Can you open a new thread for this please and post a bit more log? There has only been one change to the MethodInvoker and it is now using class.getMethods() instead of class.getDeclaredMethods() to only access public methods. This prevents issues in applets when there is no (default) access to private methods using reflections (requested by Momoko_Fan ^^). So maybe you’re trying to call a private method? Besides of that I have no idea. Maybe a bit more log helps to trace it down?



@atomix: Ok, I’ll check sf.net tommorow. There are no plans for a zoom function yet >_< a “manipulate widget” would be possible. keep me updated :slight_smile:



@t0neg0d:

  1. I’ve no idea. We’ll need Momoko_Fan for it.
  2. How can I reproduce this issue? It works for me in all examples!
  3. That’s odd. Again, can you send some code to reproduce please?

I think I just need to wait until the event consumption is taken care of before looking into this any further. The help you provided fixed many of the issues I was having attempting to convert over to the latest version. Unfortunately, I can’t test any further until the event issues is resolved. If you println the variable binding in the event handler you use for your main app (I say you… as in anyone using jme3), you’ll see that the mouse left button and spacebar no longer are sent through. most everything else seems to be passed along… including right-clicking, mouse-move left and right. Oh… the mouse wheel events are no longer seen either.



Could someone else verify that these events are being consumed? And if anyone knows how to stop this from happening (in case it is my implementation), please pass the fix along!

t0neg0d said:
(I say you... as in anyone using jme3)

..who uses the nightly version :P
normen said:
..who uses the nightly version :P


I do. Anyone who wants to use the new physics code or any of the other recent features does as well

I really cannot tolerate any complaints about the latest commits not working for everybody, theres warnings everywhere about using it and what a “nightly alpha” version means should be more than obvious…

O.o



The point of these “complaints” are to help track down bugs so the final release doesn’t go out with the same list of bugs that currently exist. As far as I remember, that is why software developer release “Alpha” and “Beta” versions. I would have thought that this aspect of “nightly alpha” version would be more obvious. /shrug



Hey! but thanks for cluttering an otherwise useful thread. (Pssst… the forum name is Troubleshooting - GUI… is it not?)

Exactly my point, I dont complain about constructive feedback, only about “wtf, my project is broken, why does this happen? I cannot work like this!”

I just thought I’d mention, there is no need for a separate thread for my issue. It turns out code elsewhere in the project (directly after the function was invoked by nifty) caused all of the warnings. The warnings led me to believe it was the control causing the problem, but it actually is working just fine. Sorry about that.

Just a head’s up here.



With the new Nifty xsd definition, previews stop working.



|nifty xmlns=“http://nifty-gui.sourceforge.net/nifty-1.3.xsd” xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance” xsi:schemaLocation=“http://nifty-gui.sourceforge.net/nifty-1.3.xsd http://nifty-gui.sourceforge.net/nifty-1.3.xsd”|

Previews should be working with working nifty xml files. Or do you mean the code completion?

If I keep the old nifty xsd definition, the preview window shows the GUI as it was. Code completion also works (as much as it “worked” before) with the 1.3 stuff.



But, if I use the new xsd definition (the above half-assed pasted definition ;)) it stops working. The thing here is that it’s not immediate. It seems jMP doesn’t retrieve the new definition as soon as it sees it, but after a while it will and it’s at that point that things will stop “working”.



Here’s what I got in a window I hadn’t seen before called “Retriever Output”:



Feb 27, 2011 9:11:39 PM : Retrieving Location: http://nifty-gui.sourceforge.net/nifty-1.3.xsd

Retrieved : http://nifty-gui.sourceforge.net/nifty-1.3.xsd
Saved at: C:UsersDanyjMonkeyProjectsSCnbprojectprivateretrievernifty-gui.sourceforge.netnifty-1.3.xsd


HTH

How exactly does the preview not work when you do that?

Gray screen.



If, by a lucky accident, it updates while you’re looking at the preview, which is exactly what happened here, the drawn part will remain on the preview screen. Resizing the preview window will add grey if you resize up. Even if you go back and forth between XML and Design view, the drawn part will remain there.



I noticed the change because I didn’t hear the “beep” I usually hear when switching to Design mode (that’s in my nifty screen definition).



If you switch nifty screen while in Design view you’ll get the grey screen.



It also might be a simple bug that I happened to hit as it updated while I was switching back and forth between Design and XML view… I’ve put the 1.3 XSD definition back on and it seems to be working fine now… scratch head

While I have you here would it be possible to fix the resourceBundle preview please?



If you have that tag (for locale) in your XML, the preview stays grey, I wouldn’t mind if it didn’t show the localized string but the ${tag}:



[java]<resourceBundle id=“dialog” filename=“com/madjack/games/sc/gui/nifty/dialog” />[/java]