@Override public void add(Editable point) { if (point instanceof PlanningSegment) { // hey, is this a closing segment? if (point instanceof ClosingSegment) { // do we already have one? if (this.getSegments().last() instanceof ClosingSegment) { // skip.... _toolParent.logError(ToolParent.WARNING, "Already have closing segment", null); } } // take a copy of the name, to stop it getting manmgled String name = point.getName(); super.add(point); if (point.getName() != name) ((PlanningSegment) point).setName(name); // better do a recalc, aswell recalculate(); } else { throw new RuntimeException("can't add this type to a composite track wrapper"); } }
@Override protected void paintThisFix(CanvasType dest, WorldLocation lastLocation, FixWrapper fw) { // set the label format to ]my label format if (_lastLabelFormat != null) fw.setLabelFormat(_lastLabelFormat); // set the fix font-size to be my font-size fw.setFont(this.getTrackFont()); // and now let it paint super.paintThisFix(dest, lastLocation, fw); }
public void bake( Transform ownerTransform, Transform targetTransform, Track ownerTrack, Track targetTrack, Ipo influenceIpo) { TrackWrapper ownerWrapperTrack = ownerTrack != null ? new TrackWrapper(ownerTrack) : null; TrackWrapper targetWrapperTrack = targetTrack != null ? new TrackWrapper(targetTrack) : null; // uruchamiamy bake dla transformat zalenie od tego, ktre argumenty s nullami, a ktre - nie this.bake(ownerTransform, targetTransform, influenceIpo.calculateValue(0)); if (ownerWrapperTrack != null) { float[] ownerTimes = ownerWrapperTrack.getTimes(); Vector3f[] translations = ownerWrapperTrack.getTranslations(); Quaternion[] rotations = ownerWrapperTrack.getRotations(); Vector3f[] scales = ownerWrapperTrack.getScales(); float[] targetTimes = targetWrapperTrack == null ? null : targetWrapperTrack.getTimes(); Vector3f[] targetTranslations = targetWrapperTrack == null ? null : targetWrapperTrack.getTranslations(); Quaternion[] targetRotations = targetWrapperTrack == null ? null : targetWrapperTrack.getRotations(); Vector3f[] targetScales = targetWrapperTrack == null ? null : targetWrapperTrack.getScales(); Vector3f translation = new Vector3f(), scale = new Vector3f(); Quaternion rotation = new Quaternion(); Transform ownerTemp = new Transform(), targetTemp = new Transform(); for (int i = 0; i < ownerTimes.length; ++i) { float t = ownerTimes[i]; ownerTemp.setTranslation(translations[i]); ownerTemp.setRotation(rotations[i]); ownerTemp.setScale(scales[i]); if (targetWrapperTrack == null) { this.bake(ownerTemp, targetTransform, influenceIpo.calculateValue(i)); } else { // getting the values that are the interpolation of the target track for the time 't' this.interpolate(targetTranslations, targetTimes, t, translation); this.interpolate(targetRotations, targetTimes, t, rotation); this.interpolate(targetScales, targetTimes, t, scale); targetTemp.setTranslation(translation); targetTemp.setRotation(rotation); targetTemp.setScale(scale); this.bake(ownerTemp, targetTemp, influenceIpo.calculateValue(i)); } // need to clone here because each of the arrays will reference the same instance if they // hold the same value in the compact array translations[i] = ownerTemp.getTranslation().clone(); rotations[i] = ownerTemp.getRotation().clone(); scales[i] = ownerTemp.getScale().clone(); } ownerWrapperTrack.setKeyframes(ownerTimes, translations, rotations, scales); } }