Bump scene document version and update entity comparison

This commit is contained in:
2026-04-03 01:02:53 +02:00
parent 23ffb186e6
commit 1b66de906e
3 changed files with 7 additions and 2 deletions

View File

@@ -6,7 +6,8 @@ import type { InteractionLink } from "../interactions/interaction-links";
import { cloneMaterialRegistry, createStarterMaterialRegistry, type MaterialDef } from "../materials/starter-material-library";
import { createDefaultWorldSettings, type WorldSettings } from "./world-settings";
export const SCENE_DOCUMENT_VERSION = 14 as const;
export const SCENE_DOCUMENT_VERSION = 15 as const;
export const ENTITY_NAMES_SCENE_DOCUMENT_VERSION = 15 as const;
export const SPATIAL_AUDIO_SCENE_DOCUMENT_VERSION = 13 as const;
export const ANIMATION_PLAYBACK_SCENE_DOCUMENT_VERSION = 12 as const;
export const LOCAL_LIGHTS_AND_SKYBOX_SCENE_DOCUMENT_VERSION = 10 as const;

View File

@@ -517,7 +517,7 @@ export function cloneEntityRegistry(entities: Record<string, EntityInstance>): R
}
export function areEntityInstancesEqual(left: EntityInstance, right: EntityInstance): boolean {
if (left.kind !== right.kind || left.id !== right.id || !areVec3Equal(left.position, right.position)) {
if (left.kind !== right.kind || left.id !== right.id || left.name !== right.name || !areVec3Equal(left.position, right.position)) {
return false;
}

View File

@@ -30,6 +30,10 @@ export function getEntityDisplayLabel(
entities: Record<string, EntityInstance>,
assets?: Record<string, ProjectAssetRecord>
): string {
if (entity.name !== undefined) {
return entity.name;
}
const typedEntities = getSortedEntitiesByKind(entities, entity.kind);
const entityIndex = typedEntities.findIndex((candidate) => candidate.id === entity.id);
const baseLabel = getEntityKindLabel(entity.kind);