"java.util.InputMismatchException" when trying to apply a previously created j3m

Heya!



I’m trying to apply a j3m to a model, but i get the following exception:



pre type="java"
java.util.InputMismatchException


at java.util.Scanner.throwFor(Scanner.java:840)


at java.util.Scanner.next(Scanner.java:1461)


at java.util.Scanner.nextFloat(Scanner.java:2319)


at com.jme3.material.plugins.J3MLoader.readRenderStateStatement(J3MLoader.java:337)


at com.jme3.material.plugins.J3MLoader.readAdditionalRenderState(J3MLoader.java:364)


at com.jme3.material.plugins.J3MLoader.loadFromScanner(J3MLoader.java:566)


at com.jme3.material.plugins.J3MLoader.load(J3MLoader.java:594)


at com.jme3.asset.DesktopAssetManager.loadAsset(DesktopAssetManager.java:240)


at com.jme3.asset.DesktopAssetManager.loadAsset(DesktopAssetManager.java:281)


at com.jme3.gde.materials.MaterialPropertyEditor$1.call(MaterialPropertyEditor.java:139)


at com.jme3.gde.materials.MaterialPropertyEditor$1.call(MaterialPropertyEditor.java:134)


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


Caused: java.util.concurrent.ExecutionException


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


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


at com.jme3.gde.core.scene.SceneApplication.update(SceneApplication.java:219)


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


at com.jme3.system.lwjgl.LwjglCanvas.runLoop(LwjglCanvas.java:199)


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


[catch] at java.lang.Thread.run(Thread.java:619)



/pre



(Let’s hope this snippet thing works correctly)



My j3m looks like this



[xml]Material MyMaterial : Common/MatDefs/Light/Lighting.j3md {

MaterialParameters {

DiffuseMap : Repeat Models/huisje9/huisje10.jpg

Specular : 0.0 0.0 0.0 1.0

Diffuse : 0.8 0.8 0.8 1.0

UseMaterialColors : true

Ambient : 0.8 0.8 0.8 1.0

Shininess : 100.0

NormalMap : Models/huisje9/huisje10_NRM.jpg

VTangent : true

HighQuality : true

LATC : true

UseAlpha : true

VertexLighting : true

Minnaert : true

UseVertexColor : true

EnvMapAsSphereMap : true

LowQuality : true

WardIso : false

}

AdditionalRenderState {

FaceCull Back

Wireframe Off

DepthWrite On

PolyOffset 0.0

AlphaTestFalloff 0.0

Blend Off

PointSprite Off

ColorWrite On

DepthTest On

}

} [/xml]



Any ideas what went wrong?

Ok, i hand edited my material (i compared it to a different material).



The working j3m looked like this



[xml]Material MyMaterial : Common/MatDefs/Light/Lighting.j3md {

MaterialParameters {

DiffuseMap : Models/WoodCrate_Blender/WoodCrate_lighter.png

SpecularMap : Models/WoodCrate_Blender/WoodCrate_lighter_HM.png

NormalMap : Models/WoodCrate_Blender/WoodCrate_lighter_NM.png

}

AdditionalRenderState {

}

}[/xml]



I hand edited my j3m to look like this.



[xml]Material MyMaterial : Common/MatDefs/Light/Lighting.j3md {

MaterialParameters {

DiffuseMap : Repeat Models/huisje9/huisje10.jpg

NormalMap : Repeat Models/huisje9/huisje10_NRM.jpg

}

AdditionalRenderState {

}

} [/xml]



Some of the information which was in the j3m i posted above probably did not belong in there (or was in the wrong order) which is possibly why i got the error.



Posting the solution here in case someone else runs across the same problem.

If you just use the j3m editor built into the SDK you don’t have to worry about malformed j3m files :slight_smile:

Yeah :slight_smile:



The weird thing is i only used the built-in editor in the jMP.

Huh? Guess @Momoko_Fan will have to tell us what changed in material parsing then -.-

I tried to load

[java]Material MyMaterial : Common/MatDefs/Light/Lighting.j3md {

MaterialParameters {

DiffuseMap : Repeat Models/huisje9/huisje10.jpg

NormalMap : Repeat Models/huisje9/huisje10_NRM.jpg

}

AdditionalRenderState {

}

}[/java]

And it worked fine. Am I missing something?

Try the long one

The long one fails because the PolyOffset render state takes two arguments: factor and units. If this material ever loaded before, then it was an error on the jME3’s part