Support terrain selection in viewport host

This commit is contained in:
2026-04-18 19:52:49 +02:00
parent 5272a7ec9a
commit 2fe8266862

View File

@@ -7003,6 +7003,8 @@ export class ViewportHost {
return `brushEdge:${selection.brushId}:${selection.edgeId}`;
case "brushVertex":
return `brushVertex:${selection.brushId}:${selection.vertexId}`;
case "terrains":
return selection.ids.length === 1 ? `terrain:${selection.ids[0]}` : null;
case "paths":
return selection.ids.length === 1 ? `path:${selection.ids[0]}` : null;
case "pathPoint":
@@ -7033,6 +7035,14 @@ export class ViewportHost {
const pathId = hit.object.userData.pathId;
const pathPointId = hit.object.userData.pathPointId;
const terrainId = hit.object.userData.terrainId;
if (typeof terrainId === "string") {
return {
kind: "terrains",
ids: [terrainId]
};
}
if (typeof pathId === "string" && typeof pathPointId === "string") {
return {
kind: "pathPoint",
@@ -7130,6 +7140,9 @@ export class ViewportHost {
renderObjects.line,
...renderObjects.pointMeshes.map((pointMesh) => pointMesh.mesh)
]).flat(),
...Array.from(this.terrainRenderObjects.values(), (renderObjects) =>
renderObjects.mesh
),
...Array.from(this.modelRenderObjects.values()),
...this.getBrushPickableObjects()
],