com.threerings.tudey.tools
Class SceneEditor

java.lang.Object
  extended by com.threerings.expr.DynamicScope
      extended by com.threerings.opengl.GlApp
          extended by com.threerings.opengl.GlCanvasApp
              extended by com.threerings.opengl.GlCanvasTool
                  extended by com.threerings.tudey.tools.TudeyTool
                      extended by com.threerings.tudey.tools.SceneEditor
All Implemented Interfaces:
com.threerings.crowd.util.CrowdContext, EditorContext, Scope, ScopeUpdateListener, AlContext, Enqueueable, GlContext, com.threerings.presents.util.PresentsContext, TudeySceneModel.Observer, EntryManipulator, TudeyContext, com.threerings.whirled.util.WhirledContext, ClipboardOwner, ActionListener, MouseListener, KeyEventDispatcher, EventListener

public class SceneEditor
extends TudeyTool
implements EntryManipulator, TudeySceneModel.Observer, KeyEventDispatcher, MouseListener, ClipboardOwner

The scene editor application.


Field Summary
static Predicate<Object> DEFAULT_ENTRY_FILTER
          Allows all entries except globals.
static Function<TudeySceneModel.Entry,Object> ENTRY_TO_KEY
          A function that transforms an Entry to its key.
static Predicate<Object> PLACEABLE_ENTRY_FILTER
          Allows only placeable entries.
static Predicate<Object> TILE_ENTRY_FILTER
          Allows only tile entries.
 
Fields inherited from interface com.threerings.expr.Scope
EPOCH, NOW
 
Constructor Summary
SceneEditor(String scene)
          Creates the scene editor with (optionally) the path to a scene to load.
 
Method Summary
 void actionPerformed(ActionEvent event)
           
 void addEntries(TudeySceneModel.Entry... entries)
          Adds entries to the scene.
 void clearPlaceView(com.threerings.crowd.client.PlaceView view)
           
 void clearSelection()
          Clears the selection.
 void deleteMouseEntry()
          Attempts to delete the entry under the mouse cursor on the currently selected layer.
 void deleteMouseEntry(Predicate<? super TudeySceneModel.Entry> filter)
          Attempts to delete the entry under the mouse cursor on the currently selected layer.
 boolean dispatchKeyEvent(KeyEvent event)
           
 void editMouseEntry()
          Attempts to edit the entry under the mouse cursor on the currently selected layer.
 void entryAdded(TudeySceneModel.Entry entry)
          Notes that an entry has been added to the scene.
 void entryRemoved(TudeySceneModel.Entry oentry)
          Notes that an entry has been removed from the scene.
 void entryUpdated(TudeySceneModel.Entry oentry, TudeySceneModel.Entry nentry)
          Notes that an entry has been updated within the scene.
 ConfigManager getConfigManager()
          Returns a reference to the configuration manager.
 EditorGrid getGrid()
          Returns a reference to the editor grid.
 Predicate<TudeySceneModel.Entry> getLayerPredicate()
          Returns a Predicate that selects entries only on the current layer.
 TudeySceneModel.Entry getMouseEntry()
          Returns a reference to the entry under the mouse cursor on the currently selected layer.
 TudeySceneModel.Entry getMouseEntry(Predicate<? super TudeySceneModel.Entry> filter)
          Returns a reference to the entry under the mouse cursor on the currently selected layer.
 TudeySceneModel.Entry[] getSelection()
          Returns the selected elements.
 TudeySceneView getView()
          Returns a reference to the scene view.
 void incrementEditId()
          Increments the edit id, ensuring that any further edits will not be merged with previous ones.
 boolean isAltDown()
          Checks whether the alt key is being held down.
 boolean isControlDown()
          Checks whether the control key is being held down.
 boolean isFirstButtonDown()
          Checks whether the first mouse button is being held down on the canvas.
 boolean isSecondButtonDown()
          Checks whether the second mouse button is being held down on the canvas.
 boolean isSelected(TudeySceneModel.Entry entry)
          Determines whether the specified entry is selected.
 boolean isShiftDown()
          Checks whether the shift key is being held down.
 boolean isSpecialDown()
          Checks whether either of the special modifiers (control or alt) is down.
 boolean isThirdButtonDown()
          Checks whether the third mouse button is being held down on the canvas.
 void lostOwnership(Clipboard clipboard, Transferable contents)
           
