Skip to content

Commit 6b34012

Browse files
authored
Rename cuboid to cube (#21393)
# Objective - Gizmos::cuboid is for drawing cubes, even the docs say so. A cuboid drawing function should take Cuboid as input. ## Solution - Rename ::cuboid to ::cube, making way for an actual cuboid drawing function. ## Testing - ci
1 parent b7a90ae commit 6b34012

File tree

6 files changed

+12
-6
lines changed

6 files changed

+12
-6
lines changed

crates/bevy_gizmos/src/gizmos.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -588,12 +588,12 @@ where
588588
/// # use bevy_transform::prelude::*;
589589
/// # use bevy_color::palettes::basic::GREEN;
590590
/// fn system(mut gizmos: Gizmos) {
591-
/// gizmos.cuboid(Transform::IDENTITY, GREEN);
591+
/// gizmos.cube(Transform::IDENTITY, GREEN);
592592
/// }
593593
/// # bevy_ecs::system::assert_is_system(system);
594594
/// ```
595595
#[inline]
596-
pub fn cuboid(&mut self, transform: impl TransformPoint, color: impl Into<Color>) {
596+
pub fn cube(&mut self, transform: impl TransformPoint, color: impl Into<Color>) {
597597
let polymorphic_color: Color = color.into();
598598
if !self.enabled {
599599
return;

crates/bevy_gizmos/src/rounded_box.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ where
185185
let transform = Transform::from_translation(config.isometry.translation.into())
186186
.with_rotation(config.isometry.rotation)
187187
.with_scale(self.size);
188-
self.gizmos.cuboid(transform, config.color);
188+
self.gizmos.cube(transform, config.color);
189189
return;
190190
}
191191

examples/3d/irradiance_volumes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@ fn draw_gizmo(
601601
) {
602602
if app_status.voxels_visible {
603603
for transform in irradiance_volume_query.iter() {
604-
gizmos.cuboid(*transform, GIZMO_COLOR);
604+
gizmos.cube(*transform, GIZMO_COLOR);
605605
}
606606
}
607607
}

examples/gizmos/3d_gizmos.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ fn draw_example_collection(
130130
.cell_count(UVec2::new(5, 10))
131131
.spacing(Vec2::new(0.2, 0.1));
132132

133-
gizmos.cuboid(
133+
gizmos.cube(
134134
Transform::from_translation(Vec3::Y * 0.5).with_scale(Vec3::splat(1.25)),
135135
BLACK,
136136
);

examples/testbed/3d.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ mod gizmos {
318318
}
319319

320320
pub fn draw_gizmos(mut gizmos: Gizmos) {
321-
gizmos.cuboid(
321+
gizmos.cube(
322322
Transform::from_translation(Vec3::X * -1.75).with_scale(Vec3::splat(1.25)),
323323
RED,
324324
);
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
title: "`Gizmos::cuboid` has been renamed to `Gizmos::cube`"
3+
pull_requests: [21393]
4+
---
5+
6+
`Gizmos::cuboid` was renamed to `Gizmos::cube`.

0 commit comments

Comments
 (0)