Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion crates/bevy_gizmos/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ keywords = ["bevy"]
# Bevy
bevy_app = { path = "../bevy_app", version = "0.19.0-dev" }
bevy_camera = { path = "../bevy_camera", version = "0.19.0-dev" }
bevy_light = { path = "../bevy_light", version = "0.19.0-dev", optional = true }
bevy_color = { path = "../bevy_color", version = "0.19.0-dev" }
bevy_ecs = { path = "../bevy_ecs", version = "0.19.0-dev" }
bevy_math = { path = "../bevy_math", version = "0.19.0-dev" }
Expand Down
12 changes: 0 additions & 12 deletions crates/bevy_gizmos/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ pub mod primitives;
pub mod retained;
pub mod rounded_box;

#[cfg(feature = "bevy_light")]
pub mod light;

/// The gizmos prelude.
///
/// This includes the most common types in this crate, re-exported for your convenience.
Expand All @@ -58,10 +55,6 @@ pub mod prelude {
retained::Gizmo,
AppGizmoBuilder, GizmoAsset,
};

#[doc(hidden)]
#[cfg(feature = "bevy_light")]
pub use crate::light::{LightGizmoColor, LightGizmoConfigGroup, ShowLightGizmo};
}

use bevy_app::{App, FixedFirst, FixedLast, Last, Plugin, RunFixedMainLoop};
Expand All @@ -80,8 +73,6 @@ use bevy_utils::TypeIdMap;
use config::{DefaultGizmoConfigGroup, GizmoConfig, GizmoConfigGroup, GizmoConfigStore};
use core::{any::TypeId, marker::PhantomData, mem};
use gizmos::{GizmoStorage, Swap};
#[cfg(feature = "bevy_light")]
use light::LightGizmoPlugin;