static void main(String[] args)
          The program entry point.
 void mouseClicked(MouseEvent event)
           
 void mouseEntered(MouseEvent event)
           
 void mouseExited(MouseEvent event)
           
 void mousePressed(MouseEvent event)
           
 void mouseReleased(MouseEvent event)
           
 void move(TudeySceneModel.Entry... entries)
          Activates the supplied entries in the mover tool.
 void moveSelection()
          Starts moving the current selection.
 void overwriteEntries(TudeySceneModel.Entry... entries)
          Adds an entry, removing any conflicting entries if necessary.
 void removeAndMove(TudeySceneModel.Entry... entries)
          Removes the specified entries, then activates them in the mover tool.
 void removeEntries(Collection<? extends TudeySceneModel.Entry> coll)
          Removes the specified entries from the scene.
 void removeEntries(Object... keys)
          Removes entries from the scene.
 void select(TudeySceneModel.Entry... selection)
          Selects the specified entries and switches to either the selector tool or the arrow tool, depending on whether multiple entries are selected.
 void setPaint(Rectangle region, TudeySceneModel.Paint paint)
          Sets or clears the paint for a region in the scene.
 void setPlaceView(com.threerings.crowd.client.PlaceView view)
           
 void setSelection(TudeySceneModel.Entry... selection)
          Sets the selected elements.
 void shutdown()
          Shuts down the application.
 void updateEntries(TudeySceneModel.Entry... entries)
          Updates entries within the scene.
 void useMouseEntry()
          Attempts to "use" the entry under the mouse cursor on the currently selected layer.
 
Methods inherited from class com.threerings.tudey.tools.TudeyTool
getChatDirector, getClient, getConfig, getDObjectManager, getLocationDirector, getOccupantDirector, getRoot, getSceneDirector
 
Methods inherited from class com.threerings.opengl.GlCanvasTool
shouldCheckTimestamps
 
Methods inherited from class com.threerings.opengl.GlCanvasApp
createRoot, getCanvas, getFrame, getMouseRay, getPickRay, getRunQueue, makeCurrent, startup
 
Methods inherited from class com.threerings.opengl.GlApp
createSnapshot, enqueue, getApp, getCameraHandler, getClipProvider, getColorPository, getCompatibilityMode, getCompositor, getImageCache, getMessageManager, getRenderEffects, getRenderer, getRenderScheme, getResourceManager, getScope, getShaderCache, getSoundManager, getStreamGain, setCameraHandler, setCompatibilityMode, setRenderEffects, setRenderer, setRenderScheme, xlate
 
Methods inherited from class com.threerings.expr.DynamicScope
addListener, dispose, endCompoundUpdate, get, getParentScope, getScopeName, put, remove, removeListener, scopeUpdated, setParentScope, startCompoundUpdate, wasUpdated
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.threerings.opengl.util.GlContext
getApp, getCameraHandler, getColorPository, getCompositor, getImageCache, getMessageManager, getRenderer, getResourceManager, getScope, getShaderCache, makeCurrent, setCameraHandler, setRenderer
 
Methods inherited from interface com.threerings.openal.util.AlContext
getClipProvider, getSoundManager
 
Methods inherited from interface com.threerings.crowd.util.CrowdContext
getMessageManager
 

Field Detail

TILE_ENTRY_FILTER

public static final Predicate<Object> TILE_ENTRY_FILTER
Allows only tile entries.


PLACEABLE_ENTRY_FILTER

public static final Predicate<Object> PLACEABLE_ENTRY_FILTER
Allows only placeable entries.


DEFAULT_ENTRY_FILTER

public static final Predicate<Object> DEFAULT_ENTRY_FILTER
Allows all entries except globals.


ENTRY_TO_KEY

public static final Function<TudeySceneModel.Entry,Object> ENTRY_TO_KEY
A function that transforms an Entry to its key.

Constructor Detail

SceneEditor

public SceneEditor(String scene)
Creates the scene editor with (optionally) the path to a scene to load.

Method Detail

main

public static void main(String[] args)
                 throws Exception
The program entry point.

Throws:
Exception

getView

public TudeySceneView getView()
Returns a reference to the scene view.


getGrid

public EditorGrid getGrid()
Returns a reference to the editor grid.


isShiftDown

public boolean isShiftDown()
Checks whether the shift key is being held down.


isSpecialDown

public boolean isSpecialDown()
Checks whether either of the special modifiers (control or alt) is down.


isControlDown

public boolean isControlDown()
Checks whether the control key is being held down.


isAltDown

public boolean isAltDown()
Checks whether the alt key is being held down.


isFirstButtonDown

public boolean isFirstButtonDown()
Checks whether the first mouse button is being held down on the canvas.


isSecondButtonDown

public boolean isSecondButtonDown()
Checks whether the second mouse button is being held down on the canvas.


isThirdButtonDown

public boolean isThirdButtonDown()
Checks whether the third mouse button is being held down on the canvas.


clearSelection

public void clearSelection()
Clears the selection.


getLayerPredicate

public Predicate<TudeySceneModel.Entry> getLayerPredicate()
Returns a Predicate that selects entries only on the current layer.


select

public void select(TudeySceneModel.Entry... selection)
Selects the specified entries and switches to either the selector tool or the arrow tool, depending on whether multiple entries are selected.


setSelection

public void setSelection(TudeySceneModel.Entry... selection)
Sets the selected elements.


getSelection

public TudeySceneModel.Entry[] getSelection()
Returns the selected elements.


isSelected

public boolean isSelected(TudeySceneModel.Entry entry)
Determines whether the specified entry is selected.


editMouseEntry

public void editMouseEntry()
Attempts to edit the entry under the mouse cursor on the currently selected layer.


deleteMouseEntry

public void deleteMouseEntry()
Attempts to delete the entry under the mouse cursor on the currently selected layer.


