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.
This commit is contained in:
Lucas Franca 2025-04-04 13:35:12 -03:00 committed by GitHub
parent 06f9e5eca5
commit 78d5c50b50
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 0 deletions

View File

@ -1530,6 +1530,8 @@ impl<'a> Iterator for TriggeredEventsIter<'a> {
#[cfg(test)]
mod tests {
use bevy_reflect::{DynamicMap, Map};
use super::*;
#[derive(Event, Reflect, Clone)]
@ -1661,4 +1663,13 @@ mod tests {
active_animation.update(clip.duration, clip.duration); // 0.3 : 0.0
assert_triggered_events_with(&active_animation, &clip, [0.3, 0.2]);
}
#[test]
fn test_animation_node_index_as_key_of_dynamic_map() {
let mut map = DynamicMap::default();
map.insert_boxed(
Box::new(AnimationNodeIndex::new(0)),
Box::new(ActiveAnimation::default()),
);
}
}

View File

@ -3,6 +3,8 @@ use crate::{impl_reflect_opaque, prelude::ReflectDefault, ReflectDeserialize, Re
impl_reflect_opaque!(::petgraph::graph::NodeIndex(
Clone,
Default,
PartialEq,
Hash,
Serialize,
Deserialize
));