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 François Mockers
parent 0b3a51bd7e
commit ded663b9b9
2 changed files with 13 additions and 0 deletions

View File

@ -1533,6 +1533,8 @@ impl<'a> Iterator for TriggeredEventsIter<'a> {
#[cfg(test)]
mod tests {
use bevy_reflect::{DynamicMap, Map};
use super::*;
#[derive(Event, Reflect, Clone)]
@ -1664,4 +1666,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
));