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:
parent
0b3a51bd7e
commit
ded663b9b9
@ -1533,6 +1533,8 @@ impl<'a> Iterator for TriggeredEventsIter<'a> {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
use bevy_reflect::{DynamicMap, Map};
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
#[derive(Event, Reflect, Clone)]
|
#[derive(Event, Reflect, Clone)]
|
||||||
@ -1664,4 +1666,13 @@ mod tests {
|
|||||||
active_animation.update(clip.duration, clip.duration); // 0.3 : 0.0
|
active_animation.update(clip.duration, clip.duration); // 0.3 : 0.0
|
||||||
assert_triggered_events_with(&active_animation, &clip, [0.3, 0.2]);
|
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()),
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,8 @@ use crate::{impl_reflect_opaque, prelude::ReflectDefault, ReflectDeserialize, Re
|
|||||||
impl_reflect_opaque!(::petgraph::graph::NodeIndex(
|
impl_reflect_opaque!(::petgraph::graph::NodeIndex(
|
||||||
Clone,
|
Clone,
|
||||||
Default,
|
Default,
|
||||||
|
PartialEq,
|
||||||
|
Hash,
|
||||||
Serialize,
|
Serialize,
|
||||||
Deserialize
|
Deserialize
|
||||||
));
|
));
|
||||||
|
Loading…
Reference in New Issue
Block a user