Description
Bevy version
main branch
What you did
I'm trying to get my scripting integration to generate animations.
For this, I have to instantiate the AnimationPlayer component:
bevy/crates/bevy_animation/src/lib.rs
Lines 684 to 688 in 6a7fc9c
Note that this struct uses AnimationNodeIndex
as the key, which is reflected manually in this file:
bevy/crates/bevy_reflect/src/impls/petgraph.rs
Lines 3 to 8 in 6a7fc9c
What went wrong
When I create the DynamicMap for the DynamicStruct to recreate AnimationPlayer, I get the following panic:
thread 'render_task' panicked at /home/anlumo/bevy/crates/bevy_reflect/src/map.rs:323:9:
assertion `left == right` failed: keys inserted in `Map`-like types are expected to reflect `PartialEq`
left: None
right: Some(true)
The assert is located here:
bevy/crates/bevy_reflect/src/map.rs
Lines 323 to 327 in 6a7fc9c
This happens while inserting into the DynamicMap, and the debug print of the key inserted is Reflect(petgraph::graph::NodeIndex)
.
Additional information
AnimationNodeIndex maps to petgraph's NodeIndex<u32>
(as indicated in the debug output). This is just a newtype around u32, so PartialEq
would be trivial. However, I think the macro impl_reflect_opaque!
used in petgraph.rs might not add that one automatically.