MaterialLoader and Non-English Locales

Hi Momoko,



for non-english users the MaterialLoader doesnt work. Currently the Exception thrown of the scanner (Inputtype mismatch) isnt written to console and a message doesnt show up, too. The app is simply closed.



### Eclipse Workspace Patch 1.0
#P jme3
Index: src/com/g3d/scene/plugins/ogre/MaterialLoader.java
===================================================================
--- src/com/g3d/scene/plugins/ogre/MaterialLoader.java   (revision 4708)
+++ src/com/g3d/scene/plugins/ogre/MaterialLoader.java   (working copy)
@@ -15,6 +15,7 @@
 import com.g3d.util.BufferUtils;
 import java.io.IOException;
 import java.nio.ByteBuffer;
+import java.util.Locale;
 import java.util.Scanner;
 
 public class MaterialLoader implements AssetLoader {
@@ -243,6 +244,7 @@
         assetManager = info.getManager();
         OgreMaterialList list = new OgreMaterialList();
         scan = new Scanner(info.openStream());
+        scan.useLocale(Locale.ENGLISH);
         while (scan.hasNext("material")){
             String matName = readMaterial();
             Material mat = compileMaterial();



For the ogre elephant test, some materials are missing:


INFO Node 14:56:13 Child (elephant_lowres-geom-1) attached to this node (elephant_lowres-ogremesh)
WARNUNG MeshLoader 14:56:13 Material Ele_Tuskh not found. Applying default material
INFO Node 14:56:13 Child (elephant_lowres-geom-2) attached to this node (elephant_lowres-ogremesh)
WARNUNG MeshLoader 14:56:13 Material Ele_Tuskh not found. Applying default material
INFO Node 14:56:13 Child (elephant_lowres-geom-3) attached to this node (elephant_lowres-ogremesh)
WARNUNG MeshLoader 14:56:13 Material leftEyeShader not found. Applying default material
INFO Node 14:56:13 Child (elephant_lowres-geom-4) attached to this node (elephant_lowres-ogremesh)
WARNUNG MeshLoader 14:56:13 Material rightEyeShader not found. Applying default material



Regards,

snare

Dude, thx for that patch! Actually I thought for some reasons that the tests that got

this error were not ready…

Update from SVN. The latest revision had this problem fixed already, as you can see here:

http://code.google.com/p/jmonkeyengine/source/browse/branches/mf_jme3test/src/com/g3d/material/plugins/J3MLoader.java#439

Hey wow…my svn-address was aquite strange! Actually I wondered why there is nothing new on svn and you are working like crzy on jme3… cool! Now I'm uptodate again!



Keep on rocking and have a nice weekend…



ToM

Hi Momoko,



yes, J3MLoader has already the fix, but this "bug" is in MaterialLoader from Ogre as well. (No Test with Ogre Loading worked) (http://code.google.com/p/jmonkeyengine/source/browse/branches/mf_jme3test/src/com/g3d/scene/plugins/ogre/MaterialLoader.java#246)



Saw the screens in the other post, wow!



Thanks for your work.



Regards,



Snare



PS: Seems to be in OBJLoader, too:


### Eclipse Workspace Patch 1.0
#P jme3
Index: src/com/g3d/scene/plugins/OBJLoader.java
===================================================================
--- src/com/g3d/scene/plugins/OBJLoader.java   (revision 4708)
+++ src/com/g3d/scene/plugins/OBJLoader.java   (working copy)
@@ -14,6 +14,7 @@
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 import java.util.Scanner;
 import java.util.logging.Level;
@@ -253,6 +254,7 @@
     public Object load(AssetInfo info){
         InputStream in = info.openStream();
         scan = new Scanner(in);
+        scan.useLocale(Locale.ENGLISH);
         while (readLine());
         Mesh m = constructMesh();
         try{



*edit*: Added OBJLoader Patch