artisynth.core.driver
Class Main

java.lang.Object
  extended by artisynth.core.driver.Main
All Implemented Interfaces:
ComponentChangeListener, DriverInterface

public class Main
extends java.lang.Object
implements DriverInterface, ComponentChangeListener

the main class for artisynth


Nested Class Summary
static class Main.SelectionMode
           
static class Main.ViewerMode
           
 
Field Summary
static java.lang.String[] mousePrefsOptions
           
 
Constructor Summary
Main()
           
Main(java.lang.String windowName, int width, int height)
          to create the new window frame
 
Method Summary
 WayPoint addBreakPoint(double t)
           
 void addDemoName(java.lang.String alias, java.lang.String className)
           
 void addSelected(java.util.LinkedList<ModelComponent> items)
           
 void addSelectionListener(SelectionListener l)
          add the selection listener
 WayPoint addWayPoint(double t)
           
 void arrangeControlPanels(RootModel root)
           
 void clearRootModel()
           
 void clearWayPoints()
           
 void componentChanged(ComponentChangeEvent e)
           
 GLViewerFrame createViewerFrame()
           
static void createWorkspace()
           
 void delay(double sec)
           
 void deregisterWindow(PropertyWindow w)
           
static void exit(int code)
          Have our own exit method so that if we're running under matlab, we don't actually exit.
 void forward()
           
static boolean getArticulatedTransformsEnabled()
           
 java.lang.String getDemoClassName(java.lang.String classNameOrAlias)
           
 Tree<MenuEntry> getDemoMenu()
           
 java.lang.String[] getDemoNames()
           
static EditorManager getEditorManager()
          Get the EditorManager
 java.lang.String getErrorMessage()
           
static int getFlags()
           
 javax.swing.JFrame getFrame()
           
 double getFrameRate()
           
static boolean getInitDraggersInWorldCoords()
           
static InverseManager getInverseManager()
           
 ArtisynthJythonFrame getJythonFrame()
           
 java.lang.String getKeyBindings()
          get the key bindings from a file
static Main getMain()
           
static MainFrame getMainFrame()
           
static double getMaxStep()
           
 java.io.File getModelDirectory()
           
 java.io.File getModelFile()
           
 java.lang.String getModelName()
          Returns the current model name.
 java.lang.String getModelSaveFormat()
           
static MovieMaker getMovieMaker()
           
 java.io.File getProbeDirectory()
           
 java.io.File getProbesFile()
          get the file with probes
 java.util.LinkedList<PropertyWindow> getPropertyWindows()
          For diagnostic purposes.
static RootModel getRootModel()
           
static Scheduler getScheduler()
          Get the Scheduler
 java.lang.String getScriptName(java.lang.String alias)
           
 java.lang.String[] getScriptNames()
           
 SelectionManager getSelectionManager()
           
 Main.SelectionMode getSelectionMode()
           
static double getTime()
           
static Timeline getTimeline()
          get the timeline controller
static UndoManager getUndoManager()
           
 GLViewer getViewer()
           
 ViewerManager getViewerManager()
           
 Main.ViewerMode getViewerMode()
           
 WayPoint getWayPoint(double t)
           
static Workspace getWorkspace()
          get the root model, static method for the entire program to reference to, so do not pass root model around, because its stored in main and could be accessed using this method
static boolean isSimulating()
           
 boolean loadModel(java.lang.String modelName, java.lang.String className)
           
 void loadModelFile(java.io.File file)
           
 boolean loadProbesFile(java.io.File file)
          load the probes into the model
static void main(java.lang.String[] args)
          the main entry point
 void maskFocusStealing(boolean enable)
          Attempts to prevent artisynth form stealing focus when it pops up windows, etc, especially while running a script.
 void pause()
           
 void play()
           
 void play(double time)
           
 void quit()
           
 void registerWindow(PropertyWindow w)
          Register a property window with the main program.
 void removeDemoClass(java.lang.String className)
           
 void removeDemoName(java.lang.String alias)
           
 void removeSelected(java.util.LinkedList<ModelComponent> items)
           
 void removeSelectionListener(SelectionListener l)
          remove the selection listener
 boolean removeWayPoint(double t)
           
 boolean removeWayPoint(WayPoint way)
           
static void rerender()
          rerender all viewers and update all widgets
 void reset()
           
static void rewidgetUpdate()
          update all widgets
 void rewind()
           
 void saveModelFile(java.io.File file)
           
 void saveModelFile(java.io.File file, java.lang.String fmtStr)
           
 boolean saveProbesFile(java.io.File file)
          to save the probes file
 void screenShot(java.lang.String filename)
           
static void setArticulatedTransformsEnabled(boolean enable)
           
 void setErrorMessage(java.lang.String msg)
           
static void setFlags(int flags)
           
 void setFrameRate(double val)
           
