Rename mesh metadata polygon key to drop floorplan prefix
This commit is contained in:
@@ -183,7 +183,7 @@ function getCachedLocalMeshPolygon(item: ItemNode): Point[] | null {
|
|||||||
typeof item.metadata === 'object' && item.metadata !== null && !Array.isArray(item.metadata)
|
typeof item.metadata === 'object' && item.metadata !== null && !Array.isArray(item.metadata)
|
||||||
? (item.metadata as Record<string, unknown>)
|
? (item.metadata as Record<string, unknown>)
|
||||||
: null
|
: null
|
||||||
const rawPolygon = metadata?.floorplanLocalPolygon
|
const rawPolygon = metadata?.meshLocalPlanPolygon
|
||||||
if (!Array.isArray(rawPolygon)) {
|
if (!Array.isArray(rawPolygon)) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ function isMetadataUnchanged(
|
|||||||
nextBounds: { min: [number, number, number]; max: [number, number, number] } | null,
|
nextBounds: { min: [number, number, number]; max: [number, number, number] } | null,
|
||||||
metadata: Record<string, unknown>,
|
metadata: Record<string, unknown>,
|
||||||
): boolean {
|
): boolean {
|
||||||
const currentPolygon = metadata.floorplanLocalPolygon
|
const currentPolygon = metadata.meshLocalPlanPolygon
|
||||||
const currentBounds =
|
const currentBounds =
|
||||||
typeof metadata.meshLocalBounds === 'object' &&
|
typeof metadata.meshLocalBounds === 'object' &&
|
||||||
metadata.meshLocalBounds !== null &&
|
metadata.meshLocalBounds !== null &&
|
||||||
@@ -76,14 +76,14 @@ function trySyncItemMeshMetadata(itemId: string, nodes: Record<string, AnyNode |
|
|||||||
useScene.getState().updateNode(itemId as AnyNodeId, {
|
useScene.getState().updateNode(itemId as AnyNodeId, {
|
||||||
metadata: {
|
metadata: {
|
||||||
...metadata,
|
...metadata,
|
||||||
...(nextPolygon ? { floorplanLocalPolygon: nextPolygon } : {}),
|
...(nextPolygon ? { meshLocalPlanPolygon: nextPolygon } : {}),
|
||||||
...(nextBounds ? { meshLocalBounds: nextBounds } : {}),
|
...(nextBounds ? { meshLocalBounds: nextBounds } : {}),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Writes `floorplanLocalPolygon` / `meshLocalBounds` from loaded item meshes.
|
* Writes `meshLocalPlanPolygon` / `meshLocalBounds` from loaded item meshes.
|
||||||
* ModelRenderer requests sync via `requestItemMeshMetadataSync` when GLTF is ready.
|
* ModelRenderer requests sync via `requestItemMeshMetadataSync` when GLTF is ready.
|
||||||
*/
|
*/
|
||||||
export function ItemMeshMetadataSystem() {
|
export function ItemMeshMetadataSystem() {
|
||||||
|
|||||||
Reference in New Issue
Block a user