deleteMouseEntry

public void deleteMouseEntry(Predicate<? super TudeySceneModel.Entry> filter)
Attempts to delete the entry under the mouse cursor on the currently selected layer.


useMouseEntry

public void useMouseEntry()
Attempts to "use" the entry under the mouse cursor on the currently selected layer.


getMouseEntry

public TudeySceneModel.Entry getMouseEntry()
Returns a reference to the entry under the mouse cursor on the currently selected layer.


getMouseEntry

public TudeySceneModel.Entry getMouseEntry(Predicate<? super TudeySceneModel.Entry> filter)
Returns a reference to the entry under the mouse cursor on the currently selected layer.


moveSelection

public void moveSelection()
Starts moving the current selection.


removeAndMove

public void removeAndMove(TudeySceneModel.Entry... entries)
Removes the specified entries, then activates them in the mover tool.


move

public void move(TudeySceneModel.Entry... entries)
Activates the supplied entries in the mover tool.


incrementEditId

public void incrementEditId()
Increments the edit id, ensuring that any further edits will not be merged with previous ones.


overwriteEntries

public void overwriteEntries(TudeySceneModel.Entry... entries)
Adds an entry, removing any conflicting entries if necessary.


addEntries

public void addEntries(TudeySceneModel.Entry... entries)
Description copied from interface: EntryManipulator
Adds entries to the scene.

Specified by:
addEntries in interface EntryManipulator

updateEntries

public void updateEntries(TudeySceneModel.Entry... entries)
Description copied from interface: EntryManipulator
Updates entries within the scene.

Specified by:
updateEntries in interface EntryManipulator

removeEntries

public void removeEntries(Object... keys)
Description copied from interface: EntryManipulator
Removes entries from the scene.

Specified by:
removeEntries in interface EntryManipulator

removeEntries

public void removeEntries(Collection<? extends TudeySceneModel.Entry> coll)
Description copied from interface: EntryManipulator
Removes the specified entries from the scene.

Specified by:
removeEntries in interface EntryManipulator

setPaint

public void setPaint(Rectangle region,
                     TudeySceneModel.Paint paint)
Description copied from interface: EntryManipulator
Sets or clears the paint for a region in the scene.

Specified by:
setPaint in interface EntryManipulator

entryAdded

public void entryAdded(TudeySceneModel.Entry entry)
Description copied from interface: TudeySceneModel.Observer
Notes that an entry has been added to the scene.

Specified by:
entryAdded in interface TudeySceneModel.Observer

entryUpdated

public void entryUpdated(TudeySceneModel.Entry oentry,
                         TudeySceneModel.Entry nentry)
Description copied from interface: TudeySceneModel.Observer
Notes that an entry has been updated within the scene.

Specified by:
entryUpdated in interface TudeySceneModel.Observer

entryRemoved

public void entryRemoved(TudeySceneModel.Entry oentry)
Description copied from interface: TudeySceneModel.Observer
Notes that an entry has been removed from the scene.

Specified by:
entryRemoved in interface TudeySceneModel.Observer

dispatchKeyEvent

public boolean dispatchKeyEvent(KeyEvent event)
Specified by:
dispatchKeyEvent in interface KeyEventDispatcher

mouseClicked

public void mouseClicked(MouseEvent event)
Specified by:
mouseClicked in interface MouseListener

mousePressed

public void mousePressed(MouseEvent event)
Specified by:
mousePressed in interface MouseListener

mouseReleased

public void mouseReleased(MouseEvent event)
Specified by:
mouseReleased in interface MouseListener

mouseEntered

public void mouseEntered(MouseEvent event)
Specified by:
mouseEntered in interface MouseListener

mouseExited

public void mouseExited(MouseEvent event)
Specified by:
mouseExited in interface MouseListener

lostOwnership

public void lostOwnership(Clipboard clipboard,
                          Transferable contents)
Specified by:
lostOwnership in interface ClipboardOwner

getConfigManager

public ConfigManager getConfigManager()
Description copied from interface: GlContext
Returns a reference to the configuration manager.

Specified by:
getConfigManager in interface EditorContext
Specified by:
getConfigManager in interface AlContext
Specified by:
getConfigManager in interface GlContext
Overrides:
getConfigManager in class GlApp

setPlaceView

public void setPlaceView(com.threerings.crowd.client.PlaceView view)
Specified by:
setPlaceView in interface com.threerings.crowd.util.CrowdContext
Overrides:
setPlaceView in class TudeyTool

clearPlaceView

public void clearPlaceView(com.threerings.crowd.client.PlaceView view)
Specified by:
clearPlaceView in interface com.threerings.crowd.util.CrowdContext
Overrides:
clearPlaceView in class TudeyTool

actionPerformed

public void actionPerformed(ActionEvent event)
Specified by:
actionPerformed in interface ActionListener
Overrides:
actionPerformed in class GlCanvasTool

shutdown

public void shutdown()
Description copied from class: GlApp
Shuts down the application.

Overrides:
shutdown in class GlCanvasApp


Copyright © 2011. All Rights Reserved.