Search in sources :

Example 6 with ViewerManager

use of artisynth.core.driver.ViewerManager in project artisynth_core by artisynth.

the class MovieMakerDialog method waypointCapture.

private void waypointCapture() {
    // disable play (otherwise destroys waypoints)
    boolean savedBegin = beginRecordOnStart.isEnabled();
    beginRecordOnStart.setEnabled(false);
    beginRecordOnStart.setSelected(false);
    // manual control of scheduler and rendering
    Scheduler scheduler = myMain.getScheduler();
    ViewerManager manager = myMain.getViewerManager();
    try {
        // reset to beginning
        scheduler.reset();
        manager.render();
        manager.paint();
        // starts recording
        startMovie();
        // we're manually doing this
        myMovieMaker.setGrabbing(false);
        myMovieMaker.resetFrameCounter();
        myMovieMaker.forceGrab();
        while (scheduler.fastForward()) {
            manager.render();
            manager.paint();
            myMovieMaker.forceGrab();
        }
        stopMovie();
    } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
        System.err.println("Failed to create movie");
    }
    beginRecordOnStart.setEnabled(savedBegin);
    beginRecordOnStart.setSelected(savedBegin);
}
Also used : Scheduler(artisynth.core.driver.Scheduler) ViewerManager(artisynth.core.driver.ViewerManager) InternalErrorException(maspack.util.InternalErrorException)

Aggregations

ViewerManager (artisynth.core.driver.ViewerManager)6 Scheduler (artisynth.core.driver.Scheduler)1 MutableCompositeComponent (artisynth.core.modelbase.MutableCompositeComponent)1 MovieMaker (artisynth.core.moviemaker.MovieMaker)1 PolygonalMesh (maspack.geometry.PolygonalMesh)1 AffineTransform3d (maspack.matrix.AffineTransform3d)1 RigidTransform3d (maspack.matrix.RigidTransform3d)1 Vector3d (maspack.matrix.Vector3d)1 InternalErrorException (maspack.util.InternalErrorException)1