static void setInitDraggersInWorldCoords(boolean enable)
           
 void setMaxStep(double sec)
           
 void setModelDirectory(java.io.File dir)
           
 void setModelSaveFormat(java.lang.String fmtStr)
           
 void setMouseBindings(java.lang.String prefs)
          set the mouse bindings
 void setProbeDirectory(java.io.File dir)
           
 void setRootModel(java.lang.String modelName, RootModel newRoot)
           
static void setRunningUnderMatlab(boolean underMatlab)
           
 void setSelectionMode(Main.SelectionMode selectionMode)
          Set the current selection mode.
 void setTimelineVisible(boolean visible)
          to set the timeline visible or not
 void setViewerMode(Main.ViewerMode viewerMode)
           
static void setWorkspace(Workspace newWorkspace)
          set the root model
 void start(boolean startWithTimeline, boolean timeLineAllignedRight, boolean loadLargeTimeline)
           
 void start(java.lang.String modelName)
          start given the model name
 void step()
           
 java.lang.String testSaveAndLoad(java.lang.String baseFileName, java.lang.String fmtStr)
           
 void waitForStop()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mousePrefsOptions

public static final java.lang.String[] mousePrefsOptions
Constructor Detail

Main

public Main()

Main

public Main(java.lang.String windowName,
            int width,
            int height)
to create the new window frame

Parameters:
windowName -
width -
height -
Method Detail

setRunningUnderMatlab

public static void setRunningUnderMatlab(boolean underMatlab)

getSelectionManager

public SelectionManager getSelectionManager()

getKeyBindings

public java.lang.String getKeyBindings()
get the key bindings from a file

Returns:
string with keybindings

setErrorMessage

public void setErrorMessage(java.lang.String msg)

getErrorMessage

public java.lang.String getErrorMessage()

getViewer

public GLViewer getViewer()
Specified by:
getViewer in interface DriverInterface

getMainFrame

public static MainFrame getMainFrame()

getFrame

public javax.swing.JFrame getFrame()
Specified by:
getFrame in interface DriverInterface

getDemoNames

public java.lang.String[] getDemoNames()

getDemoMenu

public Tree<MenuEntry> getDemoMenu()

getDemoClassName

public java.lang.String getDemoClassName(java.lang.String classNameOrAlias)

getScriptNames

public java.lang.String[] getScriptNames()

getScriptName

public java.lang.String getScriptName(java.lang.String alias)

getModelName

public java.lang.String getModelName()
Returns the current model name. This is either the name of the root model, or the command or file name associated with it.

Returns:
current model name.

addDemoName

public void addDemoName(java.lang.String alias,
                        java.lang.String className)

removeDemoName

public void removeDemoName(java.lang.String alias)

removeDemoClass

public void removeDemoClass(java.lang.String className)

setTimelineVisible

public void setTimelineVisible(boolean visible)
to set the timeline visible or not

Parameters:
visible - - boolean set the timeline visible

setFrameRate

public void setFrameRate(double val)

getFrameRate

public double getFrameRate()

createViewerFrame

public GLViewerFrame createViewerFrame()

getJythonFrame

public ArtisynthJythonFrame getJythonFrame()

isSimulating

public static boolean isSimulating()

reset

public void reset()

rewind

public void rewind()

play

public void play()

play

public void play(double time)

pause

public void pause()

waitForStop

public void waitForStop()

step

public void step()

forward

public void forward()

getTime

public static double getTime()

addWayPoint

public WayPoint addWayPoint(double t)

addBreakPoint

public WayPoint addBreakPoint(double t)

getWayPoint

public WayPoint getWayPoint(double t)

setMaxStep

public void setMaxStep(double sec)

getMaxStep

public static double getMaxStep()

removeWayPoint

public boolean removeWayPoint(WayPoint way)

removeWayPoint

public boolean removeWayPoint(double t)

clearWayPoints

public void clearWayPoints()

delay

public void delay(double sec)

start

public void start(boolean startWithTimeline,
                  boolean timeLineAllignedRight,
                  boolean loadLargeTimeline)

getRootModel

public static RootModel getRootModel()

clearRootModel

public void clearRootModel()

setRootModel

public void setRootModel(java.lang.String modelName,
                         RootModel newRoot)

loadModel

public boolean loadModel(java.lang.String modelName,
                         java.lang.String className)

getViewerManager

public ViewerManager getViewerManager()
Specified by:
getViewerManager in interface DriverInterface

setMouseBindings

public void setMouseBindings(java.lang.String prefs)
set the mouse bindings

Parameters:
prefs -

rerender

public static void rerender()
rerender all viewers and update all widgets


rewidgetUpdate

public static void rewidgetUpdate()
update all widgets


main

public static void main(java.lang.String[] args)
the main entry point

Parameters:
args -

start

public void start(java.lang.String modelName)
start given the model name

Parameters:
modelName -

