Boolean create UI (#5906)

* first steps, add to cmd bar etc

* cmdbar working well enough

* mvp

* lint

* fix after rebase

* intersect and union mvps

* add test

* some clean up

* further fix up

* Update src/lang/modifyAst/boolean.ts

Co-authored-by: Pierre Jacquier <pierrejacquier39@gmail.com>

* Update src/lang/modifyAst/boolean.ts

Co-authored-by: Pierre Jacquier <pierrejacquier39@gmail.com>

* pierre's comments

* tsc

* add comment

---------

Co-authored-by: Pierre Jacquier <pierrejacquier39@gmail.com>
This commit is contained in:
Kurt Hutten
2025-03-28 14:56:48 +11:00
committed by GitHub
parent 7ca3afff9f
commit d1f811f91d
11 changed files with 793 additions and 16 deletions

View File

@ -23,6 +23,8 @@ import {
import { getVariableDeclaration } from 'lang/queryAst/getVariableDeclaration'
import { getNodePathFromSourceRange } from 'lang/queryAstNodePathUtils'
import { getNodeFromPath } from 'lang/queryAst'
import { IS_NIGHTLY_OR_DEBUG } from 'routes/Settings'
import { DEV } from 'env'
type OutputFormat = Models['OutputFormat3d_type']
type OutputTypeKey = OutputFormat['type']
@ -153,6 +155,16 @@ export type ModelingCommandSchema = {
nodeToEdit?: PathToNode
color: string
}
'Boolean Subtract': {
target: Selections
tool: Selections
}
'Boolean Union': {
solids: Selections
}
'Boolean Intersect': {
solids: Selections
}
}
export const modelingMachineCommandConfig: StateMachineCommandSetConfig<
@ -507,6 +519,67 @@ export const modelingMachineCommandConfig: StateMachineCommandSetConfig<
},
},
},
'Boolean Subtract': {
hide: DEV || IS_NIGHTLY_OR_DEBUG ? undefined : 'both',
description: 'Subtract one solid from another.',
icon: 'booleanSubtract',
needsReview: true,
args: {
target: {
inputType: 'selection',
selectionTypes: ['path'],
selectionFilter: ['object'],
multiple: false,
required: true,
skip: true,
hidden: (context) => Boolean(context.argumentsToSubmit.nodeToEdit),
},
tool: {
clearSelectionFirst: true,
inputType: 'selection',
selectionTypes: ['path'],
selectionFilter: ['object'],
multiple: false,
required: true,
skip: false,
hidden: (context) => Boolean(context.argumentsToSubmit.nodeToEdit),
},
},
},
'Boolean Union': {
hide: DEV || IS_NIGHTLY_OR_DEBUG ? undefined : 'both',
description: 'Union multiple solids into a single solid.',
icon: 'booleanUnion',
needsReview: true,
args: {
solids: {
inputType: 'selection',
selectionTypes: ['path'],
selectionFilter: ['object'],
multiple: true,
required: true,
skip: false,
hidden: (context) => Boolean(context.argumentsToSubmit.nodeToEdit),
},
},
},
'Boolean Intersect': {
hide: DEV || IS_NIGHTLY_OR_DEBUG ? undefined : 'both',
description: 'Subtract one solid from another.',
icon: 'booleanIntersect',
needsReview: true,
args: {
solids: {
inputType: 'selectionMixed',
selectionTypes: ['path'],
selectionFilter: ['object'],
multiple: true,
required: true,
skip: false,
hidden: (context) => Boolean(context.argumentsToSubmit.nodeToEdit),
},
},
},
'Offset plane': {
description: 'Offset a plane.',
icon: 'plane',
@ -940,3 +1013,5 @@ export const modelingMachineCommandConfig: StateMachineCommandSetConfig<
},
},
}
modelingMachineCommandConfig