Add brush validation diagnostics
CI / Format, lint, test, build (push) Waiting to run

This commit is contained in:
Rbanh committed 2026-06-06 06:14:00 -04:00
1 parent d847706b8f
commit 4dc22cd3b6
5 files changed
+213 -3

No files matched your search

+12 -2
View File
@@ -7,8 +7,8 @@ use bevy::mesh::{Indices, PrimitiveTopology};
use bevy::prelude::*;
use crate::{
inspector_component_active, BrushDesc, BrushFaceDesc, ColliderDesc, InspectorOrder,
LevelObject, MaterialDesc, COMPONENT_BRUSH_DESC, COMPONENT_COLLIDER_DESC,
brush_math::validate_brush, inspector_component_active, BrushDesc, BrushFaceDesc, ColliderDesc,
InspectorOrder, LevelObject, MaterialDesc, COMPONENT_BRUSH_DESC, COMPONENT_COLLIDER_DESC,
COMPONENT_MATERIAL_DESC,
};
@@ -75,6 +75,16 @@ pub fn spawn_brush_mesh(
material: Option<&MaterialDesc>,
collider: Option<&ColliderDesc>,
) {
let report = validate_brush(brush);
if !report.is_valid() {
for diagnostic in report.diagnostics {
warn!(
"Brush hydration skipped invalid brush on {parent:?}: {}",
diagnostic.message
);
}
return;
}
let Some(mesh) = brush_mesh(brush) else {
warn!("Brush hydration skipped invalid brush on {parent:?}");
return;