Edit ops — undo/redo, the command palette & clipboard
site/media/lessons/learn-editops.lesson.ts (4 steps) Editing in vgai is safe to experiment with because every mutation is undoable — the store keeps a
50-deep undo stack. The fastest way to reach any action is the command palette (⌘K / Ctrl+K),
which searches both editor actions and your entities.
-
Select an entity and open the palette. With
GoldSphereselected,⌘Kopens the palette and “Delete Selected” is one keystroke away — each action shows its shortcut (hereDel).
⌘K finds any edit op — and lists its shortcut. -
Delete it. Running the action removes
GoldSpherefrom both the hierarchy and the viewport.
The entity is gone — hierarchy and scene update together. -
Undo.
Undo(⌘Zon macOS,Ctrl+Zon Windows/Linux) restores the entity — it reappears in the tree and in the scene. Not sure of the key? Just run Undo from the palette (⌘K/Ctrl+K) — same action, no shortcut to remember.
Undo brings it back from the 50-deep stack. -
Redo.
Redo(⌘⇧Zon macOS,Ctrl+Shift+ZorCtrl+Yon Windows/Linux — or run Redo from the palette) re-applies the delete. Undo/redo walk the same history in both directions.
Recap
New functionality
- Ran Delete / Undo / Redo from the command palette
- Saw an entity removed and restored in hierarchy + viewport
New concepts & skills
- ⌘K opens a fuzzy palette over actions and entities (each shows its shortcut)
- every mutation is undoable — a 50-deep stack walked by Undo/Redo
- the edit-op set: copy/cut/paste, duplicate, delete, select-all/deselect, all on the selection
Next lesson → Editor architecture
On Your Own!
Extend what you built:
- Select an entity, ⌘/Ctrl+C then ⌘/Ctrl+V — a duplicate appears
- Make several edits, then ⌘/Ctrl+Z repeatedly to walk back through history
- ⌘/Ctrl+A to select all, then move them together with the gizmo