Register modeling commands as disabled, enable without needing to re-open the command palette (#6886)

* Allow adding and removing commands from any command bar state

* Allow commands to be configured disabled in the combobox

* Set up modeling commands to toggle `disabled` based on network status, instead of filtering

* Fix tsc
This commit is contained in:
Frank Noirot
2025-05-12 21:18:50 -04:00
committed by GitHub
parent e7ecd655c4
commit 47feae3bd9
6 changed files with 68 additions and 53 deletions

View File

@ -34,7 +34,7 @@ import {
useMenuListener,
useSketchModeMenuEnableDisable,
} from '@src/hooks/useMenu'
import useStateMachineCommands from '@src/hooks/useStateMachineCommands'
import useModelingMachineCommands from '@src/hooks/useStateMachineCommands'
import { useKclContext } from '@src/lang/KclProvider'
import { updateModelingState } from '@src/lang/modelingWorkflows'
import {
@ -2091,13 +2091,12 @@ export const ModelingMachineProvider = ({
modelingSend({ type: 'Center camera on selection' })
})
useStateMachineCommands({
useModelingMachineCommands({
machineId: 'modeling',
state: modelingState,
send: modelingSend,
actor: modelingActor,
commandBarConfig: modelingMachineCommandConfig,
allCommandsRequireNetwork: true,
// TODO for when sketch tools are in the toolbar: This was added when we used one "Cancel" event,
// but we need to support "SketchCancel" and basically
// make this function take the actor or state so it