From 634deadc1fdc7b4d11d6eaec3b835a08725a4875 Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Wed, 13 May 2026 02:55:34 +0200 Subject: [PATCH] Add validation for scene path road edge settings --- src/document/scene-document-validation.ts | 77 +++++++++++++++++++++++ 1 file changed, 77 insertions(+) diff --git a/src/document/scene-document-validation.ts b/src/document/scene-document-validation.ts index ae640fcc..4136c867 100644 --- a/src/document/scene-document-validation.ts +++ b/src/document/scene-document-validation.ts @@ -2650,6 +2650,83 @@ function validateEntityName( } } +function validateScenePathRoadEdge( + edge: ScenePathRoadEdgeSettings, + path: string, + document: SceneDocument, + diagnostics: SceneDiagnostic[] +) { + if (!isBoolean(edge.enabled)) { + diagnostics.push( + createDiagnostic( + "error", + "invalid-path-road-edge-enabled", + "Path road edge enabled must remain a boolean.", + `${path}.enabled` + ) + ); + } + + if (!isScenePathRoadEdgeKind(edge.kind)) { + diagnostics.push( + createDiagnostic( + "error", + "invalid-path-road-edge-kind", + "Path road edge kind must be curb, softShoulder, bank, or ditch.", + `${path}.kind` + ) + ); + } + + if ( + !isFiniteNumberInRange( + edge.width, + MIN_SCENE_PATH_ROAD_EDGE_WIDTH, + MAX_SCENE_PATH_ROAD_EDGE_WIDTH + ) + ) { + diagnostics.push( + createDiagnostic( + "error", + "invalid-path-road-edge-width", + `Path road edge width must be from ${MIN_SCENE_PATH_ROAD_EDGE_WIDTH} to ${MAX_SCENE_PATH_ROAD_EDGE_WIDTH}.`, + `${path}.width` + ) + ); + } + + if ( + !isFiniteNumberInRange( + edge.height, + MIN_SCENE_PATH_ROAD_EDGE_HEIGHT, + MAX_SCENE_PATH_ROAD_EDGE_HEIGHT + ) + ) { + diagnostics.push( + createDiagnostic( + "error", + "invalid-path-road-edge-height", + `Path road edge height must be from ${MIN_SCENE_PATH_ROAD_EDGE_HEIGHT} to ${MAX_SCENE_PATH_ROAD_EDGE_HEIGHT}.`, + `${path}.height` + ) + ); + } + + if ( + edge.materialId !== null && + document.materials[edge.materialId] === undefined + ) { + diagnostics.push( + createDiagnostic( + "error", + "invalid-path-road-edge-material", + `Path road edge material reference ${edge.materialId} does not exist in the document material registry.`, + `${path}.materialId` + ) + ); + } +} + function validateScenePath( pathValue: ScenePath, path: string,