e6796b2d55
- Reworked colorization repository such that we now have arbitrary named "colorization classes" which can be used by various and sundry entities to colorize themselves. - Added support for individual object colorizations as well as "spots" that go along with objects (will be used to automatically create portals into buildings and automatically position users properly when at a "station"). - Repackaged things in miso to more closely mimic what we do everywhere else (no more miso.scene, now we have miso.data and miso.client). - Fixed up miso scene XML representation so that objects can more easily be expanded to have yet more stuff if we think of more stuff that they might aught to have in the future. Structured the miso scene model so that "uninteresting" objects (those that simply sit somewhere and don't do anything) take up a lot less memory than "interesting" objects (those that have action strings, "spots", colorizations and the works). I may want to roll colorizations into the "uninteresting" realm, but that remains to be seen. - Made it possible for object tilesets to specify default render priorities for objects in that tileset. This will hopefully allow us to get by without any "custom" render priorities that are specified on scene objects, instead relying on the default priorities to resolve common conflicts. There are surely other cleanups in there, but I think that was the major thrust of it. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2228 542714f4-19e9-0310-aa3c-eee0fc999fb1
145 lines
3.4 KiB
Java
145 lines
3.4 KiB
Java
//
|
|
// $Id: EditableSceneImpl.java,v 1.7 2003/01/31 23:10:46 mdb Exp $
|
|
|
|
package com.threerings.whirled.tools;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import com.threerings.crowd.data.PlaceConfig;
|
|
import com.threerings.whirled.client.DisplaySceneImpl;
|
|
import com.threerings.whirled.data.SceneModel;
|
|
|
|
/**
|
|
* A basic implementation of the {@link EditableScene} interface.
|
|
*/
|
|
public class EditableSceneImpl implements EditableScene
|
|
{
|
|
/**
|
|
* Creates an instance that will create and use a blank scene model.
|
|
*/
|
|
public EditableSceneImpl ()
|
|
{
|
|
this(EditableSceneModel.blankSceneModel());
|
|
}
|
|
|
|
/**
|
|
* Creates an instance that will obtain data from the supplied scene
|
|
* model and update it when changes are made.
|
|
*/
|
|
public EditableSceneImpl (EditableSceneModel model)
|
|
{
|
|
this(model, new DisplaySceneImpl(model.sceneModel, null));
|
|
}
|
|
|
|
/**
|
|
* Creates an instance that will obtain data from the supplied scene
|
|
* model and update it when changes are made. It will delegate to the
|
|
* supplied display scene instead of creating its own delegate.
|
|
*/
|
|
public EditableSceneImpl (
|
|
EditableSceneModel model, DisplaySceneImpl delegate)
|
|
{
|
|
_model = model.sceneModel;
|
|
_emodel = model;
|
|
_delegate = delegate;
|
|
}
|
|
|
|
// documentation inherited
|
|
public int getId ()
|
|
{
|
|
return _delegate.getId();
|
|
}
|
|
|
|
// documentation inherited
|
|
public String getName ()
|
|
{
|
|
return _delegate.getName();
|
|
}
|
|
|
|
// documentation inherited
|
|
public int getVersion ()
|
|
{
|
|
return _delegate.getVersion();
|
|
}
|
|
|
|
// documentation inherited
|
|
public int[] getNeighborIds ()
|
|
{
|
|
return _delegate.getNeighborIds();
|
|
}
|
|
|
|
// documentation inherited
|
|
public PlaceConfig getPlaceConfig ()
|
|
{
|
|
return _delegate.getPlaceConfig();
|
|
}
|
|
|
|
// documentation inherited
|
|
public void setId (int sceneId)
|
|
{
|
|
_model.sceneId = sceneId;
|
|
}
|
|
|
|
// documentation inherited
|
|
public void setName (String name)
|
|
{
|
|
_model.sceneName = name;
|
|
}
|
|
|
|
// documentation inherited
|
|
public void setVersion (int version)
|
|
{
|
|
_model.version = version;
|
|
}
|
|
|
|
// documentation inherited
|
|
public void setNeighborIds (int[] neighborIds)
|
|
{
|
|
_model.neighborIds = neighborIds;
|
|
}
|
|
|
|
// documentation inherited
|
|
public ArrayList getNeighborNames ()
|
|
{
|
|
return _emodel.neighborNames;
|
|
}
|
|
|
|
// documentation inherited
|
|
public void addNeighbor (String neighborName)
|
|
{
|
|
if (!_emodel.neighborNames.contains(neighborName)) {
|
|
_emodel.neighborNames.add(neighborName);
|
|
}
|
|
}
|
|
|
|
// documentation inherited
|
|
public boolean removeNeighbor (String neighborName)
|
|
{
|
|
return _emodel.neighborNames.remove(neighborName);
|
|
}
|
|
|
|
// documentation inherited
|
|
public EditableSceneModel getSceneModel ()
|
|
{
|
|
flushToModel();
|
|
return _emodel;
|
|
}
|
|
|
|
/**
|
|
* Derived classes should override this method and flush any editable
|
|
* modifications to the scene model when this method is called.
|
|
*/
|
|
protected void flushToModel ()
|
|
{
|
|
}
|
|
|
|
/** A reference to our scene model. */
|
|
protected SceneModel _model;
|
|
|
|
/** A reference to our editable scene model. */
|
|
protected EditableSceneModel _emodel;
|
|
|
|
/** Our display scene delegate. */
|
|
protected DisplaySceneImpl _delegate;
|
|
}
|