Sudhir Yadav 57df224948
feat: Add catalog-based material presets across structural nodes (#231)
* Add catalog-based material presets across structural nodes

* Fix material picker fallback and wall visible highlights

* Preserve wall materials in selection highlights
2026-04-15 12:16:35 -04:00

29 lines
1001 B
TypeScript

import dedent from 'dedent'
import { z } from 'zod'
import { BaseNode, nodeType, objectId } from '../base'
import { MaterialSchema } from '../material'
import { RoofSegmentNode } from './roof-segment'
export const RoofNode = BaseNode.extend({
id: objectId('roof'),
type: nodeType('roof'),
material: MaterialSchema.optional(),
materialPreset: z.string().optional(),
position: z.tuple([z.number(), z.number(), z.number()]).default([0, 0, 0]),
// Rotation around Y axis in radians
rotation: z.number().default(0),
// Child roof segment IDs
children: z.array(RoofSegmentNode.shape.id).default([]),
}).describe(
dedent`
Roof node - a container for roof segments.
Acts as a group that holds one or more RoofSegmentNodes.
When not being edited, segments are visually combined into a single solid.
- position: center position of the roof group
- rotation: rotation around Y axis
- children: array of RoofSegmentNode IDs
`,
)
export type RoofNode = z.infer<typeof RoofNode>