@@ -24,10 +24,6 @@ pub fn time_panel_blueprint_entity_path() -> EntityPath {
2424
2525/// Helper trait to write time panel related blueprint components.
2626trait TimeBlueprintExt {
27- fn set_time ( & self , time : impl Into < TimeInt > ) ;
28-
29- fn time ( & self ) -> Option < TimeInt > ;
30-
3127 fn set_timeline ( & self , timeline : TimelineName ) ;
3228
3329 fn timeline ( & self ) -> Option < TimelineName > ;
@@ -58,27 +54,6 @@ trait TimeBlueprintExt {
5854}
5955
6056impl < T : BlueprintContext > TimeBlueprintExt for T {
61- fn set_time ( & self , time : impl Into < TimeInt > ) {
62- let time: TimeInt = time. into ( ) ;
63- self . save_static_blueprint_component (
64- time_panel_blueprint_entity_path ( ) ,
65- & TimePanelBlueprint :: descriptor_time ( ) ,
66- & re_types:: blueprint:: components:: TimeInt ( time. as_i64 ( ) . into ( ) ) ,
67- ) ;
68- }
69-
70- fn time ( & self ) -> Option < TimeInt > {
71- let ( _, time) = self
72- . current_blueprint ( )
73- . latest_at_component_quiet :: < re_types:: blueprint:: components:: TimeInt > (
74- & time_panel_blueprint_entity_path ( ) ,
75- self . blueprint_query ( ) ,
76- TimePanelBlueprint :: descriptor_time ( ) . component ,
77- ) ?;
78-
79- Some ( TimeInt :: saturated_temporal_i64 ( time. 0 . 0 ) )
80- }
81-
8257 fn set_timeline ( & self , timeline : TimelineName ) {
8358 self . save_blueprint_component (
8459 time_panel_blueprint_entity_path ( ) ,
@@ -495,22 +470,7 @@ impl TimeControl {
495470 if let Some ( times_per_timeline) = times_per_timeline {
496471 self . select_valid_timeline ( times_per_timeline) ;
497472 }
498-
499- if let Some ( time) = blueprint_ctx. time ( ) {
500- if self . time_int ( ) != Some ( time) {
501- self . states
502- . entry ( * self . timeline ( ) . name ( ) )
503- . or_insert_with ( || TimeState :: new ( time) )
504- . time = time. into ( ) ;
505- }
506- }
507- // If the blueprint time wasn't set, but the current state's time was, we likely just switched timelines, so restore that timeline's time.
508- else if let Some ( state) = self . states . get ( self . timeline ( ) . name ( ) ) {
509- blueprint_ctx. set_time ( state. time . floor ( ) ) ;
510- }
511- // If we can't restore that timeline's state, we are on a new timeline.
512- //
513- // Then insert that new state at the start. Or end if we're following.
473+ // If we are on a new timeline insert that new state at the start. Or end if we're following.
514474 else if let Some ( times_per_timeline) = times_per_timeline
515475 && let Some ( full_valid_range) = self . full_valid_range ( times_per_timeline)
516476 {
@@ -576,14 +536,7 @@ impl TimeControl {
576536 ///
577537 /// If `blueprint_ctx` is some, this will also update the time stored in
578538 /// the blueprint if `time_int` has changed.
579- fn update_time ( & mut self , blueprint_ctx : Option < & impl BlueprintContext > , time : TimeReal ) {
580- let time_int = time. floor ( ) ;
581- if self . time_int ( ) != Some ( time_int)
582- && let Some ( blueprint_ctx) = blueprint_ctx
583- {
584- blueprint_ctx. set_time ( time_int) ;
585- }
586-
539+ fn update_time ( & mut self , time : TimeReal ) {
587540 self . states
588541 . entry ( * self . timeline . name ( ) )
589542 . or_insert_with ( || TimeState :: new ( time) )
@@ -643,7 +596,7 @@ impl TimeControl {
643596
644597 if self . loop_mode == LoopMode :: Off && full_valid_range. max ( ) <= state. time {
645598 // We've reached the end of the data
646- self . update_time ( blueprint_ctx , full_valid_range. max ( ) . into ( ) ) ;
599+ self . update_time ( full_valid_range. max ( ) . into ( ) ) ;
647600
648601 if more_data_is_coming {
649602 // then let's wait for it without pausing!
@@ -701,13 +654,13 @@ impl TimeControl {
701654 new_time = new_time. clamp ( clamp_range. min ( ) . into ( ) , clamp_range. max ( ) . into ( ) ) ;
702655 }
703656
704- self . update_time ( blueprint_ctx , new_time) ;
657+ self . update_time ( new_time) ;
705658
706659 NeedsRepaint :: Yes
707660 }
708661 PlayState :: Following => {
709662 // Set the time to the max:
710- self . update_time ( blueprint_ctx , full_valid_range. max ( ) . into ( ) ) ;
663+ self . update_time ( full_valid_range. max ( ) . into ( ) ) ;
711664
712665 NeedsRepaint :: No // no need for request_repaint - we already repaint when new data arrives
713666 }
@@ -881,9 +834,6 @@ impl TimeControl {
881834 {
882835 self . states
883836 . insert ( * timeline_name, TimeState :: new ( full_valid_range. min ) ) ;
884- if let Some ( blueprint_ctx) = blueprint_ctx {
885- blueprint_ctx. set_time ( full_valid_range. min ) ;
886- }
887837 }
888838
889839 NeedsRepaint :: Yes
@@ -956,10 +906,6 @@ impl TimeControl {
956906 if let Some ( full_valid_range) = self . full_valid_range ( times_per_timeline) {
957907 self . following = false ;
958908
959- if let Some ( blueprint_ctx) = blueprint_ctx {
960- blueprint_ctx. set_time ( full_valid_range. min ) ;
961- }
962-
963909 if let Some ( state) = self . states . get_mut ( self . timeline . name ( ) ) {
964910 state. time = full_valid_range. min . into ( ) ;
965911 }
@@ -1024,18 +970,13 @@ impl TimeControl {
1024970 }
1025971 TimeControlCommand :: SetTime ( time) => {
1026972 let time_int = time. floor ( ) ;
1027- let update_blueprint = self . time_int ( ) != Some ( time_int) ;
1028- if let Some ( blueprint_ctx) = blueprint_ctx
1029- && update_blueprint
1030- {
1031- blueprint_ctx. set_time ( time_int) ;
1032- }
973+ let repaint = self . time_int ( ) != Some ( time_int) ;
1033974 self . states
1034975 . entry ( * self . timeline . name ( ) )
1035976 . or_insert_with ( || TimeState :: new ( * time) )
1036977 . time = * time;
1037978
1038- if update_blueprint {
979+ if repaint {
1039980 NeedsRepaint :: Yes
1040981 } else {
1041982 NeedsRepaint :: No
@@ -1100,16 +1041,10 @@ impl TimeControl {
11001041 if let Some ( state) = self . states . get_mut ( self . timeline . name ( ) ) {
11011042 if max ( & timeline_stats. per_time ) <= state. time {
11021043 let new_time = min ( & timeline_stats. per_time ) ;
1103- if let Some ( blueprint_ctx) = blueprint_ctx {
1104- blueprint_ctx. set_time ( new_time) ;
1105- }
11061044 state. time = new_time. into ( ) ;
11071045 }
11081046 } else {
11091047 let new_time = min ( & timeline_stats. per_time ) ;
1110- if let Some ( blueprint_ctx) = blueprint_ctx {
1111- blueprint_ctx. set_time ( new_time) ;
1112- }
11131048 self . states
11141049 . insert ( * self . timeline . name ( ) , TimeState :: new ( new_time) ) ;
11151050 }
@@ -1124,9 +1059,6 @@ impl TimeControl {
11241059 {
11251060 // Set the time to the max:
11261061 let new_time = max ( & timeline_stats. per_time ) ;
1127- if let Some ( blueprint_ctx) = blueprint_ctx {
1128- blueprint_ctx. set_time ( new_time) ;
1129- }
11301062 self . states
11311063 . entry ( * self . timeline . name ( ) )
11321064 . or_insert_with ( || TimeState :: new ( new_time) )
@@ -1153,9 +1085,6 @@ impl TimeControl {
11531085 } else {
11541086 step_back_time ( time, & timeline_stats. per_time ) . into ( )
11551087 } ;
1156- if let Some ( ctx) = blueprint_ctx {
1157- ctx. set_time ( new_time. floor ( ) ) ;
1158- }
11591088
11601089 if let Some ( state) = self . states . get_mut ( self . timeline . name ( ) ) {
11611090 state. time = new_time;
@@ -1180,9 +1109,6 @@ impl TimeControl {
11801109 } else {
11811110 step_fwd_time ( time, & stats. per_time ) . into ( )
11821111 } ;
1183- if let Some ( ctx) = blueprint_ctx {
1184- ctx. set_time ( new_time. floor ( ) ) ;
1185- }
11861112
11871113 if let Some ( state) = self . states . get_mut ( self . timeline . name ( ) ) {
11881114 state. time = new_time;
@@ -1236,9 +1162,6 @@ impl TimeControl {
12361162 && max ( & stats. per_time ) <= state. time
12371163 {
12381164 let new_time = min ( & stats. per_time ) ;
1239- if let Some ( blueprint_ctx) = blueprint_ctx {
1240- blueprint_ctx. set_time ( new_time) ;
1241- }
12421165 state. time = new_time. into ( ) ;
12431166 self . playing = true ;
12441167 self . following = false ;
0 commit comments