The Inner Workings of the Path Editor
Basic Outline
The Path Editor consists of several different areas that the user interacts with. The first, is under the
PathTab? class. The
PathTab? is the plugin that grapecluster loads for the Path Editor. It represents the Tab under the Flythrough tab, and displays the Streams combo box and the
PathControls? interface. The
PathControls? class is a controller to the Path Editor. It allows simple actions to be done, such as mode change, select all/deselect all, delete selected, undo/redo, as well as fine modification of individual points. It also has some options for the display properties of the editor window. The Editor window, or rather, the
PathViewPanel? class, is where the 3D contents are displayed. The JFrame that stores the
PathViewPanel? is spawned by the
PathTab?, as well as the
PathTools? that go below it. The
PathTools? are several tools to aid in path manipulation, such as horizontal/vertical movement locking. The
PathViewPanel? isn't instanciated until the user clicks the Show Editor button. This prevents java3D and all its overhead from being started without being needed.
The
PathViewPanel? keeps track of what's in the movie by a List of Paths. Each Path represents a Vector Stream in the movie. Each Path is responsible for a List of
PathPoints? that represent the
StreamKeyFrames? in the Stream, as well as the line connecting the
PathPoints? through time. The Movie, Stream, and
StreamKeyFrame? classes are all
EventSources?, so Events generated from the Movie, Streams, and
StreamKeyFrames? are used to ensure the visual representation of the Flythrough Path is always accurate.
Design Structure
The
PathViewPanel? contains a List of Paths. Each Path contains a List of
PathPoints?, as well as a reference to the Stream it represents. Each
PathPoint? contains the
StreamKeyFrame? it represents. The
PathPoint? listens for changes in the
StreamKeyFrame?, and modifies itself accordingly. The Path's main purpose is to provide an easy way to group
PathPoints? from a similar stream, and to generate a 3 dimensional Line that connects the
PathPoints? through time. The
PathViewPanel? listens to all the Streams in the Movie for any changes, and will modify the underlying Paths accordingly. When a user adds/deletes/modifies, it is important to note that the
PathViewPanel? doesn't actually modify the points, it simply retrieves the corresponding
StreamKeyFrame?, makes the changes, and lets the
EventListeners? handle the actual updating of the representation. This way, components outside the
PathViewPanel? setup can modify the Stream, and the visualization will still be correct.
Class Breakdown
- PathViewPanel?
- Holds the Canvas3D for the Java3D visualization. Also stores any Paths in the system. Implements various interfaces for things such as rotating the view/selecting points/adding points. Holds the root BranchGroup? for which all visual parts of the system are added to.
- Path
- Really just a container / line generator for PathPoints?.
- PathPoint?
- Holds the reference to a StreamKeyFrame?, as well as the necessary Java3D objects to visualize that StreamKeyFrame?. When a modification to the underlying keyframe is made, the PathPoint?'s eventOccurred method will adjust those J3D objects accordingly.
- PathViewMouseRotate?
- This is the Behavior that allows for using the mouse to not only rotate, but also select/move points in the system with the mouse. This is basically a modified MouseRotate?.java file from Sun's Java3D tutorials.
- PathControls?
- These are some simple controls for a PathViewPanel?, such as a button for mode switching, select all/deselect all/delete selected, as well as display options such as Selection Plan opacity, location, etc. This class also keeps track of Path Editor actions, and allows for undo/redo of a few of them.
- PathTools?
- These are the small tools that sit below the PathViewPanel?. This provides some simple tools such as camera locking (so the mouse doesn't rotate the view), horiz/vert locking/ or point moving.
- PathLegend?
- This is a simple window that shows all the Vector Streams in the Movie that the PathViewPanel? can work on. This also shows the color assigned to the Stream, and its name.
- PathAction?
- represents an Action done in the Editor, such as add/delete a point. These are stored on an undo or redo stack in the PathControls? class. Editor Window" button is pressed, it instanciates the PathViewPanel? object, causing J3D to be started and all of the points to be loaded from the streams.
Important Notes
Most of the setup above is straightforward. This has undergone a lot of rewrites (until recently, the Event system wasn't used), so there may be some methods/code that are no longer needed. Currently if outside sources modify the stream, a
PathAction? is still generated, but undoing/redoing it can lead to problems. It might just be better to move the entire undo/redo portion out to grapecluster itself, with a more generic Action type of class.
Also, there's probably a better way to do some of the stuff using the Event code. My thoughts were making the Path class automatically update the line whenever an underlying
StreamKeyFrame? was changed, but for the most part I think it works well.
There does seem to be a few issues that are most likely Java3D related. For example, I've noticed when working with rather large paths that rotating the view will cause the entire world to seem to jump around in space.
Also, it would be nice for some mechanism to be devised that would more quickly show the direction of the path. Currently, the final point in the path is blue, but when, say, a path represents a circle and the final point is in the same spot as the first point, it is no longer apparent which way the camera will go. My thought is to use instead of spheres as
PathPoints?, use a cone that points in the direction of the next point. This would require greater interaction between the
PathPoint? and the Path containing it, but ultimately should be possible.
--
AndrewRader?