use of artisynth.core.probes.WayPointProbe in project artisynth_core by artisynth.
the class TimelineController method updateWayPointListOrder.
public void updateWayPointListOrder(int modifiedWaypointIndex) {
WayPointInfo modifiedWay = wayInfos.get(modifiedWaypointIndex);
wayInfos.remove(modifiedWay);
int insertionIndex = 0;
for (WayPointInfo wayInfo : wayInfos) {
if (modifiedWay.getTime() > wayInfo.getTime()) {
insertionIndex++;
}
}
System.out.println(modifiedWaypointIndex + "::" + insertionIndex);
wayInfos.add(insertionIndex, modifiedWay);
for (WayPointInfo wayInfo : wayInfos) {
wayInfo.updateWaypointIndex();
}
WayPointProbe wayProbe = myMain.getRootModel().getWayPoints();
wayProbe.remove(modifiedWay.myWaypoint);
wayProbe.add(modifiedWay.myWaypoint);
}
use of artisynth.core.probes.WayPointProbe in project artisynth_core by artisynth.
the class TimelineController method saveWayPointsAs.
public void saveWayPointsAs() {
WayPointProbe wayPoints = myMain.getRootModel().getWayPoints();
setAttachedFileFromUser(wayPoints, "Save As");
wayPoints.save();
}
use of artisynth.core.probes.WayPointProbe in project artisynth_core by artisynth.
the class TimelineController method resetAll.
// /**
// * Called internally when the step time is set by the GUI
// */
// void setStepTime (double newStep) {
// myScheduler.setStepTime (newStep);
// }
/**
* Resets the timeline. Called when it is first created and when new
* models are loaded.
*/
public void resetAll() {
// Assume that caller has ensured the scheduler is not running
// myScheduler.stopRequest();
// myScheduler.waitForPlayingToStop();
RootModel rootModel = myMain.getRootModel();
int count = myInTracks.size();
for (int i = 0; i < count; i++) {
deleteTrack(Track.TYPE_INPUT, 0, false);
}
count = myOutTracks.size();
for (int j = 0; j < count; j++) {
deleteTrack(Track.TYPE_OUTPUT, 0, false);
}
myProbeMap.clear();
// Add the root model on timeline
Track suitableTrack;
// Process all the input probes into proper places
for (Probe p : rootModel.getInputProbes()) {
addProbe(p);
}
// Process all the output probes into proper places
for (Probe p : rootModel.getOutputProbes()) {
if (!(p instanceof WayPointProbe)) {
addProbe(p);
}
}
// Process the waypoints
refreshWayPoints(rootModel);
// for (WayPoint wayPoint : getWayPoints().getPoints ()) {
// addWayPointFromRoot (wayPoint);
// }
// setAppropriateVirtualWaypoint (false);
// timescale.updateTimeCursor (0);
myToolBar.updateToolbarState(rootModel);
closeProbeEditors();
myProbeEditors = new ArrayList<NumericProbeEditor>();
selectedProbes = new ArrayList<ProbeInfo>();
expandToggle.setSelected(false);
muteToggle.setSelected(false);
updateWidgets(rootModel, /*refreshCursor=*/
true);
updateDisplay();
// requestUpdate (UPDATE_WIDGETS | REFRESH_CURSOR);
}
use of artisynth.core.probes.WayPointProbe in project artisynth_core by artisynth.
the class Track method muteTrack.
public void muteTrack(boolean mute) {
WayPointProbe wayProbe = myController.myMain.getRootModel().getWayPoints();
double earliestTime;
ArrayList<ProbeInfo> pinfos = getProbeInfos();
if (pinfos.size() > 0) {
earliestTime = pinfos.get(0).getStartTime();
wayProbe.invalidateAfterTime(earliestTime);
// if (myController.getCurrentTime() > earliestTime) {
// if (myController.myMain.getWorkspace().rootModelHasState()) {
// WayPoint wayPoint =
// wayProbe.getNearestValidBefore (earliestTime);
// if (wayPoint != null) {
// myController.myScheduler.setTime (wayPoint);
// }
// else {
// myController.myScheduler.setTime (0);
// }
// }
// else {
// myController.myScheduler.setTime (earliestTime);
// }
// }
}
if (mute) {
updateAllProbesToggleStatus(Track.TRACK_MUTED);
updateToggleStatus(Track.TRACK_MUTED);
} else {
updateAllProbesToggleStatus(Track.TRACK_UNMUTED);
updateToggleStatus(Track.TRACK_UNMUTED);
}
myController.requestUpdateWidgets();
}
use of artisynth.core.probes.WayPointProbe in project artisynth_core by artisynth.
the class Workspace method oldScanProbes.
private static void oldScanProbes(ReaderTokenizer rtok, RootModel rootModel) throws IOException {
// myInputProbes.clear();
// myOutputProbes.clear()
rootModel.removeAllInputProbes();
rootModel.removeAllOutputProbes();
rootModel.removeAllWayPoints();
// myOutputProbes.add(myWayPoints); will be read from file
// boolean isInvalid = false;
rtok.scanToken('[');
while (rtok.nextToken() != ']') {
if (!rtok.tokenIsWord()) {
throw new IOException("Expecting type identifier for probe, got " + rtok);
}
Class probeClass = null;
if ((probeClass = ClassAliases.resolveClass(rtok.sval)) == null) {
throw new IOException("Unknown resolve probe class: " + rtok.sval);
}
Object probeObj = null;
if (probeClass == WayPointProbe.class) {
probeObj = rootModel.getWayPoints();
} else {
try {
probeObj = probeClass.newInstance();
} catch (Exception e) {
throw new IOException("Can't instantiate probe class " + probeClass.getName() + ", line " + rtok.lineno());
}
}
if (probeObj instanceof Probe) {
if (((Probe) probeObj).isInput()) {
Probe iprobe = (Probe) probeObj;
try {
ScanWriteUtils.scanfull(rtok, iprobe, rootModel);
rootModel.addInputProbe(iprobe);
} catch (IOException e) {
String errMsg = "scan probe failed, ";
if (rtok.getResourceName() != null) {
errMsg += "file=" + rtok.getResourceName() + ", ";
}
System.err.println(errMsg + e.getMessage());
}
} else {
Probe oprobe = (Probe) probeObj;
try {
ScanWriteUtils.scanfull(rtok, oprobe, rootModel);
if (!(oprobe instanceof WayPointProbe)) {
// waypoint probe is
// already added
rootModel.addOutputProbe(oprobe);
}
} catch (IOException e) {
String errMsg = "scan probe failed, ";
if (rtok.getResourceName() != null) {
errMsg += "file=" + rtok.getResourceName() + ", ";
}
System.err.println(errMsg + e.getMessage());
}
}
} else {
// throw new IOException("Probe object " + probeClass.getName()
// + " is not a probe, line " + rtok.lineno());
// isInvalid = true;
}
}
}
Aggregations