* Ogre3D models exported from blender2ogre / Blender 2.63 now work by avoiding submeshname DTD violation

* Small grammer fix in FileLocator exception

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9441 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
Sha..rd 13 years ago
parent 95fb3eabbd
commit 4ee09fa52e
  1. 2
      engine/src/core-plugins/com/jme3/asset/plugins/FileLocator.java
  2. 21
      engine/src/ogre/com/jme3/scene/plugins/ogre/MeshLoader.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);

@ -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;
}
}

Loading…
Cancel
Save