Skip to content

Commit

Permalink
improve panic message if not running on render app
Browse files Browse the repository at this point in the history
  • Loading branch information
IceSentry committed Apr 4, 2023
1 parent 684cb18 commit 7bc7a48
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions crates/bevy_render/src/render_graph/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,24 @@ impl RenderGraphApp for App {
node_name: &'static str,
) -> &mut Self {
let node = T::from_world(&mut self.world);
let mut render_graph = self.world.resource_mut::<RenderGraph>();
let mut render_graph = self.world.get_resource_mut::<RenderGraph>().expect(
"RenderGraph not found. Make sure you are using add_render_graph_node on the RenderApp",
);

let graph = render_graph.get_sub_graph_mut(sub_graph_name).unwrap();
let graph = render_graph.sub_graph_mut(sub_graph_name);
graph.add_node(node_name, node);
self
}

fn add_render_graph_edges(
&mut self,
sub_graph_name: &'static str,
edges: &[&'static str],
) -> &mut Self {
let mut render_graph = self.world.resource_mut::<RenderGraph>();
let graph = render_graph.get_sub_graph_mut(sub_graph_name).unwrap();
let mut render_graph = self.world.get_resource_mut::<RenderGraph>().expect(
"RenderGraph not found. Make sure you are using add_render_graph_node on the RenderApp",
);
let graph = render_graph.sub_graph_mut(sub_graph_name);
graph.add_node_edges(edges);
self
}
Expand Down

0 comments on commit 7bc7a48

Please sign in to comment.