Skip to content

Commit

Permalink
Use app.world_mut() or .world() instead of .world
Browse files Browse the repository at this point in the history
Addresses Bevy [9202](bevyengine/bevy#9202)
  • Loading branch information
zhaop committed Jun 24, 2024
1 parent 2c7494d commit 8f82324
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions crates/bevy_editor_pls/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ impl Plugin for EditorPlugin {
if window.title == "Bevy App" {
window.title = "bevy_editor_pls".into();
}
let entity = app.world.spawn(window);
let entity = app.world_mut().spawn(window);
WindowRef::Entity(entity.id())
}
EditorWindowPlacement::Window(entity) => WindowRef::Entity(entity),
Expand Down Expand Up @@ -136,7 +136,7 @@ impl Plugin for EditorPlugin {
app.insert_resource(controls::EditorControls::default_bindings())
.add_systems(Update, controls::editor_controls_system);

let mut internal_state = app.world.resource_mut::<editor::EditorInternalState>();
let mut internal_state = app.world_mut().resource_mut::<editor::EditorInternalState>();

let [game, _inspector] =
internal_state.split_right::<InspectorWindow>(egui_dock::NodeIndex::root(), 0.75);
Expand Down
6 changes: 3 additions & 3 deletions crates/bevy_editor_pls_core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ impl<W: EditorWindow> Plugin for WindowSetupPlugin<W> {

impl AddEditorWindow for App {
fn add_editor_window<W: EditorWindow>(&mut self) -> &mut Self {
let mut editor = self.world.get_resource_mut::<Editor>().expect("Editor resource missing. Make sure to add the `EditorPlugin` before calling `app.add_editor_window`.");
let mut editor = self.world_mut().get_resource_mut::<Editor>().expect("Editor resource missing. Make sure to add the `EditorPlugin` before calling `app.add_editor_window`.");
editor.add_window::<W>();

self.add_plugins(WindowSetupPlugin::<W>(PhantomData));
Expand Down Expand Up @@ -69,9 +69,9 @@ impl Plugin for EditorPlugin {
let (window_entity, always_active) = match self.window {
WindowRef::Primary => {
let entity = app
.world
.world_mut()
.query_filtered::<Entity, With<PrimaryWindow>>()
.single(&app.world);
.single(&app.world());
(entity, false)
}
WindowRef::Entity(entity) => (entity, true),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub fn setup(app: &mut App) {
return;
}
};
let render_graph = render_app.world.get_resource::<RenderGraph>().unwrap();
let render_graph = render_app.world().get_resource::<RenderGraph>().unwrap();

let schedule_settings = schedule_graph::settings::Settings {
include_system: Some(Box::new(|system| {
Expand All @@ -35,18 +35,18 @@ pub fn setup(app: &mut App) {
let rendergraph_settings = render_graph::settings::Settings::default();

let update_schedule = app.get_schedule(Update).map(|schedule| {
schedule_graph::schedule_graph_dot(schedule, &app.world, &schedule_settings)
schedule_graph::schedule_graph_dot(schedule, &app.world(), &schedule_settings)
});

let fixed_update_schedule = app.get_schedule(FixedUpdate).map(|schedule| {
schedule_graph::schedule_graph_dot(schedule, &app.world, &schedule_settings)
schedule_graph::schedule_graph_dot(schedule, &app.world(), &schedule_settings)
});

let render_main_schedule = render_app.get_schedule(Render).map(|schedule| {
schedule_graph::schedule_graph_dot(schedule, &app.world, &schedule_settings)
schedule_graph::schedule_graph_dot(schedule, &app.world(), &schedule_settings)
});
let render_extract_schedule = render_app.get_schedule(ExtractSchedule).map(|schedule| {
schedule_graph::schedule_graph_dot(schedule, &app.world, &schedule_settings)
schedule_graph::schedule_graph_dot(schedule, &app.world(), &schedule_settings)
});

let render_graph = render_graph::render_graph_dot(render_graph, &rendergraph_settings);
Expand Down
6 changes: 3 additions & 3 deletions crates/bevy_editor_pls_default_windows/src/gizmos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ impl EditorWindow for GizmoWindow {
}

fn app_setup(app: &mut App) {
let mut materials = app.world.resource_mut::<Assets<StandardMaterial>>();
let mut materials = app.world_mut().resource_mut::<Assets<StandardMaterial>>();
let material_light = materials.add(StandardMaterial {
base_color: Color::rgba_u8(222, 208, 103, 255),
unlit: true,
Expand All @@ -133,10 +133,10 @@ impl EditorWindow for GizmoWindow {
..default()
});

let mut meshes = app.world.resource_mut::<Assets<Mesh>>();
let mut meshes = app.world_mut().resource_mut::<Assets<Mesh>>();
let sphere = meshes.add(Sphere { radius: 0.3 });

app.world.insert_resource(GizmoMarkerConfig {
app.world_mut().insert_resource(GizmoMarkerConfig {
point_light_mesh: sphere.clone(),
point_light_material: material_light.clone(),
directional_light_mesh: sphere.clone(),
Expand Down

0 comments on commit 8f82324

Please sign in to comment.