Changes to Nifty for JME3? O.o

Installed the latest jme3 updates and…



de.lessvoid.nifty.controls.dynamic.LabelCreator;

de.lessvoid.nifty.controls.scrollpanel.ScrollPanel;

de.lessvoid.nifty.controls.textfield.controller.TextFieldControl;



no longer exist? O.o



Um… what were they replaced with? And was there a reason they were not flagged as depreciated?



Or, was the latest update pushed out with issues and I just need to wait a day or so before this isn’t a problem anymore?

Or Ctrl-Shift-I in jMP :stuck_out_tongue:

Well… found what I “think” they have been replaced with… and it is looking like Nifty is going to change even more. It seems all Creators are being replaced with Builders?? and all methods starting with set are dropping the word “set”… and…



vent ON



Did I mention exactly how DIFFICULT it was to figure out Nifty in the first place, never mind all the code it took to make an interface that interacted the way I wanted it to (resizing, moving, capturing mouse interaction, etc, etc, etc)… an interface that could be creating via code, or created via XML and then hooked to function correctly!!!



And now, Nifty makes changes to package structure, class and method names with no noticeable benefit and without using depreciation.



AAAARRRRRGGGGGHHHHHHHH!!!HH!HH!!!11!1one



vent OFF



Ok… I guess I feel a little better. Hopefully it will at least work again soon and I can spend 6 weeks trying to figure it out yet again. At the moment all controls are either not showing, or so small that I think they are not showing. And I am just WAY too frustrated to even attempt to figure it out.



Any info would be appreciated

Oh yeah, we updated to nifty 1.3.

Its for the better :slight_smile:

Momoko_Fan said:
Oh yeah, we updated to nifty 1.3.
Its for the better :)
Don't you think there ought to be a changelog of sorts? i.e. similar to Normen's note on controls.

It is indeed for the better. Nifty 1.3 is a lot better.



My only gripe for now is the lack of basic docs on custom controllers (among other thing). Like the progress bar that is on void’s page that I slightly hacked to do what I wanted. Now that thing isn’t working at all. I will eventually find how to “fix” it, or rather making proper. I honestly think Nifty 1.3 should be named 2.0 since it’s totally different from the previous version and a phasing out of 1.2 should have accompanied it. Those wanting to switch could have done so.



But I have to agree with t0neg0d. With all this said, I think 1.2 should have been left there and 1.3 optionally offered while the docs and how-tos are posted/written. It might not have been possible to do so, but it would’ve been better imo.



In fact, at start up, I only get a blue screen with nothing else. Kinda funny. Kinda. :stuck_out_tongue:

Why for do they keep updating to SNAPSHOT versions?

Most of the changes in Nifty 1.3 Core are only adding features that should be backward compatible with 1.2. The XML syntax for instance and how Nifty works internally in general is still the same and should not cause any issues.



Some of thoses changes however are really interessting for JME. For instance it’s now possible to detect events like “mouse clicked on the GUI” and prevent them to be forwarded to your game. That’s why we’d like to make Nifty 1.3 available to you before it is officially released.



Besides the changes to Nifty Core the other, more involving part, was changing the Standard Controls of Nifty. Most of the controls have been rewritten from scratch and have been greatly enhanced and IMHO some of them are actually usable in Nifty 1.3 compared to what we had available before. These changes however are not backward compatible to Nifty 1.2. That’s true.



The main differences have been discussed on the Nifty blog and especially in this blog post Nifty 1.3 will not be 100% backward compatible with previous versions! (please read it completly) and the documentation in the (Nifty) wiki has been greatly enhanced. You can find the description how to use the improved controls on the Nifty Standard Controls (Nifty 1.3) page in the wiki.



The Builders do not replace the Creators at all. They are an additional way to create Nifty elements from Java but their use is not mandatory. You can still use the Creators (and infact the Builder use the Creators internally). The Creators have just been moved to different packages within the standard controls project.

Ahh awesome I love you guys! Especially that mouse clicked on GUI event will be extremely helpful.



I think I’ve fixed the majority of the problems with Nifty 1.3 but there’s still one warning that I don’t get:

WARNUNG: class [de.lessvoid.nifty.controls.textfield.inputmapping.TextFieldInputMapping] could not be instanziated (java.lang.ClassNotFoundException: de.lessvoid.nifty.controls.textfield.inputmapping.TextFieldInputMapping)
java.util.NoSuchElementException


What am I missing?

