mirror of
https://github.com/storytold/storyteller-bevy.git
synced 2026-10-28 08:58:07 +00:00
- 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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user