@@ -35,9 +35,9 @@ pub struct NodeId(#[uuid] pub(crate) Uuid);
3535
3636pub type PinId = String ;
3737
38- #[ derive( Reflect , Debug , Clone , PartialEq , Eq , Hash , Serialize , Deserialize ) ]
38+ #[ derive( Reflect , Debug , Clone , PartialEq , Eq , PartialOrd , Ord , Hash , Serialize , Deserialize ) ]
3939pub enum GraphInputPin {
40- Default ( PinId ) ,
40+ Passthrough ( PinId ) ,
4141 /// Specifies that input with provided [`PinId`] should be retrieved from a source state's
4242 /// animation graph, e.g. if in an FSM transition.
4343 FromFsmSource ( PinId ) ,
@@ -49,7 +49,7 @@ pub enum GraphInputPin {
4949
5050impl Default for GraphInputPin {
5151 fn default ( ) -> Self {
52- Self :: Default ( "" . into ( ) )
52+ Self :: Passthrough ( "" . into ( ) )
5353 }
5454}
5555
@@ -237,7 +237,7 @@ pub struct AnimationGraph {
237237 /// Defines inputs and outputs for this graph.
238238 pub io_spec : GraphSpec ,
239239
240- pub default_data : HashMap < PinId , DataValue > ,
240+ pub default_data : HashMap < GraphInputPin , DataValue > ,
241241
242242 #[ reflect( ignore) ]
243243 pub editor_metadata : EditorMetadata ,
@@ -304,13 +304,12 @@ impl AnimationGraph {
304304 // --- Setting graph inputs and outputs
305305 // ----------------------------------------------------------------------------------------
306306 /// Sets the value for a default parameter, registering it if it wasn't yet done
307- pub fn set_default_data ( & mut self , input : PinId , value : DataValue ) {
308- let input = input. into ( ) ;
307+ pub fn set_default_data ( & mut self , input : GraphInputPin , value : DataValue ) {
309308 self . default_data . insert ( input, value) ;
310309 }
311310
312311 /// Get the default value of an input parameter, if it exists
313- pub fn get_default_data ( & mut self , input : & PinId ) -> Option < DataValue > {
312+ pub fn get_default_data ( & mut self , input : & GraphInputPin ) -> Option < DataValue > {
314313 self . default_data . get ( input) . cloned ( )
315314 }
316315
@@ -723,14 +722,13 @@ impl AnimationGraph {
723722 SourcePin :: InputData ( graph_input_pin) => ctx
724723 . io
725724 . get_data_back ( graph_input_pin. clone ( ) , ctx. clone ( ) )
726- . or_else ( |e| {
727- if let GraphInputPin :: Default ( pin_id) = graph_input_pin {
728- self . default_data . get ( pin_id) . cloned ( ) . ok_or_else ( || {
725+ . or_else ( |_| {
726+ self . default_data
727+ . get ( graph_input_pin)
728+ . cloned ( )
729+ . ok_or_else ( || {
729730 GraphError :: OutputMissing ( SourcePin :: InputData ( graph_input_pin. clone ( ) ) )
730731 } )
731- } else {
732- Err ( e)
733- }
734732 } ) ?,
735733 SourcePin :: NodeTime ( _) => {
736734 // TODO: Make a graph error
0 commit comments