The TextFieldInputMapping class has been moved from “de.lessvoid.nifty.controls.textfield.inputmapping” to “de.lessvoid.nifty.controls.textfield”. I’m not sure where your error comes from because the new “textfield” control is using the correct position :slight_smile:



Maybe you’re using that class in your own custom control somwhere?

Oh my… Before it couldnt go fast enough to Nifty 1.3, now you complain, you are a funny lot xD

I am happy to have Nifty 1.3 here. :slight_smile:

For all those who have problems with new packages, there is: CTRL+SHIFT+O in Eclipse to manage your class imports… :wink:

Ok I found it. It is in nifty-console.xml . It still uses : inputMapping=“de.lessvoid.nifty.controls.textfield.inputmapping.TextFieldInputMapping”> .



And no I’m not complaining. I’m really happy that Nifty 1.3 is finally here.

void256 said:
The Builders do not replace the Creators at all. They are an additional way to create Nifty elements from Java but their use is not mandatory. You can still use the Creators (and infact the Builder use the Creators internally). The Creators have just been moved to different packages within the standard controls project.


If this is the case... where is the LabelCreator now? I can't seem to locate it anywhere.
<label is now <control name="label" which makes findElementByName obsolete when working with labels, which seems to (in turn) make TextRenderer for labels obsolete. For the life of me, I can't remember how to find a control that has been predefined XML, thus the frustration.

I see findControl and findNiftyControl... but each requires a String param of elementName??! The element name for a label control is LABEL... lol. How can you find a control by it's name??

I can muddle my way through the rest of it I am sure... but a hint as to how to update text in a label would go a far way towards helping me fix everything.

The difference between findControl and findNiftyControl is explained in the (Nifty) wiki http://sourceforge.net/apps/mediawiki/nifty-gui/index.php?title=Nifty_Standard_Controls_%28Nifty_1.3%29#General_Usage (You’ll need to scroll down because it is explained at the end of the page!)



The documentation for the new label control can also be found on in the (Nifty) wiki http://sourceforge.net/apps/mediawiki/nifty-gui/index.php?title=Standard_Controls_Label.



The elementName parameter should be better renamed to elementId tho. You access elements by the element id and that has not changed.



[java]Label label = screen.findNiftyControl(“the_id_i_gave_the_element_in_the_xml_or_from_java_when_i_created_it”, Label.class);

label.setText(“this_is_the_new_text_I_want_the_label_to_display”)[/java]



Is this really THAT hard? o_O



Edit: The Creator class for Labels now lives under “de.lessvoid.nifty.controls.label.builder.CreateLabelControl”. You might want to consider the Builder based class too because the API for creating elements with it is a bit nicer.

@Kaizo: the nifty-console has not been updated yet :confused: You can find an overview over the controls that are still under construction in the (Nifty) wiki too: http://sourceforge.net/apps/mediawiki/nifty-gui/index.php?title=Nifty_Standard_Controls_%28Nifty_1.3%29. The controls in red or with TODO in the Table are still being worked at.

@void256:



Sir , I’m following the Nifty GUI Tutorials in Nifty’s wiki and they’re totally “out-of-date” .:smiley:



I 've also tried to figure out how can do some thing with this great GUI lib but these two probs knock me out :


  1. Has Nifty Preview in JMP working properly yet?

    I 've tried to open some “HelloNifty.xml” it worked but for more complex “.xml” from the Nifty Example package (which have some Control and Style in it!!!) , it didn’t.


  2. The “ChatArea Example” in the Nifty Wiki need some update! Cause I just can’t find an “updated-way” to implement “a control” by myself anywhere T_T

Well,



I have at least gotten to the point where my client loads. BUT…



None of the mouse controls for my camera function anymore, and if I touch a component from the GUI the client instantly crashes >.<



Here is the stacktrace on screen load and then the stacktrace when I click on anything:



[java]

java.lang.IllegalArgumentException: Can’t subscribe to null.

at org.bushe.swing.event.ThreadSafeEventService.subscribe(ThreadSafeEventService.java:610)

at org.bushe.swing.event.ThreadSafeEventService.subscribeStrongly(ThreadSafeEventService.java:432)

at de.lessvoid.nifty.Nifty.subscribe(Nifty.java:177)

at de.lessvoid.nifty.controls.button.ButtonControl.bind(ButtonControl.java:45)

at de.lessvoid.nifty.controls.NiftyInputControl.bindControl(NiftyInputControl.java:117)