getWorkspace

public static Workspace getWorkspace()
get the root model, static method for the entire program to reference to, so do not pass root model around, because its stored in main and could be accessed using this method

Returns:
workspace object

createWorkspace

public static void createWorkspace()

getMain

public static Main getMain()

getFlags

public static int getFlags()

setFlags

public static void setFlags(int flags)

setWorkspace

public static void setWorkspace(Workspace newWorkspace)
set the root model

Parameters:
newWorkspace -

getScheduler

public static Scheduler getScheduler()
Get the Scheduler

Returns:
scheduler

getEditorManager

public static EditorManager getEditorManager()
Get the EditorManager

Returns:
EditorManager

getUndoManager

public static UndoManager getUndoManager()

getInverseManager

public static InverseManager getInverseManager()

getTimeline

public static Timeline getTimeline()
get the timeline controller

Returns:
timeline controller

getModelFile

public java.io.File getModelFile()

loadModelFile

public void loadModelFile(java.io.File file)
                   throws java.io.IOException
Throws:
java.io.IOException

getModelSaveFormat

public java.lang.String getModelSaveFormat()

setModelSaveFormat

public void setModelSaveFormat(java.lang.String fmtStr)

saveModelFile

public void saveModelFile(java.io.File file)
                   throws java.io.IOException
Throws:
java.io.IOException

saveModelFile

public void saveModelFile(java.io.File file,
                          java.lang.String fmtStr)
                   throws java.io.IOException
Throws:
java.io.IOException

getProbesFile

public java.io.File getProbesFile()
get the file with probes

Returns:
file with probe data

loadProbesFile

public boolean loadProbesFile(java.io.File file)
                       throws java.io.IOException
load the probes into the model

Parameters:
file -
Throws:
java.io.IOException

quit

public void quit()

saveProbesFile

public boolean saveProbesFile(java.io.File file)
                       throws java.io.IOException
to save the probes file

Parameters:
file -
Throws:
java.io.IOException

addSelectionListener

public void addSelectionListener(SelectionListener l)
add the selection listener

Specified by:
addSelectionListener in interface DriverInterface

removeSelectionListener

public void removeSelectionListener(SelectionListener l)
remove the selection listener

Specified by:
removeSelectionListener in interface DriverInterface

addSelected

public void addSelected(java.util.LinkedList<ModelComponent> items)

removeSelected

public void removeSelected(java.util.LinkedList<ModelComponent> items)

componentChanged

public void componentChanged(ComponentChangeEvent e)
Specified by:
componentChanged in interface ComponentChangeListener

getInitDraggersInWorldCoords

public static boolean getInitDraggersInWorldCoords()

setInitDraggersInWorldCoords

public static void setInitDraggersInWorldCoords(boolean enable)

getArticulatedTransformsEnabled

public static boolean getArticulatedTransformsEnabled()

setArticulatedTransformsEnabled

public static void setArticulatedTransformsEnabled(boolean enable)

getSelectionMode

public Main.SelectionMode getSelectionMode()

setSelectionMode

public void setSelectionMode(Main.SelectionMode selectionMode)
Set the current selection mode. Also set the display of the selection buttons.

Parameters:
selectionMode -

setViewerMode

public void setViewerMode(Main.ViewerMode viewerMode)

getViewerMode

public Main.ViewerMode getViewerMode()

registerWindow

public void registerWindow(PropertyWindow w)
Register a property window with the main program. This will cause a listener to be added so that a rerender request is issued whenever property values change. It will also set the current root model as a synchronization object, and ensure that the window is deleted when the root model changes.

If the window is a render props dialog, handlers will be added to ensure that viewer selection coloring is disabled while the dialog is open.

Specified by:
registerWindow in interface DriverInterface

deregisterWindow

public void deregisterWindow(PropertyWindow w)
Specified by:
deregisterWindow in interface DriverInterface

getPropertyWindows

public java.util.LinkedList<PropertyWindow> getPropertyWindows()
For diagnostic purposes.


getMovieMaker

public static MovieMaker getMovieMaker()

setModelDirectory

public void setModelDirectory(java.io.File dir)

getModelDirectory

public java.io.File getModelDirectory()

setProbeDirectory

public void setProbeDirectory(java.io.File dir)

getProbeDirectory

public java.io.File getProbeDirectory()

arrangeControlPanels

public void arrangeControlPanels(RootModel root)

testSaveAndLoad

public java.lang.String testSaveAndLoad(java.lang.String baseFileName,
                                        java.lang.String fmtStr)

screenShot

public void screenShot(java.lang.String filename)

maskFocusStealing

public void maskFocusStealing(boolean enable)
Attempts to prevent artisynth form stealing focus when it pops up windows, etc, especially while running a script.


exit

public static void exit(int code)
Have our own exit method so that if we're running under matlab, we don't actually exit.