- avoid updating seek time from UI if source of seek time is studio, to avoid re-processing timeline info

- move generating animation to first thing in a frame, and notifying about timeline changes to last, to ensure that it happens before the time updates
- re-generate the animation tweens whenever you start playing or manually seek a new time in the timeline to prevent inconsistencies
This commit is contained in:
Lee-Orr
2024-03-22 16:37:10 -04:00
parent 11dc7c7945
commit 64b647881e
2 changed files with 27 additions and 23 deletions
@@ -45,6 +45,7 @@ implements TreeSelectionProvider {
@state() clipEnd = 0;
@state() playHead = 0;
@state() studioPlayTime = 0;
@state() playing = false;
@state() tracks : Record<string, {name?: string, target_type: studio.SceneElement, animation_target: studio.AnimationTarget }> = {};
@@ -64,7 +65,7 @@ implements TreeSelectionProvider {
}
protected override update(changes: PropertyValues<this>): void {
if (changes.has("playHead"))
if (changes.has("playHead") && Math.abs(this.studioPlayTime - this.playHead) > 0.0001)
studio.seekTime(this.playHead);
if (changes.has("selectedTrack")) {
@@ -81,10 +82,15 @@ implements TreeSelectionProvider {
super.update(changes);
}
setPlayTime(time: number) : void {
studio.seekTime(time);
}
@on("window:seek-time-changed")
onSeekTimeChanged({ detail: {time, playing} }: SeekTimeChanged ): void {
console.log("Seek Time Changed", time, playing);
this.playHead = time;
this.studioPlayTime = time;
this.playing = playing;
if (this.playHead < this.timelineStart) {