Created CustomObjectRepository which can be serialized by Gson, storing all CustomImageObjects created
CustomObjectRepository is now being saved to and loaded from the ReplayFile The CustomObjectRenderer uses the GuiObjectManager's timeline cursor position as interpolation timestamp for the CustomImageObjects which are drawn if a GuiObjectManager is open (instant preview) KeyframeList's add() method now removes Keyframes with the same timestamp before adding the new Keyframe Transformations class now holds default values to prevent NullPointerExceptions in methods calling getTransformationForTimestamp() Added Javadoc to Transformation POJO Created NumberValueChangeListener which can be applied to GuiNumberInput objects Made step size customizable in GuiDraggingNumberInput Changing a ReplayImageAssets image now notifies the CustomImageObjects linked to that asset Modified RoundUtils to provide a round() method which uses the DecimalFormat class instead of Math.round which is unstable
This commit is contained in:
@@ -10,6 +10,12 @@ import lombok.NoArgsConstructor;
|
||||
@NoArgsConstructor
|
||||
public class Transformations {
|
||||
|
||||
private Position defaultAnchor = new Position(0, 0, 0),
|
||||
defaultPosition = new Position(0, 0, 0),
|
||||
defaultOrientation = new Position(0, 0, 0),
|
||||
defaultScale = new Position(100, 100, 100);
|
||||
private NumberValue defaultOpacity = new NumberValue(100);
|
||||
|
||||
private KeyframeList<Position> anchorKeyframes = new KeyframeList<Position>();
|
||||
private KeyframeList<Position> positionKeyframes = new KeyframeList<Position>();
|
||||
private KeyframeList<Position> orientationKeyframes = new KeyframeList<Position>();
|
||||
@@ -34,12 +40,22 @@ public class Transformations {
|
||||
}
|
||||
|
||||
public Transformation getTransformationForTimestamp(int timestamp) {
|
||||
return new Transformation(
|
||||
anchorKeyframes.getInterpolatedValueForTimestamp(timestamp, true),
|
||||
positionKeyframes.getInterpolatedValueForTimestamp(timestamp, true),
|
||||
orientationKeyframes.getInterpolatedValueForTimestamp(timestamp, true),
|
||||
scaleKeyframes.getInterpolatedValueForTimestamp(timestamp, true),
|
||||
opacityKeyframes.getInterpolatedValueForTimestamp(timestamp, true).value);
|
||||
Position anchor = anchorKeyframes.getInterpolatedValueForTimestamp(timestamp, true);
|
||||
if(anchor == null) anchor = defaultAnchor;
|
||||
|
||||
Position position = positionKeyframes.getInterpolatedValueForTimestamp(timestamp, true);
|
||||
if(position == null) position = defaultPosition;
|
||||
|
||||
Position orientation = orientationKeyframes.getInterpolatedValueForTimestamp(timestamp, true);
|
||||
if(orientation == null) orientation = defaultOrientation;
|
||||
|
||||
Position scale = scaleKeyframes.getInterpolatedValueForTimestamp(timestamp, true);
|
||||
if(scale == null) scale = defaultScale;
|
||||
|
||||
NumberValue opacity = opacityKeyframes.getInterpolatedValueForTimestamp(timestamp, true);
|
||||
if(opacity == null) opacity = defaultOpacity;
|
||||
|
||||
return new Transformation(anchor, position, orientation, scale, opacity.value);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user