A bunch of intertwingled changes:
Refactored TileSet into TileSet, UniformTileSet, SwissArmyTileSet and ObjectTileSet. Removed dependence on the "root" system property from the XMLSceneRepository (things either pass in full paths now or input streams fetched via the resource manager). Removed MisoUtil.createImageManager() because everyone does that by hand now (which is good because some non-Miso things were using MisoUtil for that). I think that's it, but if there was something else, don't blame me. Blame the monkeys. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@608 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: XMLSceneParser.java,v 1.23 2001/10/25 16:36:43 shaper Exp $
|
||||
// $Id: XMLSceneParser.java,v 1.24 2001/11/08 03:04:44 mdb Exp $
|
||||
|
||||
package com.threerings.miso.scene.xml;
|
||||
|
||||
@@ -58,7 +58,7 @@ public class XMLSceneParser extends SimpleParser
|
||||
Log.warning(
|
||||
"Unrecognized scene file format version, will attempt " +
|
||||
"to continue parsing file but your mileage may vary " +
|
||||
"[fname=" + _fname + ", version=" + version +
|
||||
"[version=" + version +
|
||||
", known_version=" + XMLSceneVersion.VERSION + "].");
|
||||
}
|
||||
|
||||
@@ -268,14 +268,28 @@ public class XMLSceneParser extends SimpleParser
|
||||
* Parse the specified XML file and return a miso scene object with
|
||||
* the data contained therein.
|
||||
*
|
||||
* @param fname the file name.
|
||||
* @param path the full path to the scene description file.
|
||||
*
|
||||
* @return the scene object, or null if an error occurred.
|
||||
*/
|
||||
public EditableMisoScene loadScene (String fname) throws IOException
|
||||
public EditableMisoScene loadScene (String path) throws IOException
|
||||
{
|
||||
return loadScene(getInputStream(path));
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the specified XML file and return a miso scene object with
|
||||
* the data contained therein.
|
||||
*
|
||||
* @param stream the input stream from which the XML scene description
|
||||
* can be read.
|
||||
*
|
||||
* @return the scene object, or null if an error occurred.
|
||||
*/
|
||||
public EditableMisoScene loadScene (InputStream stream) throws IOException
|
||||
{
|
||||
_info = new SceneInfo();
|
||||
parseFile(fname);
|
||||
parseStream(stream);
|
||||
// place shadow tiles for any objects in the scene
|
||||
_info.scene.generateAllObjectShadows();
|
||||
// return the final scene object
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
//
|
||||
// $Id: XMLSceneRepository.java,v 1.13 2001/11/02 02:52:16 shaper Exp $
|
||||
// $Id: XMLSceneRepository.java,v 1.14 2001/11/08 03:04:44 mdb Exp $
|
||||
|
||||
package com.threerings.miso.scene.xml;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.samskivert.util.Config;
|
||||
@@ -48,27 +49,31 @@ public class XMLSceneRepository
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the path to the scene root directory.
|
||||
* Loads and returns a miso scene object for the scene described in
|
||||
* the specified XML file.
|
||||
*
|
||||
* @param path the full pathname to the file.
|
||||
*
|
||||
* @return the scene object.
|
||||
*/
|
||||
public String getScenePath ()
|
||||
public EditableMisoScene loadScene (String path) throws IOException
|
||||
{
|
||||
return _root + File.separator + _sceneRoot + File.separator;
|
||||
Log.info("Loading scene [path=" + path + "].");
|
||||
return _parser.loadScene(path);
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads and returns a miso scene object for the scene described in
|
||||
* the specified XML file. The filename should be relative to the
|
||||
* scene root directory.
|
||||
* the XML file available via the supplied input stream.
|
||||
*
|
||||
* @param path the full pathname to the file.
|
||||
*
|
||||
* @param fname the full pathname to the file.
|
||||
* @return the scene object.
|
||||
*/
|
||||
public EditableMisoScene loadScene (String fname) throws IOException
|
||||
public EditableMisoScene loadScene (InputStream stream)
|
||||
throws IOException
|
||||
{
|
||||
String path = getScenePath() + fname;
|
||||
Log.info("Loading scene [path=" + path + "].");
|
||||
|
||||
return _parser.loadScene(path);
|
||||
return _parser.loadScene(stream);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -77,13 +82,11 @@ public class XMLSceneRepository
|
||||
* the scene root directory.
|
||||
*
|
||||
* @param scene the scene to save.
|
||||
* @param fname the file to write the scene to.
|
||||
* @param path the full path of the file to write the scene to.
|
||||
*/
|
||||
public void saveScene (MisoScene scene, String fname) throws IOException
|
||||
public void saveScene (MisoScene scene, String path) throws IOException
|
||||
{
|
||||
String path = getScenePath() + fname;
|
||||
Log.info("Saving scene [path=" + path + "].");
|
||||
|
||||
_writer.saveScene(scene, path);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user