Skip to content

Commit 78d5c50

Browse files
authored
Add PartialEq and Hash reflections for AnimationNodeIndex (#18718)
# Objective Fixes #18701 ## Solution Add reflection of `PartialEq` and `Hash` to `AnimationNodeIndex` ## Testing Added a new `#[test]` with the minimal reproduction posted on #18701.
1 parent 06f9e5e commit 78d5c50

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

crates/bevy_animation/src/lib.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1530,6 +1530,8 @@ impl<'a> Iterator for TriggeredEventsIter<'a> {
15301530

15311531
#[cfg(test)]
15321532
mod tests {
1533+
use bevy_reflect::{DynamicMap, Map};
1534+
15331535
use super::*;
15341536

15351537
#[derive(Event, Reflect, Clone)]
@@ -1661,4 +1663,13 @@ mod tests {
16611663
active_animation.update(clip.duration, clip.duration); // 0.3 : 0.0
16621664
assert_triggered_events_with(&active_animation, &clip, [0.3, 0.2]);
16631665
}
1666+
1667+
#[test]
1668+
fn test_animation_node_index_as_key_of_dynamic_map() {
1669+
let mut map = DynamicMap::default();
1670+
map.insert_boxed(
1671+
Box::new(AnimationNodeIndex::new(0)),
1672+
Box::new(ActiveAnimation::default()),
1673+
);
1674+
}
16641675
}

crates/bevy_reflect/src/impls/petgraph.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ use crate::{impl_reflect_opaque, prelude::ReflectDefault, ReflectDeserialize, Re
33
impl_reflect_opaque!(::petgraph::graph::NodeIndex(
44
Clone,
55
Default,
6+
PartialEq,
7+
Hash,
68
Serialize,
79
Deserialize
810
));

0 commit comments

Comments
 (0)