File tree Expand file tree Collapse file tree
crates/bevy_animation_graph/src/nodes Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -43,15 +43,15 @@ impl ClipNode {
4343 }
4444
4545 #[ inline]
46- pub fn clip_duration ( & self , ctx : & PassContext ) -> f32 {
46+ pub fn clip_duration ( & self , ctx : & PassContext ) -> Result < f32 , GraphError > {
4747 if let Some ( duration) = self . override_duration {
48- duration
48+ Ok ( duration)
4949 } else {
5050 ctx. resources
5151 . graph_clip_assets
5252 . get ( & self . clip )
53- . unwrap ( )
54- . duration ( )
53+ . ok_or ( GraphError :: ClipMissing )
54+ . map ( |c| c . duration ( ) )
5555 }
5656 }
5757
@@ -72,12 +72,12 @@ impl ClipNode {
7272
7373impl NodeLike for ClipNode {
7474 fn duration ( & self , mut ctx : PassContext ) -> Result < ( ) , GraphError > {
75- ctx. set_duration_fwd ( Some ( self . clip_duration ( & ctx) ) ) ;
75+ ctx. set_duration_fwd ( Some ( self . clip_duration ( & ctx) ? ) ) ;
7676 Ok ( ( ) )
7777 }
7878
7979 fn update ( & self , mut ctx : PassContext ) -> Result < ( ) , GraphError > {
80- let clip_duration = self . clip_duration ( & ctx) ;
80+ let clip_duration = self . clip_duration ( & ctx) ? ;
8181
8282 let Some ( clip) = ctx. resources . graph_clip_assets . get ( & self . clip ) else {
8383 // TODO: Should we propagate a GraphError instead?
You can’t perform that action at this time.
0 commit comments