* Fixed AssertionError in SceneLoader when loading multiple scenes

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7989 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
sha..rd 14 years ago
parent 984721cc75
commit c5aba505fc
  1. 17
      engine/src/ogre/com/jme3/scene/plugins/ogre/SceneLoader.java

@ -45,7 +45,6 @@ import com.jme3.math.Quaternion;
import com.jme3.math.Vector3f;
import com.jme3.scene.Node;
import com.jme3.scene.Spatial;
import com.jme3.system.JmeSystem;
import com.jme3.util.xml.SAXUtil;
import java.io.IOException;
import java.io.InputStreamReader;
@ -62,7 +61,6 @@ import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.DefaultHandler;
import org.xml.sax.helpers.XMLReaderFactory;
import static com.jme3.util.xml.SAXUtil.*;
public class SceneLoader extends DefaultHandler implements AssetLoader {
@ -92,6 +90,19 @@ public class SceneLoader extends DefaultHandler implements AssetLoader {
@Override
public void endDocument() {
}
private void reset(){
elementStack.clear();
nodeIdx = 0;
// NOTE: Setting some of those to null is only needed
// if the parsed file had an error e.g. startElement was called
// but not endElement
root = null;
node = null;
entityNode = null;
light = null;
}
private Quaternion parseQuat(Attributes attribs) throws SAXException{
if (attribs.getValue("x") != null){
@ -353,8 +364,10 @@ public class SceneLoader extends DefaultHandler implements AssetLoader {
assetManager.loadAsset(new OgreMaterialKey(sceneName+".material"));
} catch (AssetNotFoundException ex){
logger.log(Level.WARNING, "Cannot locate material file {0}", ex.getMessage());
materialList = null;
}
reset();
// Added by larynx 25.06.2011
// Android needs the namespace aware flag set to true

Loading…
Cancel
Save