From fcb49a5d8047aaa16d5ea8f9eefd5ec9da98c930 Mon Sep 17 00:00:00 2001 From: Nicola Papale Date: Fri, 22 Dec 2023 00:29:43 +0100 Subject: [PATCH] Document None conditions on compute_aabb (#11051) The error conditions were not documented, this requires the user to inspect the source code to know when to expect a `None`. Error conditions should always be documented, so we document them. --------- Co-authored-by: Alice Cecile --- crates/bevy_render/src/mesh/mesh/mod.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/crates/bevy_render/src/mesh/mesh/mod.rs b/crates/bevy_render/src/mesh/mesh/mod.rs index 12713ce23b..84ff716c01 100644 --- a/crates/bevy_render/src/mesh/mesh/mod.rs +++ b/crates/bevy_render/src/mesh/mesh/mod.rs @@ -566,6 +566,9 @@ impl Mesh { } /// Compute the Axis-Aligned Bounding Box of the mesh vertices in model space + /// + /// Returns `None` if `self` doesn't have [`Mesh::ATTRIBUTE_POSITION`] of + /// type [`VertexAttributeValues::Float32x3`], or if `self` doesn't have any vertices. pub fn compute_aabb(&self) -> Option { let Some(VertexAttributeValues::Float32x3(values)) = self.attribute(Mesh::ATTRIBUTE_POSITION)