diff --git a/src/runtime-three/runtime-scene-build.ts b/src/runtime-three/runtime-scene-build.ts index f215fc27..fe91466b 100644 --- a/src/runtime-three/runtime-scene-build.ts +++ b/src/runtime-three/runtime-scene-build.ts @@ -49,7 +49,10 @@ import { type WhiteboxVertexId, type FaceUvState } from "../document/brushes"; -import type { ProjectDocument, SceneDocument } from "../document/scene-document"; +import type { + ProjectDocument, + SceneDocument +} from "../document/scene-document"; import { cloneProjectTimeSettings, type ProjectTimeSettings @@ -761,9 +764,7 @@ function buildRuntimePlayerMovement( jump: clonePlayerStartJumpSettings(resolvedTemplate.jump), sprint: clonePlayerStartSprintSettings(resolvedTemplate.sprint), crouch: clonePlayerStartCrouchSettings(resolvedTemplate.crouch), - edgeAssist: clonePlayerStartEdgeAssistSettings( - resolvedTemplate.edgeAssist - ) + edgeAssist: clonePlayerStartEdgeAssistSettings(resolvedTemplate.edgeAssist) }; } @@ -1196,7 +1197,9 @@ function combineColliderBounds( }; } -function getRuntimeTerrainSceneBounds(terrain: RuntimeTerrain): RuntimeSceneBounds { +function getRuntimeTerrainSceneBounds( + terrain: RuntimeTerrain +): RuntimeSceneBounds { const bounds = getTerrainBounds({ ...terrain, kind: "terrain", @@ -1397,9 +1400,7 @@ function buildRuntimeControlSurface( capabilities.push("actorPathFollow"); } - targets.push( - createControlTargetDescriptor(target, capabilities) - ); + targets.push(createControlTargetDescriptor(target, capabilities)); resolved.discrete.push( createResolvedActorAnimationPlaybackState({ target, @@ -1559,7 +1560,9 @@ function buildRuntimeControlSurface( authoredModelInstance === undefined ? undefined : document.assets[authoredModelInstance.assetId]; - const target = createModelInstanceControlTargetRef(modelInstance.instanceId); + const target = createModelInstanceControlTargetRef( + modelInstance.instanceId + ); const hasAnimationPlayback = asset !== undefined && asset.kind === "model" && @@ -2013,7 +2016,9 @@ export function buildRuntimeSceneFromDocument( case "stopSound": return enabledEntityIds.has(link.action.targetSoundEmitterId); case "runSequence": - return getInteractionLinkImpulseSteps(link, document.sequences).length > 0; + return ( + getInteractionLinkImpulseSteps(link, document.sequences).length > 0 + ); case "control": switch (link.action.effect.target.kind) { case "entity": diff --git a/src/viewport-three/transform-surface-snap.ts b/src/viewport-three/transform-surface-snap.ts index 2728ce80..bc030ba1 100644 --- a/src/viewport-three/transform-surface-snap.ts +++ b/src/viewport-three/transform-surface-snap.ts @@ -1,10 +1,4 @@ -import { - Euler, - Matrix3, - Quaternion, - Vector3, - type Object3D -} from "three"; +import { Euler, Matrix3, Quaternion, Vector3, type Object3D } from "three"; import type { ProjectAssetBoundingBox } from "../assets/project-assets"; import type { TransformPreview } from "../core/transform-session"; diff --git a/src/viewport-three/viewport-host.ts b/src/viewport-three/viewport-host.ts index 30223e0c..50cd7d46 100644 --- a/src/viewport-three/viewport-host.ts +++ b/src/viewport-three/viewport-host.ts @@ -441,8 +441,7 @@ function isTerrainFoliageMaskTool( tool: TerrainBrushTool | null | undefined ): boolean { return ( - isTerrainFoliageLayerMaskTool(tool) || - isTerrainFoliageBlockerMaskTool(tool) + isTerrainFoliageLayerMaskTool(tool) || isTerrainFoliageBlockerMaskTool(tool) ); } @@ -1265,9 +1264,8 @@ export class ViewportHost { versionInfo?.frameVersion ?? this.currentSimulationFrameVersion + 1; this.currentSimulationMembershipSignatures = createViewportSimulationMembershipSignatures(runtimeScene); - this.simulationActiveNpcEntityIds = this.collectActiveSimulationNpcEntityIds( - runtimeScene - ); + this.simulationActiveNpcEntityIds = + this.collectActiveSimulationNpcEntityIds(runtimeScene); this.simulationSceneIdentityMismatchWarned = false; this.simulationInteractableEnabledById.clear(); this.cacheSimulationInteractableEnabledState(runtimeScene); @@ -1384,11 +1382,15 @@ export class ViewportHost { return nextTerrainIds.every( (terrainId) => - previousDocument.terrains[terrainId] === nextDocument.terrains[terrainId] + previousDocument.terrains[terrainId] === + nextDocument.terrains[terrainId] ); } - updateSelection(selection: EditorSelection, activeSelectionId: string | null) { + updateSelection( + selection: EditorSelection, + activeSelectionId: string | null + ) { const previousSelection = this.currentSelection; const selectionChanged = !areEditorSelectionsEqual( previousSelection, @@ -1721,7 +1723,12 @@ export class ViewportHost { this.cancelActiveTerrainBrushStroke(false); } - if (terrainChanged || toolChanged || layerChanged || terrainBrushState === null) { + if ( + terrainChanged || + toolChanged || + layerChanged || + terrainBrushState === null + ) { this.rebuildDisplayedTerrainState(); } @@ -1855,8 +1862,7 @@ export class ViewportHost { const fitZoom = Math.min(visibleWidth, ORTHOGRAPHIC_FRUSTUM_HEIGHT) / fitSize; - this.orthographicCamera.zoom = - this.clampOrthographicCameraZoom(fitZoom); + this.orthographicCamera.zoom = this.clampOrthographicCameraZoom(fitZoom); this.applyOrthographicCameraPose(); this.emitCameraStateChange(); } @@ -1990,8 +1996,7 @@ export class ViewportHost { traceUpdateLoopEvent("ViewportHost.emitCameraStateChange", { panelId: this.panelId, - previousCameraState: - summarizeUpdateLoopCameraState(previousCameraState), + previousCameraState: summarizeUpdateLoopCameraState(previousCameraState), nextCameraState: summarizeUpdateLoopCameraState(nextCameraState), equalityGuardConsideredDifferent: previousCameraState === null ? null : !cameraStatesEqual, @@ -4089,18 +4094,18 @@ export class ViewportHost { return { kind: "entity" as const, - position: { - ...session.target.initialPosition - }, - rotation: { - kind: "yaw" as const, - yawDegrees: normalizeYawDegrees( - session.target.initialRotation.yawDegrees + pointerDeltaDegrees - ) - }, - scale: cloneEntityTransformScaleState(session.target.initialScale) - }; - } + position: { + ...session.target.initialPosition + }, + rotation: { + kind: "yaw" as const, + yawDegrees: normalizeYawDegrees( + session.target.initialRotation.yawDegrees + pointerDeltaDegrees + ) + }, + scale: cloneEntityTransformScaleState(session.target.initialScale) + }; + } if (session.target.initialRotation.kind === "direction") { const initialOrientation = new Quaternion().setFromUnitVectors( @@ -5358,9 +5363,15 @@ export class ViewportHost { }; if (axisConstraint === null) { - nextScale.x = this.snapScaleValue(item.initialScale.x * scaleFactor); - nextScale.y = this.snapScaleValue(item.initialScale.y * scaleFactor); - nextScale.z = this.snapScaleValue(item.initialScale.z * scaleFactor); + nextScale.x = this.snapScaleValue( + item.initialScale.x * scaleFactor + ); + nextScale.y = this.snapScaleValue( + item.initialScale.y * scaleFactor + ); + nextScale.z = this.snapScaleValue( + item.initialScale.z * scaleFactor + ); } else { const scaleAxis = resolveDominantLocalAxisForWorldAxis( item.initialRotationDegrees, @@ -6199,7 +6210,8 @@ export class ViewportHost { } for (const modelInstanceId of targetIds.modelInstanceIds) { - const modelInstance = this.currentDocument.modelInstances[modelInstanceId]; + const modelInstance = + this.currentDocument.modelInstances[modelInstanceId]; if (modelInstance === undefined) { continue; @@ -6698,9 +6710,8 @@ export class ViewportHost { return; } - const nextActiveNpcEntityIds = this.collectActiveSimulationNpcEntityIds( - runtimeScene - ); + const nextActiveNpcEntityIds = + this.collectActiveSimulationNpcEntityIds(runtimeScene); for (const runtimeNpc of runtimeScene.npcDefinitions) { const authoredEntity = this.currentDocument.entities[runtimeNpc.entityId]; @@ -6779,9 +6790,7 @@ export class ViewportHost { let addedRenderGroup = false; for (const modelInstance of runtimeScene.modelInstances) { - const renderGroup = this.modelRenderObjects.get( - modelInstance.instanceId - ); + const renderGroup = this.modelRenderObjects.get(modelInstance.instanceId); if (renderGroup === undefined) { const displayedModelInstance = this.getDisplayedModelInstanceById( @@ -7005,7 +7014,9 @@ export class ViewportHost { return this.currentDocument.materials[materialId] ?? null; } - private getTerrainFoliageMaskPreviewLayerId(terrainId: string): string | null { + private getTerrainFoliageMaskPreviewLayerId( + terrainId: string + ): string | null { const brushState = this.currentTerrainBrushState; if (brushState === null || brushState.terrainId !== terrainId) { @@ -7022,9 +7033,7 @@ export class ViewportHost { return brushState.foliageLayerId; } - private isTerrainFoliageBlockerMaskPreviewActive( - terrainId: string - ): boolean { + private isTerrainFoliageBlockerMaskPreviewActive(terrainId: string): boolean { return ( this.currentTerrainBrushState !== null && this.currentTerrainBrushState.terrainId === terrainId && @@ -7084,12 +7093,14 @@ export class ViewportHost { return createTerrainLayerBlendMaterial({ layerTextures, - foliageMaskPreviewColorHex: - this.getTerrainFoliageMaskPreviewColor(terrain.id), - foliageMaskPreviewOpacity: - !this.isTerrainFoliageMaskPreviewActive(terrain.id) - ? 0 - : 0.62, + foliageMaskPreviewColorHex: this.getTerrainFoliageMaskPreviewColor( + terrain.id + ), + foliageMaskPreviewOpacity: !this.isTerrainFoliageMaskPreviewActive( + terrain.id + ) + ? 0 + : 0.62, emissiveHex: active ? TERRAIN_ACTIVE_EMISSIVE : selected @@ -7106,17 +7117,21 @@ export class ViewportHost { const selected = isTerrainSelected(this.currentSelection, terrain.id); const hovered = isTerrainSelected(this.hoveredSelection, terrain.id); const layerColors = terrain.layers.map((layer) => - getTerrainLayerPreviewColor(this.resolveTerrainLayerMaterial(layer.materialId)) + getTerrainLayerPreviewColor( + this.resolveTerrainLayerMaterial(layer.materialId) + ) ) as [number, number, number, number]; return createTerrainLayerColorBlendMaterial({ layerColors, - foliageMaskPreviewColorHex: - this.getTerrainFoliageMaskPreviewColor(terrain.id), - foliageMaskPreviewOpacity: - !this.isTerrainFoliageMaskPreviewActive(terrain.id) - ? 0 - : 0.62, + foliageMaskPreviewColorHex: this.getTerrainFoliageMaskPreviewColor( + terrain.id + ), + foliageMaskPreviewOpacity: !this.isTerrainFoliageMaskPreviewActive( + terrain.id + ) + ? 0 + : 0.62, emissiveHex: active ? TERRAIN_ACTIVE_EMISSIVE : selected @@ -7201,7 +7216,11 @@ export class ViewportHost { foliageMaskLayerId: this.getTerrainFoliageMaskPreviewLayerId(terrain.id) }); - group.position.set(terrain.position.x, terrain.position.y, terrain.position.z); + group.position.set( + terrain.position.x, + terrain.position.y, + terrain.position.z + ); for (const chunk of lodMeshData.chunks) { const levelGeometries = chunk.levels.map((level) => level.geometry); @@ -7321,7 +7340,10 @@ export class ViewportHost { continue; } - this.refreshDisplayedTerrainDirtyBounds(terrain.id, dirtyState.dirtyBounds); + this.refreshDisplayedTerrainDirtyBounds( + terrain.id, + dirtyState.dirtyBounds + ); } } @@ -8601,7 +8623,11 @@ export class ViewportHost { selected, previewShellColor ?? (selected ? NPC_SELECTED_COLOR : NPC_COLOR) ); - renderObjects.group.scale.set(entity.scale.x, entity.scale.y, entity.scale.z); + renderObjects.group.scale.set( + entity.scale.x, + entity.scale.y, + entity.scale.z + ); return renderObjects; } @@ -9695,15 +9721,16 @@ export class ViewportHost { this.createFaceMaterial( brush, faceId, - this.currentDocument?.materials[ - brush.faces[faceId].materialId ?? "" - ], + this.currentDocument?.materials[brush.faces[faceId].materialId ?? ""], this.getFaceHighlightState(brush.id, faceId), volumeRenderPaths, contactPatches ) ); - this.configureFogVolumeMesh(renderObjects.mesh, renderObjects.mesh.material); + this.configureFogVolumeMesh( + renderObjects.mesh, + renderObjects.mesh.material + ); applyRendererRenderCategoryFromMaterial(renderObjects.mesh); this.disposeUniqueMaterials(previousMaterials); @@ -9778,11 +9805,13 @@ export class ViewportHost { return; } - const displayedTerrain = this.getDisplayedTerrainState(terrainId) ?? terrain; + const displayedTerrain = + this.getDisplayedTerrainState(terrainId) ?? terrain; const previousDetailMaterial = renderObjects.detailMaterial; const previousDistantMaterial = renderObjects.distantMaterial; const nextDetailMaterial = this.createTerrainMaterial(displayedTerrain); - const nextDistantMaterial = this.createTerrainDistantMaterial(displayedTerrain); + const nextDistantMaterial = + this.createTerrainDistantMaterial(displayedTerrain); for (const chunk of renderObjects.chunks) { chunk.mesh.material = @@ -9884,8 +9913,9 @@ export class ViewportHost { chunk.startSampleZ, undefined, { - foliageMaskLayerId: - this.getTerrainFoliageMaskPreviewLayerId(terrain.id) + foliageMaskLayerId: this.getTerrainFoliageMaskPreviewLayerId( + terrain.id + ) } ); @@ -10179,8 +10209,8 @@ export class ViewportHost { layerIndex: toolState.tool === "paint" ? toolState.layerIndex : null, foliageLayerId: toolState.tool === "foliagePaint" || toolState.tool === "foliageErase" - ? toolState.foliageLayerId - : null + ? toolState.foliageLayerId + : null }); } @@ -10233,7 +10263,9 @@ export class ViewportHost { const foliageBlockerMaskValueIndices = new Set(); let lastAppliedPoint = from; const stepCount = Math.floor(distance / spacing); - const mergeDirtyBounds = (nextBounds: TerrainBrushDirtySampleBounds | null) => { + const mergeDirtyBounds = ( + nextBounds: TerrainBrushDirtySampleBounds | null + ) => { if (nextBounds === null) { return; } @@ -10457,8 +10489,7 @@ export class ViewportHost { ); this.activeTerrainBrushStroke = { ...this.activeTerrainBrushStroke, - changed: - this.activeTerrainBrushStroke.changed || segmentResult.changed, + changed: this.activeTerrainBrushStroke.changed || segmentResult.changed, dirtyBounds: this.mergeTerrainBrushDirtyBounds( this.activeTerrainBrushStroke.dirtyBounds, segmentResult.dirtyBounds @@ -10514,17 +10545,15 @@ export class ViewportHost { const foliageBlockerMaskValueIndices = new Set( activeStroke.foliageBlockerMaskValueIndices ); - const mergeStampIndices = ( - result: { - heightSampleIndices: readonly number[]; - paintWeightIndices: readonly number[]; - foliageMaskValueIndices?: ReturnType< - typeof applyTerrainBrushStampInPlace - >["foliageMaskValueIndices"]; - foliageMaskValueKeys?: readonly string[]; - foliageBlockerMaskValueIndices?: readonly number[]; - } - ) => { + const mergeStampIndices = (result: { + heightSampleIndices: readonly number[]; + paintWeightIndices: readonly number[]; + foliageMaskValueIndices?: ReturnType< + typeof applyTerrainBrushStampInPlace + >["foliageMaskValueIndices"]; + foliageMaskValueKeys?: readonly string[]; + foliageBlockerMaskValueIndices?: readonly number[]; + }) => { for (const sampleIndex of result.heightSampleIndices) { heightSampleIndices.add(sampleIndex); } @@ -10533,7 +10562,8 @@ export class ViewportHost { paintWeightIndices.add(paintWeightIndex); } - for (const foliageMaskValueIndex of result.foliageMaskValueIndices ?? []) { + for (const foliageMaskValueIndex of result.foliageMaskValueIndices ?? + []) { foliageMaskValueKeys.add( createTerrainFoliageMaskValueKey( foliageMaskValueIndex.layerId, diff --git a/tests/domain/runtime-interaction-system.test.ts b/tests/domain/runtime-interaction-system.test.ts index df2f71dd..b652805a 100644 --- a/tests/domain/runtime-interaction-system.test.ts +++ b/tests/domain/runtime-interaction-system.test.ts @@ -159,7 +159,7 @@ function createRuntimeSceneFixture(): RuntimeSceneDefinition { prompt: "Disabled Prompt", interactionEnabled: false } - ], + ] }, interactionLinks: [], control: createEmptyRuntimeControlSurfaceDefinition(), @@ -288,7 +288,7 @@ describe("RuntimeInteractionSystem", () => { playAnimation: () => {}, stopAnimation: () => {}, playSound: () => {}, - stopSound: () => {}, + stopSound: () => {} } ); interactionSystem.updatePlayerPosition( @@ -309,7 +309,7 @@ describe("RuntimeInteractionSystem", () => { playAnimation: () => {}, stopAnimation: () => {}, playSound: () => {}, - stopSound: () => {}, + stopSound: () => {} } ); @@ -423,7 +423,7 @@ describe("RuntimeInteractionSystem", () => { dispatches.push(`${link.id}:${instanceId}`); }, playSound: () => {}, - stopSound: () => {}, + stopSound: () => {} } ); @@ -462,7 +462,9 @@ describe("RuntimeInteractionSystem", () => { throw new Error("Expected a camera rig entity control target."); } - dispatches.push(`${link.id}:${effect.type}:${effect.target.entityId}`); + dispatches.push( + `${link.id}:${effect.type}:${effect.target.entityId}` + ); } }) ); @@ -480,7 +482,9 @@ describe("RuntimeInteractionSystem", () => { throw new Error("Expected a camera rig entity control target."); } - dispatches.push(`${link.id}:${effect.type}:${effect.target.entityId}`); + dispatches.push( + `${link.id}:${effect.type}:${effect.target.entityId}` + ); } }) ); @@ -515,7 +519,9 @@ describe("RuntimeInteractionSystem", () => { throw new Error("Expected a camera rig entity control target."); } - dispatches.push(`${link.id}:${effect.type}:${effect.target.entityId}`); + dispatches.push( + `${link.id}:${effect.type}:${effect.target.entityId}` + ); } }) ); @@ -564,7 +570,7 @@ describe("RuntimeInteractionSystem", () => { playAnimation: () => {}, stopAnimation: () => {}, playSound: () => {}, - stopSound: () => {}, + stopSound: () => {} } ); interactionSystem.updatePlayerPosition( @@ -590,7 +596,7 @@ describe("RuntimeInteractionSystem", () => { playAnimation: () => {}, stopAnimation: () => {}, playSound: () => {}, - stopSound: () => {}, + stopSound: () => {} } ); @@ -728,7 +734,7 @@ describe("RuntimeInteractionSystem", () => { playAnimation: () => {}, stopAnimation: () => {}, playSound: () => {}, - stopSound: () => {}, + stopSound: () => {} } ); @@ -779,7 +785,7 @@ describe("RuntimeInteractionSystem", () => { }, stopSound: (soundEmitterId, link) => { dispatches.push(`${link.id}:${soundEmitterId}`); - }, + } } ); @@ -1402,7 +1408,9 @@ describe("RuntimeInteractionSystem", () => { runtimeScene, { teleportPlayer: () => { - throw new Error("Teleport should not dispatch for a scene transition."); + throw new Error( + "Teleport should not dispatch for a scene transition." + ); }, startSceneTransition: (request) => { dispatches.push( @@ -1410,12 +1418,14 @@ describe("RuntimeInteractionSystem", () => { ); }, toggleBrushVisibility: () => { - throw new Error("Visibility should not dispatch for a scene transition."); + throw new Error( + "Visibility should not dispatch for a scene transition." + ); }, playAnimation: () => {}, stopAnimation: () => {}, playSound: () => {}, - stopSound: () => {}, + stopSound: () => {} } ); diff --git a/tests/domain/transform-session.command.test.ts b/tests/domain/transform-session.command.test.ts index 4fbc5287..ff996734 100644 --- a/tests/domain/transform-session.command.test.ts +++ b/tests/domain/transform-session.command.test.ts @@ -248,19 +248,25 @@ describe("transform session commit commands", () => { expect( supportsTransformOperation( - pathPointResolved.target as NonNullable, + pathPointResolved.target as NonNullable< + typeof pathPointResolved.target + >, "translate" ) ).toBe(true); expect( supportsTransformOperation( - pathPointResolved.target as NonNullable, + pathPointResolved.target as NonNullable< + typeof pathPointResolved.target + >, "rotate" ) ).toBe(false); expect( supportsTransformOperation( - pathPointResolved.target as NonNullable, + pathPointResolved.target as NonNullable< + typeof pathPointResolved.target + >, "scale" ) ).toBe(false); @@ -1343,12 +1349,13 @@ describe("transform session commit commands", () => { }; store.executeCommand( - createCommitTransformSessionCommand(store.getState().document, scaleSession) + createCommitTransformSessionCommand( + store.getState().document, + scaleSession + ) ); - expect( - store.getState().document.entities[triggerVolume.id] - ).toMatchObject({ + expect(store.getState().document.entities[triggerVolume.id]).toMatchObject({ position: { x: 1, y: 1, @@ -1367,9 +1374,7 @@ describe("transform session commit commands", () => { }); expect(store.undo()).toBe(true); - expect( - store.getState().document.entities[triggerVolume.id] - ).toMatchObject({ + expect(store.getState().document.entities[triggerVolume.id]).toMatchObject({ rotationDegrees: { x: 0, y: 45, @@ -1379,9 +1384,7 @@ describe("transform session commit commands", () => { }); expect(store.redo()).toBe(true); - expect( - store.getState().document.entities[triggerVolume.id] - ).toMatchObject({ + expect(store.getState().document.entities[triggerVolume.id]).toMatchObject({ size: { x: 4, y: 3, @@ -1726,7 +1729,9 @@ describe("transform session commit commands", () => { createCommitTransformSessionCommand(store.getState().document, session) ); - expect(store.getState().document.modelInstances[modelInstanceA.id]).toMatchObject({ + expect( + store.getState().document.modelInstances[modelInstanceA.id] + ).toMatchObject({ position: { x: -2, y: 0, @@ -1738,7 +1743,9 @@ describe("transform session commit commands", () => { z: 2 } }); - expect(store.getState().document.modelInstances[modelInstanceB.id]).toMatchObject({ + expect( + store.getState().document.modelInstances[modelInstanceB.id] + ).toMatchObject({ position: { x: 2, y: 0, @@ -1760,7 +1767,9 @@ describe("transform session commit commands", () => { ); expect(store.redo()).toBe(true); - expect(store.getState().document.modelInstances[modelInstanceA.id]).toMatchObject({ + expect( + store.getState().document.modelInstances[modelInstanceA.id] + ).toMatchObject({ position: { x: -2, y: 0, diff --git a/tests/serialization/scene-document-json.test.ts b/tests/serialization/scene-document-json.test.ts index 49c9c42d..f8cb6c6b 100644 --- a/tests/serialization/scene-document-json.test.ts +++ b/tests/serialization/scene-document-json.test.ts @@ -237,9 +237,11 @@ describe("scene document JSON", () => { ) as Record; legacyDocument.version = FOLIAGE_FOUNDATION_SCENE_DOCUMENT_VERSION; - delete ((legacyDocument.terrains as Record>)[ - terrain.id - ] as Record).foliageMasks; + delete ( + (legacyDocument.terrains as Record>)[ + terrain.id + ] as Record + ).foliageMasks; const migratedDocument = parseSceneDocumentJson( JSON.stringify(legacyDocument) @@ -264,18 +266,18 @@ describe("scene document JSON", () => { ) as Record; legacyDocument.version = FOLIAGE_QUALITY_SCENE_DOCUMENT_VERSION; - delete ((legacyDocument.terrains as Record>)[ - terrain.id - ] as Record).foliageBlockerMask; + delete ( + (legacyDocument.terrains as Record>)[ + terrain.id + ] as Record + ).foliageBlockerMask; const migratedDocument = parseSceneDocumentJson( JSON.stringify(legacyDocument) ); expect(migratedDocument.version).toBe(SCENE_DOCUMENT_VERSION); - expect( - migratedDocument.terrains[terrain.id]?.foliageBlockerMask - ).toEqual({ + expect(migratedDocument.terrains[terrain.id]?.foliageBlockerMask).toEqual({ resolutionX: 2, resolutionZ: 2, values: [0, 0, 0, 0] @@ -805,9 +807,7 @@ describe("scene document JSON", () => { const migratedDocument = migrateSceneDocument(legacyDocument); expect(migratedDocument.version).toBe(SCENE_DOCUMENT_VERSION); - expect( - migratedDocument.brushes[brush.id].faces.posZ.climbable - ).toBe(false); + expect(migratedDocument.brushes[brush.id].faces.posZ.climbable).toBe(false); }); it("round-trips whitebox box volume settings", () => { diff --git a/tests/unit/runtime-interaction-system.test.ts b/tests/unit/runtime-interaction-system.test.ts index 2d4f6f33..2140a961 100644 --- a/tests/unit/runtime-interaction-system.test.ts +++ b/tests/unit/runtime-interaction-system.test.ts @@ -26,7 +26,9 @@ function createClickLink(sourceEntityId: string): InteractionLink { }; } -function createNpc(overrides: Partial & { entityId: string }): RuntimeNpc { +function createNpc( + overrides: Partial & { entityId: string } +): RuntimeNpc { return { entityId: overrides.entityId, actorId: overrides.actorId ?? "", @@ -38,13 +40,12 @@ function createNpc(overrides: Partial & { entityId: string }): Runti modelAssetId: overrides.modelAssetId ?? null, dialogues: overrides.dialogues ?? [], defaultDialogueId: overrides.defaultDialogueId ?? null, - collider: - overrides.collider ?? { - mode: "capsule", - radius: 0.35, - height: 1.8, - eyeHeight: 1.6 - }, + collider: overrides.collider ?? { + mode: "capsule", + radius: 0.35, + height: 1.8, + eyeHeight: 1.6 + }, activeRoutineTitle: overrides.activeRoutineTitle ?? null, animationClipName: overrides.animationClipName ?? null, animationLoop: overrides.animationLoop, @@ -102,7 +103,10 @@ describe("runtime interaction targeting", () => { const scene = createRuntimeSceneFixture({ npcs: [centerNpc], interactables: [sideInteractable], - links: [createClickLink(centerNpc.entityId), createClickLink(sideInteractable.entityId)] + links: [ + createClickLink(centerNpc.entityId), + createClickLink(sideInteractable.entityId) + ] }); const candidates = resolveRuntimeTargetCandidates({ diff --git a/tests/unit/transform-foundation.integration.test.tsx b/tests/unit/transform-foundation.integration.test.tsx index 1ef63302..de711c8c 100644 --- a/tests/unit/transform-foundation.integration.test.tsx +++ b/tests/unit/transform-foundation.integration.test.tsx @@ -9,9 +9,7 @@ import { createProjectAssetStorageKey, type ModelAssetRecord } from "../../src/assets/project-assets"; -import type { - ActiveTransformSession -} from "../../src/core/transform-session"; +import type { ActiveTransformSession } from "../../src/core/transform-session"; import { createBoxBrush } from "../../src/document/brushes"; import { createEmptySceneDocument } from "../../src/document/scene-document"; import { createPlayerStartEntity } from "../../src/entities/entity-instances"; @@ -275,7 +273,9 @@ async function renderMultiSelectionFixtureApp() { await waitFor(() => { expect(viewportHostInstances.length).toBeGreaterThan(0); - expect(getTopLeftViewportHost().setBrushSelectionChangeHandler).toHaveBeenCalled(); + expect( + getTopLeftViewportHost().setBrushSelectionChangeHandler + ).toHaveBeenCalled(); }); return { @@ -611,9 +611,10 @@ describe("transform foundation integration", () => { }); expect(store.getState().whiteboxSelectionMode).toBe("edge"); - expect( - screen.getByTestId("whitebox-selection-mode-edge") - ).toHaveAttribute("aria-pressed", "true"); + expect(screen.getByTestId("whitebox-selection-mode-edge")).toHaveAttribute( + "aria-pressed", + "true" + ); fireEvent.keyDown(window, { key: "3", @@ -635,7 +636,9 @@ describe("transform foundation integration", () => { expect( screen.getByTestId("whitebox-selection-mode-object") ).toHaveAttribute("aria-pressed", "true"); - expect(screen.getByText(/selection mode set to object/i)).toBeInTheDocument(); + expect( + screen.getByText(/selection mode set to object/i) + ).toBeInTheDocument(); }); it("keeps outliner and viewport selection state synchronized for same-kind multi-selection", async () => { @@ -660,9 +663,10 @@ describe("transform foundation integration", () => { expect(screen.getByText("2 selected")).toBeInTheDocument(); expect(screen.getByText("Brush Multi B")).toBeInTheDocument(); - const selectionHandler = viewportHost.setBrushSelectionChangeHandler.mock.calls.at( - -1 - )?.[0] as ((selection: { kind: "entities"; ids: string[] }) => void); + const selectionHandler = + viewportHost.setBrushSelectionChangeHandler.mock.calls.at( + -1 + )?.[0] as (selection: { kind: "entities"; ids: string[] }) => void; act(() => { selectionHandler({