import type { NodeDef } from '../../NodeRegistry'; import { childrenOf } from '../../objectQueries'; import { asBoolean, asEntity } from '../../values'; import { bool, list, obj } from '../shared'; export const Children: NodeDef = { type: 'Children', label: 'Children', category: 'data', description: 'The children of an object as a list, in scene order. With recursive, every object below it: ' + 'the children first, then their children and so on.', inputs: [obj('object'), bool('recursive')], outputs: [list('children')], params: [], run: (ctx, inputs) => { const parent = asEntity(inputs.object); const children = parent ? childrenOf(ctx.objects(), parent, asBoolean(inputs.recursive)) : []; return { outputs: { children } }; }, };