Skip to content

Commit

Permalink
[editor] more intuitive insert starting waypoint
Browse files Browse the repository at this point in the history
  • Loading branch information
Nertsal committed Oct 20, 2024
1 parent f88d7ec commit 3949a93
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/editor/action/level.rs
Original file line number Diff line number Diff line change
Expand Up @@ -495,18 +495,23 @@ impl LevelEditor {
rotation: self.place_rotation,
scale: self.place_scale,
};
let mut interpolation = MoveInterpolation::default(); // TODO: use the same as other waypoints
let mut change_curve = None;
match i.checked_sub(1) {
None => {
// Replace initial
std::mem::swap(&mut light.light.movement.initial, &mut transform);
std::mem::swap(&mut light.light.movement.interpolation, &mut interpolation);
change_curve = Some(light.light.movement.curve);
light.light.movement.curve = TrajectoryInterpolation::default();

// Extra time for fade in and telegraph
let time =
self.current_beat - light.light.movement.fade_in - light.telegraph.precede_time;
light.light.movement.key_frames.push_front(MoveFrame {
lerp_time: event.beat - time,
interpolation: MoveInterpolation::default(), // TODO: use the same as other waypoints
change_curve: None,
interpolation,
change_curve,
transform,
});
event.beat = time;
Expand All @@ -522,8 +527,8 @@ impl LevelEditor {
i,
MoveFrame {
lerp_time,
interpolation: MoveInterpolation::default(), // TODO: use the same as other waypoints
change_curve: None,
interpolation,
change_curve,
transform,
},
);
Expand Down

0 comments on commit 3949a93

Please sign in to comment.