-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
reworked the Timeline Inspector & shifting
- Loading branch information
Showing
8 changed files
with
90 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
package fr.rader.billy.gui.inspector.listeners; | ||
|
||
import fr.rader.billy.Logger; | ||
import fr.rader.billy.Main; | ||
import fr.rader.billy.gui.inspector.TimelineInspector; | ||
import fr.rader.billy.timeline.Keyframe; | ||
|
||
import java.awt.event.ActionEvent; | ||
import java.awt.event.ActionListener; | ||
|
||
public class ShiftListener implements ActionListener { | ||
|
||
private final Logger logger = Main.getInstance().getLogger(); | ||
|
||
private TimelineInspector timelineInspector; | ||
|
||
@Override | ||
public void actionPerformed(ActionEvent e) { | ||
timelineInspector = TimelineInspector.getInstance(); | ||
|
||
int shift = (int) timelineInspector.shiftSpinner.getValue(); | ||
if(e.getSource().equals(timelineInspector.shiftAllKeyframesButton)) { | ||
shiftPositionKeyframes(shift); | ||
shiftTimeKeyframes(shift); | ||
} else if(e.getSource().equals(timelineInspector.shiftPositionKeyframesButton)) { | ||
shiftPositionKeyframes(shift); | ||
} else if(e.getSource().equals(timelineInspector.shiftTimeKeyframesButton)) { | ||
shiftTimeKeyframes(shift); | ||
} else if(e.getSource().equals(timelineInspector.shiftReplayTimestampsButton)) { | ||
logger.writeln("Shifting replay timestamps: " + shift); | ||
|
||
int oldTimestamp; | ||
for(Keyframe keyframe : timelineInspector.timePath.getKeyframes()) { | ||
oldTimestamp = (int) keyframe.getProperties().get("timestamp"); | ||
keyframe.getProperties().replace("timestamp", oldTimestamp + shift); | ||
} | ||
|
||
oldTimestamp = Integer.parseInt(timelineInspector.replayTimestampField.getText()); | ||
timelineInspector.replayTimestampField.setText(String.valueOf(oldTimestamp + shift)); | ||
} | ||
} | ||
|
||
private void shiftPositionKeyframes(int shift) { | ||
logger.writeln("Shifting position keyframes: " + shift); | ||
|
||
for(Keyframe keyframe : timelineInspector.positionPath.getKeyframes()) { | ||
keyframe.setTime(keyframe.getTime() + shift); | ||
} | ||
|
||
int oldTimestamp = Integer.parseInt(timelineInspector.positionKeyframeTimestampField.getText()); | ||
timelineInspector.positionKeyframeTimestampField.setText(String.valueOf(oldTimestamp + shift)); | ||
} | ||
|
||
private void shiftTimeKeyframes(int shift) { | ||
logger.writeln("Shifting time keyframes: " + shift); | ||
|
||
for(Keyframe keyframe : timelineInspector.timePath.getKeyframes()) { | ||
keyframe.setTime(keyframe.getTime() + shift); | ||
} | ||
|
||
int oldTimestamp = Integer.parseInt(timelineInspector.timeKeyframeTimestampField.getText()); | ||
timelineInspector.timeKeyframeTimestampField.setText(String.valueOf(oldTimestamp + shift)); | ||
} | ||
} |
29 changes: 0 additions & 29 deletions
29
fr/rader/billy/gui/inspector/listeners/ShiftReplayTimestampListener.java
This file was deleted.
Oops, something went wrong.
34 changes: 0 additions & 34 deletions
34
fr/rader/billy/gui/inspector/listeners/ShiftTimelineListener.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters