Align outdoor tree footprints in 2D editor
This commit is contained in:
@@ -139,6 +139,21 @@ export function buildFloorplanItemEntry(
|
|||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const dimensionPolygon = getItemDimensionPolygon(item, transform)
|
||||||
|
const [width, , depth] = getScaledDimensions(item)
|
||||||
|
if (shouldUseDimensionFloorplanFootprint(item)) {
|
||||||
|
return {
|
||||||
|
dimensionPolygon,
|
||||||
|
item,
|
||||||
|
polygon: dimensionPolygon,
|
||||||
|
usesRealMesh: true,
|
||||||
|
center: transform.position,
|
||||||
|
rotation: transform.rotation,
|
||||||
|
width,
|
||||||
|
depth,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const object = sceneRegistry.nodes.get(item.id)
|
const object = sceneRegistry.nodes.get(item.id)
|
||||||
const realMeshPolygon = object
|
const realMeshPolygon = object
|
||||||
? getRealMeshFloorplanPolygon(transform, object)
|
? getRealMeshFloorplanPolygon(transform, object)
|
||||||
@@ -147,9 +162,6 @@ export function buildFloorplanItemEntry(
|
|||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
const dimensionPolygon = getItemDimensionPolygon(item, transform)
|
|
||||||
const [width, , depth] = getScaledDimensions(item)
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
dimensionPolygon,
|
dimensionPolygon,
|
||||||
item,
|
item,
|
||||||
@@ -167,6 +179,29 @@ type Point = {
|
|||||||
y: number
|
y: number
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const DIMENSION_FOOTPRINT_ASSET_IDS = new Set(['tree', 'fir-tree', 'palm', 'bush'])
|
||||||
|
const DIMENSION_FOOTPRINT_TAGS = new Set([
|
||||||
|
'botanical',
|
||||||
|
'foliage',
|
||||||
|
'greenery',
|
||||||
|
'plant',
|
||||||
|
'tree',
|
||||||
|
'vegetation',
|
||||||
|
])
|
||||||
|
|
||||||
|
function shouldUseDimensionFloorplanFootprint(item: ItemNode) {
|
||||||
|
const asset = item.asset
|
||||||
|
if (asset.category !== 'outdoor') {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
if (DIMENSION_FOOTPRINT_ASSET_IDS.has(asset.id)) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
return asset.tags?.some((tag) => DIMENSION_FOOTPRINT_TAGS.has(tag.toLowerCase())) ?? false
|
||||||
|
}
|
||||||
|
|
||||||
function getItemDimensionPolygon(item: ItemNode, transform: FloorplanNodeTransform): Point[] {
|
function getItemDimensionPolygon(item: ItemNode, transform: FloorplanNodeTransform): Point[] {
|
||||||
const [width, , depth] = getScaledDimensions(item)
|
const [width, , depth] = getScaledDimensions(item)
|
||||||
const centerLocalZ = item.asset.attachTo === 'wall-side' ? -depth / 2 : 0
|
const centerLocalZ = item.asset.attachTo === 'wall-side' ? -depth / 2 : 0
|
||||||
|
|||||||
Reference in New Issue
Block a user