I am still struggling with Lemur V1.11 so I decided to rewrite my current project. I have run into a problem, that I believe I have tracked down after spending some time in searching and analyzing.
I have found, that after attaching an AppState to my project lemurs MouseAppState is leading to a Nullpointer exception and thus crashing the code.
The error is produced here:
I have not completely understood why but what I can say is:
If the AppState is attached “rootEntry.root” somehow produces a GuiNode that is empty (has a lot of empty parameters) in that case
has no Worldbound and returns a null value that finally is crashing the code.
If the AppState is not attached we also find a GuiNode but somehow it has parameters e.g. Worldbound.
In lemur V1.10 this was no issue as the code differs at that point
this.trace("Creating GuiBucket ray.");
--> no getBounds() here
result = new Ray(new Vector3f(cursor.x, cursor.y, 1000.0F), new Vector3f(0.0F, 0.0F, -1.0F));
Could someone (maybe @pspeed) can try to reproduce the behaviour? Is it me or the code that is wrong?
This are the two classes I have used:
import com.jme3.app.SimpleApplication;
import com.jme3.system.AppSettings;
import com.simsilica.lemur.GuiGlobals;
public class Editor_Main extends SimpleApplication {
@Override
public void simpleInitApp() {
GuiGlobals.initialize(this);
// GuiGlobals globals = GuiGlobals.getInstance();
// globals.setCursorEventsEnabled(false);
// BaseStyles.loadGlassStyle();
// globals.getStyles().setDefaultStyle("glass");
}
@Override
public void simpleUpdate(float tpf) {
}
public Editor_Main(){
super(new Test_AppState());
}
public static void main(String[] args){
Editor_Main app = new Editor_Main();
app.start();
}
}
and the AppState is empty
import com.jme3.app.Application;
import com.jme3.app.state.BaseAppState;
public class Test_AppState extends BaseAppState {
@Override
protected void initialize(Application app) {
}
@Override
protected void cleanup(Application app) {
}
@Override
protected void onEnable() {
}
@Override
protected void onDisable() {
}
@Override
public void update(float tpf) {
}
}