1.5 KiB
1.5 KiB
Adding a command
- Find the id. Search
crates/ui-egui/src/menu_catalog.rsfor the Photoshop menu item. Using its id makes the menu item live with no UI work. Commands without a Photoshop menu entry use a descriptive id in the same style (layer.smartFilter.delete) and an empty menu path. - Algorithm goes in the lowest crate that fits (
algofor imaging,paint,vector,text,cms), with unit tests. It takes depth-agnostic surfaces (photocraft-raster), works per tile, and is deterministic (seeded randomness). - Command goes in an engine module (
crates/engine/src/<area>_cmds.rs) exposingspecs(), registered withv.extend(...)incommands.rs. Fill in:id,label,menupath and Photoshop's defaultshortcut,- a params doc string such as
{"radius":px=4,"mode":"a|b"="a"}(this is what agents read throughcommands/command_list), - an
enabledpredicate (greys the menu item out), run, which returns a JSON result and records exactly one history step (usecoalescefor drags and typing sessions).
- Respect the context: active selection (feathered), layer vs mask target, locks, the colour model and depth.
- Tests in the module: behaviour, undo/redo, disabled states, bad params, several depths.
- Dialog (if it has parameters): filters and adjustments get schema-driven dialogs with live preview (
ui-egui/src/filter_dialog.rs,dialogs.rs). - Run
cargo xtask parityand commit the updateddocs/parity-checklist.md.