at de.lessvoid.nifty.elements.Element.bindControls(Element.java:1838)

at de.lessvoid.nifty.elements.Element.bindControls(Element.java:1842)

at de.lessvoid.nifty.elements.Element.bindControls(Element.java:1842)

at de.lessvoid.nifty.elements.Element.bindControls(Element.java:1842)

at de.lessvoid.nifty.screen.Screen.bindControls(Screen.java:711)

at de.lessvoid.nifty.screen.Screen.startScreen(Screen.java:177)

at de.lessvoid.nifty.Nifty.gotoScreenInternal(Nifty.java:525)

at de.lessvoid.nifty.Nifty.access$200(Nifty.java:62)

at de.lessvoid.nifty.Nifty$1.perform(Nifty.java:499)

at de.lessvoid.nifty.screen.Screen$EndScreenEndNotify.perform(Screen.java:571)

at de.lessvoid.nifty.screen.Screen$LocalEndNotify.perform(Screen.java:528)

at de.lessvoid.nifty.screen.Screen.startLayers(Screen.java:233)

at de.lessvoid.nifty.screen.Screen.endScreen(Screen.java:198)

at de.lessvoid.nifty.Nifty.gotoScreen(Nifty.java:496)

at mygame.Main$1cScreen.call(Main.java:1520)

at com.jme3.app.AppTask.invoke(AppTask.java:141)

at com.jme3.app.Application.update(Application.java:444)

at com.jme3.app.SimpleApplication.update(SimpleApplication.java:223)

at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(LwjglAbstractDisplay.java:146)

at com.jme3.system.lwjgl.LwjglDisplay.runLoop(LwjglDisplay.java:203)

at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:208)

at java.lang.Thread.run(Thread.java:619)

[/java]



And when the game crashes from trying to interact with any Nifty components:



[java]

SEVERE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]

java.lang.NullPointerException

at de.lessvoid.nifty.elements.Element.canHandleInteraction(Element.java:1471)

at de.lessvoid.nifty.elements.Element.onClick(Element.java:1452)

at de.lessvoid.nifty.elements.Element.mouseEvent(Element.java:1374)

at de.lessvoid.nifty.screen.MouseOverHandler.processMouseEvent(MouseOverHandler.java:93)

at de.lessvoid.nifty.screen.Screen.forwardMouseEventToLayers(Screen.java:315)

at de.lessvoid.nifty.screen.Screen.mouseEvent(Screen.java:291)

at de.lessvoid.nifty.Nifty$NiftyInputConsumerImpl.processMouseEvent(Nifty.java:1163)

at com.jme3.niftygui.InputSystemJme.onMouseButtonEventQueued(InputSystemJme.java:114)

at com.jme3.niftygui.InputSystemJme.forwardEvents(InputSystemJme.java:156)

at de.lessvoid.nifty.Nifty.update(Nifty.java:191)

at com.jme3.niftygui.InputSystemJme.endInput(InputSystemJme.java:88)

at com.jme3.input.InputManager.processQueue(InputManager.java:551)

at com.jme3.input.InputManager.update(InputManager.java:600)

at com.jme3.app.Application.update(Application.java:453)

at com.jme3.app.SimpleApplication.update(SimpleApplication.java:223)

at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(LwjglAbstractDisplay.java:146)

at com.jme3.system.lwjgl.LwjglDisplay.runLoop(LwjglDisplay.java:203)

at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:208)

at java.lang.Thread.run(Thread.java:619)

[/java]



Totally clueless now. Even trying to set an element to visible crashes the client. /sigh

@atomix: Please send me your sf.net username so that I can enable edit rights for the Nifty wiki for you! You are more then welcome to help to bring everything up to date …



@t0neg0d: The first exception will be fixed in Nifty SVN. As a workaround you should give the control that causes the problem an id. For the second exception I don’t have an idea tho. Can you localize the element that causes the problem? How was this element created? From XML or from Java?

void256 said:
@t0neg0d: The first exception will be fixed in Nifty SVN. As a workaround you should give the control that causes the problem an id. For the second exception I don't have an idea tho. Can you localize the element that causes the problem? How was this element created? From XML or from Java?


Unfortunately, it is ALL controls and elements. I have a mixture of controls created from XML and code, both have the same results.

I can't figure out why just setting an element to visible would crash the client.

Oh, and as for the mouse not controlling the camera anymore? Any ideas? Zoom, rotate, notta. :(