Error when instantiating new chatbox

Hi I get this error when making a new chatbox:

java.lang.IllegalArgumentException: Material parameter is not defined: Clipping
at tonegod.gui.core.Element.setFontPages(Element.java:2300)
at tonegod.gui.core.Element.updateLocalClipping(Element.java:2275)
at tonegod.gui.core.Element.updateClipping(Element.java:2244)
at tonegod.gui.core.Element.updateNodeLocation(Element.java:951)
at tonegod.gui.core.Element.setY(Element.java:946)
at tonegod.gui.core.Element.addChild(Element.java:406)
at tonegod.gui.controls.extras.ChatBox.(ChatBox.java:154)
at tonegod.gui.controls.extras.ChatBox.(ChatBox.java:63)

@bgilb said: Hi I get this error when making a new chatbox:

java.lang.IllegalArgumentException: Material parameter is not defined: Clipping
at tonegod.gui.core.Element.setFontPages(Element.java:2300)
at tonegod.gui.core.Element.updateLocalClipping(Element.java:2275)
at tonegod.gui.core.Element.updateClipping(Element.java:2244)
at tonegod.gui.core.Element.updateNodeLocation(Element.java:951)
at tonegod.gui.core.Element.setY(Element.java:946)
at tonegod.gui.core.Element.addChild(Element.java:406)
at tonegod.gui.controls.extras.ChatBox.<init>(ChatBox.java:154)
at tonegod.gui.controls.extras.ChatBox.<init>(ChatBox.java:63)

Are you changing out the material?

Not that I know of.

I noticed that if I remove my custom theme it goes away. I’m not really doing anything special in the custom theme. I just copied the default one out of the tonegodgui jar and changed the font.

The weird thing is it works in my gui testing application which is just a simple application, but not my main game application. They have almost no difference, just where they instantiate the gui object that includes the screen with the custom style.

You have the jar referenced in the new project? Silly question probably… but since the Material is a replacement for Unshaded.j3md, it’s worth me asking just in case.

Yep. They’re the same project.

I am using Unshaded.j3md in my game. Could that cause any problems?

@bgilb said: Yep. They're the same project.

I am using Unshaded.j3md in my game. Could that cause any problems?

I do this quite often and have never seen this issue. Is this the entire stack trace? And can you post the part of the stack trace prior to the library calls with the code from and around the error lines. Should be able to tell you right away what the issue is from that.

Here is the full stack trace:
[java]
SEVERE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]
java.lang.IllegalArgumentException: Material parameter is not defined: Clipping
at com.jme3.material.Material.checkSetParam(Material.java:442)
at com.jme3.material.Material.setParam(Material.java:458)
at com.jme3.material.Material.setVector4(Material.java:645)
at tonegod.gui.core.Element.setFontPages(Element.java:2166)
at tonegod.gui.core.Element.updateLocalClipping(Element.java:2141)
at tonegod.gui.core.Element.updateClipping(Element.java:2110)
at tonegod.gui.core.Element.updateNodeLocation(Element.java:901)
at tonegod.gui.core.Element.setY(Element.java:896)
at tonegod.gui.core.Element.addChild(Element.java:366)
at tonegod.gui.controls.extras.ChatBox.(ChatBox.java:154)
at tonegod.gui.controls.extras.ChatBox.(ChatBox.java:48)
at mygame.gui.IngameGui$1.(IngameGui.java:55)
at mygame.gui.IngameGui.(IngameGui.java:55)
at mygame.main.Game.initialize(Game.java:194)
at com.jme3.app.state.AppStateManager.initializePending(AppStateManager.java:219)
at com.jme3.app.state.AppStateManager.update(AppStateManager.java:249)
at com.jme3.app.SimpleApplication.update(SimpleApplication.java:238)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(LwjglAbstractDisplay.java:151)
at com.jme3.system.lwjgl.LwjglDisplay.runLoop(LwjglDisplay.java:185)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:228)
at java.lang.Thread.run(Thread.java:722)

[/java]

Here is the relevant code. It errors right on the = new Chatbox line

[java]
screen = new Screen(sharedParts.app, “Interface/style/def/style_map.xml”);
sharedParts.app.getGuiNode().addControl(screen);

    chatBox = new ChatBox(screen, new Vector2f(0,Display.getHeight()-200)) {

        @Override
        public void onSendMsg(String msg) {
            ((TextField)chatBox.getChildElementById(chatBox.getUID() + ":ChatInput")).resetTabFocus();
            ((TextField)chatBox.getChildElementById(chatBox.getUID() + ":ChatInput")).update(0);
            
            String chatMsg = IngameGui.this.sharedParts.game.getMainPlayer().getAlias() + ": " + msg;
            
            chatBox.receiveMsg(IngameGui.this.sharedParts.game.getMainPlayer().getAlias() + ": " + msg);
            
            ChatMessage msg1 = new ChatMessage();
            msg1.message = chatMsg;
            IngameGui.this.sharedParts.game.getNetworkClient().addMessage(msg1);
            
        }
    };

[/java]

If I remove the screen style it works fine.

What does the line in style_map.xml say for the ChatBox control?

Actually, more specifically, does it point to a custom xml style def for ChatBox? And can you if so, can you post both the style_map.xml and the ChatBox.xml files?

It sure does. But so far I haven’t changed anything except the font and font size :S

I copied this the style from within the tonegodgui jar as a starting point.

[java]

<?xml version="1.0" encoding="UTF-8"?>

[/java]

[java]

<?xml version="1.0" encoding="UTF-8"?>

Line 21 looks a little off…

[java]
<property name=“contentPadding” type=“float” value=“6”></property>
[/java]

should be:

[java]
<property name=“contentPadding” type=“float” value=“6” />
[/java]

EDIT: Not sure if this fixes the issue… but the parser might be reading the file wrong /shrug.

Also, if you don’t have it… the latest build can be had here:

https://code.google.com/p/tonegodgui/downloads/list