[Timeline] Fix #205 keyframe move crash - #211
Merged
ManlyMarco merged 2 commits intoJul 26, 2026
Merged
Conversation
Dropping a keyframe on a time that was already taken lost it. It got pulled out of the track before we knew the new spot was free, and then putting it back failed. Check first, and allow for the tiny rounding that comes from working the time out from pixels. AddKeyframe never checked either. Also don't shift keyframes to a negative time when closing a gap. Signed-off-by: Lusiocc <252649741+Lusiocc@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Fixes Timeline keyframe move edge cases that could orphan keyframes and leave the Timeline UI unresponsive, by pre-checking destination occupancy and introducing safer “try move” semantics for move/scale/paste/gap-close flows.
Changes:
- Pre-check keyframe drag-move destinations for collisions and apply ordered moves to allow selected keyframes to “pass through” prior positions.
- Add
FindOccupant(approximate-time collision detection) andTryMoveKeyframeto avoid orphaning keyframes / throwing on overlaps. - Harden paste-with-Alt and gap-closing behaviors with user-facing log messages and additional safety checks.
Comments suppressed due to low confidence (1)
Timeline.Core/Timeline.cs:2827
- ScaleKeyframeSelection ignores the TryMoveKeyframe() return value. If a move fails (e.g., keyframe not found in its parent list), scaling would silently apply a partial transformation and then refresh the UI, leaving selection/state out of sync.
for (int i = 0; i < _selectedKeyframes.Count; i++)
{
KeyValuePair<float, Keyframe> pair = _selectedKeyframes[i];
float newTime = (float)(((pair.Key - min) * newSize) / currentSize + min);
TryMoveKeyframe(pair.Value, newTime);
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Lusiocc <252649741+Lusiocc@users.noreply.github.com>
ManlyMarco
approved these changes
Jul 26, 2026
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Dropping a keyframe on a time that was already taken lost it. It got pulled out of the track before anything checked the new spot was free, and then putting it back failed. The keyframe still showed on screen but was gone from the track, and Timeline stopped responding until Studio was restarted.
Now the spot is checked before anything moves. If it's taken, nothing moves and a message says why. Keyframes moving together are moved in an order that lets them pass through each other's old positions.
Also fixed: adding a keyframe on top of another dumped an exception in the log, gap closing could try to move keyframes before the start of the timeline, and Alt paste stayed quiet when it couldn't make room.
Motivation and Context
Issue #205
How Has This Been Tested?
In Studio on HS2 and KK
Screenshots (if appropriate):
Types of changes