keep track of type name in NodeState (#1444)

Adds the original type_name to `NodeState`, enabling plugins like [this](https://github.com/jakobhellermann/bevy_mod_debugdump).
This does increase the `NodeState` type by 16 bytes, but it is already 176 so it's not that big of an increase.
This commit is contained in:
Jakob Hellermann 2021-02-22 09:15:29 +00:00
parent a1ec684131
commit bc4fe9b186

View file

@ -112,6 +112,7 @@ impl Edges {
pub struct NodeState { pub struct NodeState {
pub id: NodeId, pub id: NodeId,
pub name: Option<Cow<'static, str>>, pub name: Option<Cow<'static, str>>,
pub type_name: &'static str,
pub node: Box<dyn Node>, pub node: Box<dyn Node>,
pub input_slots: ResourceSlots, pub input_slots: ResourceSlots,
pub output_slots: ResourceSlots, pub output_slots: ResourceSlots,
@ -135,6 +136,7 @@ impl NodeState {
input_slots: ResourceSlots::from(node.input()), input_slots: ResourceSlots::from(node.input()),
output_slots: ResourceSlots::from(node.output()), output_slots: ResourceSlots::from(node.output()),
node: Box::new(node), node: Box::new(node),
type_name: std::any::type_name::<T>(),
edges: Edges { edges: Edges {
id, id,
input_edges: Vec::new(), input_edges: Vec::new(),