/// A [`Plugin`] that provides an immediate mode drawing api for visual debugging.
#[derive(Default)]
Expand All @@ -95,9 +86,6 @@ impl Plugin for GizmoPlugin {
.init_gizmo_group::<DefaultGizmoConfigGroup>();

app.add_plugins((aabb::AabbGizmoPlugin, global::GlobalGizmosPlugin));

#[cfg(feature = "bevy_light")]
app.add_plugins(LightGizmoPlugin);
}
}

Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_internal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ bevy_winit = ["dep:bevy_winit", "bevy_window"]
bevy_camera = ["dep:bevy_camera", "bevy_mesh", "bevy_window"]
bevy_scene = ["dep:bevy_scene", "bevy_asset"]
bevy_material = ["dep:bevy_material", "bevy_image", "bevy_shader"]
bevy_light = ["dep:bevy_light", "bevy_camera", "bevy_gizmos?/bevy_light"]
bevy_light = ["dep:bevy_light", "bevy_camera"]
bevy_render = [
"dep:bevy_render",
"bevy_camera",
Expand All @@ -257,7 +257,7 @@ bevy_sprite_render = [
]
bevy_ui_render = ["dep:bevy_ui_render", "bevy_sprite_render", "bevy_ui"]
bevy_solari = ["dep:bevy_solari", "bevy_pbr"]
bevy_gizmos = ["dep:bevy_gizmos", "bevy_camera"]
bevy_gizmos = ["dep:bevy_gizmos", "bevy_camera", "bevy_light?/bevy_gizmos"]
bevy_gizmos_render = ["dep:bevy_gizmos_render", "bevy_gizmos"]
bevy_gltf = ["dep:bevy_gltf", "bevy_scene", "bevy_pbr"]

Expand Down
1 change: 1 addition & 0 deletions crates/bevy_light/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ bevy_platform = { path = "../bevy_platform", version = "0.19.0-dev" }
bevy_color = { path = "../bevy_color", version = "0.19.0-dev", features = [
"serialize",
] }
bevy_gizmos = { path = "../bevy_gizmos", version = "0.19.0-dev", optional = true }

# other
tracing = { version = "0.1", default-features = false }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

use core::f32::consts::PI;

use crate::primitives::dim3::GizmoPrimitive3d;
use bevy_gizmos::primitives::dim3::GizmoPrimitive3d;

use crate::{DirectionalLight, PointLight, SpotLight};
use bevy_app::{Plugin, PostUpdate};
use bevy_color::{
palettes::basic::{BLUE, GREEN, RED},
Expand All @@ -17,7 +18,6 @@ use bevy_ecs::{
schedule::IntoScheduleConfigs,
system::{Query, Res},
};
use bevy_light::{DirectionalLight, PointLight, SpotLight};
use bevy_math::{
ops,
primitives::{Cone, Sphere},
Expand All @@ -26,7 +26,7 @@ use bevy_math::{
use bevy_reflect::{std_traits::ReflectDefault, Reflect};
use bevy_transform::{components::GlobalTransform, TransformSystems};

use crate::{
use bevy_gizmos::{
config::{GizmoConfigGroup, GizmoConfigStore},
gizmos::Gizmos,
AppGizmoBuilder,
Expand Down
9 changes: 9 additions & 0 deletions crates/bevy_light/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ pub use directional_light::{
update_directional_light_frusta, DirectionalLight, DirectionalLightShadowMap,
DirectionalLightTexture, SunDisk,
};
#[cfg(feature = "bevy_gizmos")]
pub mod gizmos;

/// The light prelude.
///
Expand All @@ -62,6 +64,10 @@ pub mod prelude {
light_consts, AmbientLight, DirectionalLight, EnvironmentMapLight,
GeneratedEnvironmentMapLight, GlobalAmbientLight, LightProbe, PointLight, SpotLight,
};

#[doc(hidden)]
#[cfg(feature = "bevy_gizmos")]
pub use crate::gizmos::{LightGizmoColor, LightGizmoConfigGroup, ShowLightGizmo};
}

use crate::directional_light::validate_shadow_map_size;
Expand Down Expand Up @@ -201,6 +207,9 @@ impl Plugin for LightPlugin {
.after(clear_directional_light_cascades),
),
);

#[cfg(feature = "bevy_gizmos")]
app.add_plugins(gizmos::LightGizmoPlugin);
Copy link
Contributor

@mgi388 mgi388 Jan 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just want to note that previously the order of plugins being added was:

  • DefaultPlugins
    • adds LightPlugin
    • adds GizmoPlugin
      • adds LightGizmoPlugin

Now it is:

  • DefaultPlugins
    • adds LightPlugin
      • adds LightGizmoPlugin
    • adds GizmoPlugin

From looking at the plugins I cannot see any dependency that would cause an issue so I think this is fine, just wanted to note.

I suppose technically if GizmoPlugin is more of a "provides gizmo functionality and primitives", I'd probably expect that it be registered before LightPlugin (and before an imaginary AudioPlugin that also provides gizmos via AudioGizmoPlugin), but again, not sure that there's any issue right now so probably fine to leave as is.

Alternatively, inside LightGizmoPlugin you could add the GizmoPlugin if it's not already added. This comment speaks to a user who is using bevy_light directly but not bevy (and therefore not bevy_internal)—will their light gizmos work if they don't add GizmoPlugin themselves?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a case we don't cater for in general; there are many many crates that depend on other crates but dont add the plugins. This is because plugin ordering gets very gnarly if you do this - its not actually the case that if plugin A depends on another plugin B that means B must be added before A, look at the web assets plugin for example, among others.

If a user is not using DefaultPlugins, they're doing something highly custom and are a fringe user, and "doing stuff for them" is not something they care about, especially if it can get in their way imo. They can add the plugin manually and order them however they like manually, and test to make sure it works for them in whatever they're doing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The other half of it is its just hard to do that, you'd need to be checking if a plugin is already added before adding it in every place and also have gates for this in the DefaultPlugins, and you'll need to have the crates somehow know that both are being used without having a parent crate (bevy_internal) to propagate features between them so they know.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That all makes sense. Thanks for the consideration and thoughts. Mostly just wanted to call out the plug-in order was different just in case, but seems a non issue.

}
}

Expand Down
6 changes: 6 additions & 0 deletions release-content/migration-guides/gizmos-lights.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
title: "Light gizmos have been moved from `bevy_gizmos` to `bevy_light`"
pull_requests: [22583]
---

If you were importing `LightGizmoPlugin`, `LightGizmoColor`, `LightGizmoConfigGroup`, or `ShowLightGizmo` from `bevy_gizmos::light`, they have been moved to live in `bevy_light` now.