Skip to content

Commit ded663b

Browse files
hukasumockersf
authored andcommitted
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 0b3a51b commit ded663b

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
@@ -1533,6 +1533,8 @@ impl<'a> Iterator for TriggeredEventsIter<'a> {
15331533

15341534
#[cfg(test)]
15351535
mod tests {
1536+
use bevy_reflect::{DynamicMap, Map};
1537+
15361538
use super::*;
15371539

15381540
#[derive(Event, Reflect, Clone)]
@@ -1664,4 +1666,13 @@ mod tests {
16641666
active_animation.update(clip.duration, clip.duration); // 0.3 : 0.0
16651667
assert_triggered_events_with(&active_animation, &clip, [0.3, 0.2]);
16661668
}
1669+
1670+
#[test]
1671+
fn test_animation_node_index_as_key_of_dynamic_map() {
1672+
let mut map = DynamicMap::default();
1673+
map.insert_boxed(
1674+
Box::new(AnimationNodeIndex::new(0)),
1675+
Box::new(ActiveAnimation::default()),
1676+
);
1677+
}
16671678
}

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)