diff --git a/engine/src/core-plugins/com/jme3/asset/plugins/FileLocator.java b/engine/src/core-plugins/com/jme3/asset/plugins/FileLocator.java index f448fa361..3059fabe8 100644 --- a/engine/src/core-plugins/com/jme3/asset/plugins/FileLocator.java +++ b/engine/src/core-plugins/com/jme3/asset/plugins/FileLocator.java @@ -51,7 +51,7 @@ public class FileLocator implements AssetLocator { try { root = new File(rootPath).getCanonicalFile(); if (!root.isDirectory()){ - throw new IllegalArgumentException("Given root path \"" + root + "\" not a directory"); + throw new IllegalArgumentException("Given root path \"" + root + "\" is not a directory"); } } catch (IOException ex) { throw new AssetLoadException("Root path is invalid", ex); diff --git a/engine/src/ogre/com/jme3/scene/plugins/ogre/MeshLoader.java b/engine/src/ogre/com/jme3/scene/plugins/ogre/MeshLoader.java index fc8cc6b83..234f9df3a 100644 --- a/engine/src/ogre/com/jme3/scene/plugins/ogre/MeshLoader.java +++ b/engine/src/ogre/com/jme3/scene/plugins/ogre/MeshLoader.java @@ -101,6 +101,7 @@ public class MeshLoader extends DefaultHandler implements AssetLoader { private int vertCount; private boolean usesSharedVerts; private boolean usesBigIndices; + private boolean submeshNamesHack; // Global data private Mesh sharedMesh; private int meshIndex = 0; @@ -138,6 +139,7 @@ public class MeshLoader extends DefaultHandler implements AssetLoader { animData = null; actuallyHasWeights = false; + submeshNamesHack = false; indicesData = null; weightsFloatData = null; } @@ -649,10 +651,15 @@ public class MeshLoader extends DefaultHandler implements AssetLoader { } else if (qName.equals("boneassignments")) { startBoneAssigns(); } else if (qName.equals("submesh")) { - startSubMesh(attribs.getValue("material"), - attribs.getValue("usesharedvertices"), - attribs.getValue("use32bitindexes"), - attribs.getValue("operationtype")); + if (submeshNamesHack) { + // Hack for blender2ogre only + startSubmeshName(attribs.getValue("index"), attribs.getValue("name")); + } else { + startSubMesh(attribs.getValue("material"), + attribs.getValue("usesharedvertices"), + attribs.getValue("use32bitindexes"), + attribs.getValue("operationtype")); + } } else if (qName.equals("sharedgeometry")) { String count = attribs.getValue("vertexcount"); if (count == null) { @@ -668,6 +675,9 @@ public class MeshLoader extends DefaultHandler implements AssetLoader { startSkeleton(attribs.getValue("name")); } else if (qName.equals("submeshnames")) { // ok + // setting submeshNamesHack to true will make "submesh" tag be interpreted + // as a "submeshname" tag. + submeshNamesHack = true; } else if (qName.equals("submeshname")) { startSubmeshName(attribs.getValue("index"), attribs.getValue("name")); } else if (qName.equals("mesh")) { @@ -733,6 +743,9 @@ public class MeshLoader extends DefaultHandler implements AssetLoader { endLevelOfDetail(); } else if (qName.equals("boneassignments")) { endBoneAssigns(); + } else if (qName.equals("submeshnames")) { + // Restore default handling for "submesh" tag. + submeshNamesHack = false; } }