Helped the scene manager to depart from the scene. The viewer and editor

applications really need to deal directly with the scene repository. The
display part of the MISO code doesn't need a scene manager, per se,
because it is simply told to visualize a particular scene and scene
management happens entirely externally. This is in preparation for making
the MISO code work and place nicely with the Whirled code.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@246 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2001-08-15 00:00:52 +00:00
parent 3eea4dcaad
commit d26dc0372e
7 changed files with 49 additions and 101 deletions
@@ -1,5 +1,5 @@
//
// $Id: ViewerApp.java,v 1.3 2001/08/02 00:42:02 shaper Exp $
// $Id: ViewerApp.java,v 1.4 2001/08/15 00:00:51 mdb Exp $
package com.threerings.miso.viewer;
@@ -8,8 +8,9 @@ import java.io.IOException;
import com.samskivert.swing.util.SwingUtil;
import com.samskivert.util.Config;
import com.threerings.miso.Log;
import com.threerings.miso.scene.SceneManager;
import com.threerings.miso.scene.SceneRepository;
import com.threerings.miso.tile.TileManager;
import com.threerings.miso.util.MisoUtil;
import com.threerings.miso.viewer.util.ViewerContext;
@@ -33,7 +34,7 @@ public class ViewerApp
// create the handles on our various services
_config = createConfig();
_tilemgr = MisoUtil.createTileManager(_config, _frame);
_scenemgr = MisoUtil.createSceneManager(_config, _tilemgr);
_screpo = MisoUtil.createSceneRepository(_config, _tilemgr);
_ctx = new ViewerContextImpl();
// initialize the frame with the now-prepared context
@@ -63,8 +64,8 @@ public class ViewerApp
/**
* The implementation of the ViewerContext interface that provides
* handles to the config and manager objects that offer commonly
* used services.
* handles to the config and manager objects that offer commonly used
* services.
*/
protected class ViewerContextImpl implements ViewerContext
{
@@ -73,15 +74,15 @@ public class ViewerApp
return _config;
}
public SceneManager getSceneManager ()
{
return _scenemgr;
}
public TileManager getTileManager ()
{
return _tilemgr;
}
public SceneRepository getSceneRepository ()
{
return _screpo;
}
}
/**
@@ -108,8 +109,8 @@ public class ViewerApp
/** The config object. */
protected Config _config;
/** The scene manager object. */
protected SceneManager _scenemgr;
/** The scene repository. */
protected SceneRepository _screpo;
/** The tile manager object. */
protected TileManager _tilemgr;
@@ -1,5 +1,5 @@
//
// $Id: ViewerSceneViewPanel.java,v 1.7 2001/08/14 23:35:22 mdb Exp $
// $Id: ViewerSceneViewPanel.java,v 1.8 2001/08/15 00:00:51 mdb Exp $
package com.threerings.miso.viewer;
@@ -13,7 +13,7 @@ import com.threerings.media.sprite.*;
import com.threerings.miso.Log;
import com.threerings.miso.scene.*;
import com.threerings.miso.scene.xml.XMLFileSceneRepository;
import com.threerings.miso.scene.SceneRepository;
import com.threerings.miso.util.*;
import com.threerings.miso.viewer.util.ViewerContext;
@@ -49,9 +49,7 @@ public class ViewerSceneViewPanel extends SceneViewPanel
*/
protected void prepareStartingScene ()
{
// get the scene repository
XMLFileSceneRepository repo = (XMLFileSceneRepository)
_ctx.getSceneManager().getSceneRepository();
SceneRepository screpo = _ctx.getSceneRepository();
// get the starting scene filename
Config config = _ctx.getConfig();
@@ -59,7 +57,7 @@ public class ViewerSceneViewPanel extends SceneViewPanel
try {
// load and set up the scene
_view.setScene(repo.loadScene(fname));
_view.setScene(screpo.loadScene(fname));
} catch (IOException ioe) {
Log.warning("Exception loading scene [fname=" + fname +
", ioe=" + ioe + "].");
@@ -1,9 +1,11 @@
//
// $Id: ViewerContext.java,v 1.1 2001/07/25 17:38:15 shaper Exp $
// $Id: ViewerContext.java,v 1.2 2001/08/15 00:00:52 mdb Exp $
package com.threerings.miso.viewer.util;
import com.samskivert.util.Context;
import com.threerings.miso.scene.SceneRepository;
import com.threerings.miso.util.MisoContext;
/**
@@ -12,5 +14,8 @@ import com.threerings.miso.util.MisoContext;
*/
public interface ViewerContext extends MisoContext, Context
{
// nothing for now.
/**
* Returns the scene repository that we can use to get scenes.
*/
public SceneRepository getSceneRepository ();
}