# Debug commands of @ferret/editor

Call with `world.commands.execute(name, args)`; `world.commands.list()` on the running game is the authority. Read from the sources of these packages.

- `edit.anim.graph` — read an animation graph of the level: {name?} (without a name: the list of graph names)
- `edit.anim.initial` — the state the graph starts in: {graph, state}
- `edit.anim.param` — declare a graph parameter: {graph, name, kind:"float"|"bool"|"trigger"|null} (null drops it)
- `edit.anim.remove` — remove an animation graph: {name}
- `edit.anim.set` — add or replace a whole animation graph: {name, graph:{params?, states, initial, transitions?}}
- `edit.anim.state.remove` — remove a state: {graph, state, withTransitions?}. Refused while a transition or the initial state still uses it, unless withTransitions drops those transitions
- `edit.anim.state.set` — add or change a state: {graph, state, motion:{clip}|{blend1d:{param,points}}|{blend2d:{x,y,points}}, speed?, loop?}
- `edit.anim.transition.add` — add a transition: {graph, from ("*" for any), to, when?:[conditions], duration?, interruptible?, index? (the first matching transition wins)}
- `edit.anim.transition.remove` — remove a transition: {graph, index}
- `edit.anim.transition.set` — change a transition: {graph, index, to?, from?, when?, duration?, interruptible?} (null removes a field)
- `edit.chemistry.get` — the level's chemistry block (physics.chemistry): sets, species, reactions, aqueous, standard, phases
- `edit.chemistry.option` — set a list or flag of the chemistry block: {key: "sets"|"aqueous"|"standard"|"phases", value} (sets: names of standard species sets; aqueous: true or {recombination?, dissolution?}; standard: true or a list of families; phases: true or {substances?, rate?, liquidReactions?}, melting and boiling); null removes it
- `edit.chemistry.reaction.remove` — remove a reaction of the level: {name}
- `edit.chemistry.reaction.set` — add or change a reaction of the level: {name, reaction:{equation, A, Ea, orders?, phase?, catalysts?}} or {name, reaction:{reactants, products, A, Ea, ...}}
- `edit.chemistry.species.remove` — remove a species of the level: {name}
- `edit.chemistry.species.set` — add or change a species of the level: {name, species:{formula?, phase?, Hf (J/mol), S?, cp, cpT?, charge?}}
- `edit.clip.close` — close the open clip, dropping unsaved changes
- `edit.clip.get` — the open clip: {} -> the clip JSON; {summary: true} -> counts only; {bone} -> that bone's tracks
- `edit.clip.history` — the labels of the changes made so far
- `edit.clip.info` — change duration, loop, fps or name: {duration?, loop?, fps?, name?}
- `edit.clip.key.copy` — copy the pose at a time to another: {from, to, bone?} (one bone, or every bone with a key at `from`)
- `edit.clip.key.remove` — remove a key: {bone, time, channel?: rotation|position}
- `edit.clip.key.set` — set a key: {bone, time, rotation:[x,y,z,w] | euler:[x,y,z deg] | position:[x,y,z], interp?: step|linear|smooth, absolute?} (a change from rest unless absolute)
- `edit.clip.mirror` — mirror left and right (bones named _l/_r swap, middle bones flip): {time?} (that pose only; else the whole clip)
- `edit.clip.new` — start a clip: {skeleton, name, duration? (s, default 1), loop?, fps?, base? (a library clip id whose keys are copied)} -> summary
- `edit.clip.notify.remove` — remove notifies of a name: {name, time?}
- `edit.clip.notify.set` — put a notify on the clip: {name, time}
- `edit.clip.open` — open a saved or library clip: {id} -> summary
- `edit.clip.pose.hold` — put a weapon in the hands at a time: {time, grip: {point, axis, radius, spacing?} (in the frame of the holding hand: the grip of a socket), position: [x,y,z] (the middle of the grip, skeleton frame), direction: [x,y,z] (the blade), edge?: [x,y,z] (the way the edge should lead, for a grip with an edge), edgeWeight?, side?: r|l, roll? (degrees, or "auto": the wrists bent least and the hands moved least from the pose of the clip there), both?, poleMain?, poleOff?, interp?} -> { error, stretched }
- `edit.clip.pose.holdRun` — hold a weapon at many times at once: {holds: [the arguments of edit.clip.pose.hold, one per time], loop?, step?}; the turns of the hands left "auto" or absent are chosen for the whole run (wrists bent least, hands moving least between the times) -> { results: [{ time, error, stretched, roll }] }
- `edit.clip.pose.ik` — set keys by solving a limb to a target at a time: {chain:[root, middle, end], target: [x,y,z] | {bone, offset?}, pole?: same, time, endRotation?, weight?, interp?} -> { error, stretched }; positions are in the skeleton frame, an offset is in the frame of its bone
- `edit.clip.preview` — show the open clip on a body: {body?, time?} (a pose) or {body?, play: true, loop?}
- `edit.clip.redo` — redo
- `edit.clip.retime` — change the timing: {scale} (every time times it) or {curve: [[old, new], ...]} (straight lines between the pairs)
- `edit.clip.save` — save the open clip: {} -> { saved, clip }; the host writes it where its clips live
- `edit.clip.undo` — undo the last clip change
- `edit.clip.validate` — check the open clip: {} -> { ok, issues: [{level, path, message}], skipped }
- `edit.close` — stop editing and go back to the level as saved (discards the draft)
- `edit.collider.remove` — drop a collision override: {node}
- `edit.collider.set` — make a glTF node (and its meshes) solid or walk-through: {node, collide}
- `edit.colliders.missing` — meshes of the open level that do not collide and are large enough to matter: {minSize? (metres, default 1)}
- `edit.data.set` — set a key of the free data (handed to the game, never read by the engine); null removes it: {key, value}
- `edit.diff` — what the draft changes compared to the saved manifest, as patch operations
- `edit.entity.add` — add a manifest entity: {entity:{id, behaviour?, node?, transform?, params?, tags?}}
- `edit.entity.duplicate` — copy a manifest entity to a new id, moved by an offset: {id, newId, offset?}
- `edit.entity.remove` — remove a manifest entity: {id}
- `edit.entity.set` — change a manifest entity: {id, behaviour?, node?, params? (merged; null removes a key), transform? (merged), tags?}
- `edit.get` — read the draft manifest, or a part of it: {path?} as a JSON pointer such as /entities/0/params
- `edit.history` — the edits made so far, oldest first
- `edit.navmesh.info` — the NavMesh of the level: {polygons, settings, file, rebuilt (changed since the last save)}
- `edit.navmesh.rebuild` — build the NavMesh again from the solid meshes of the level: {agentRadius?, agentHeight?, maxClimb?, maxSlope?, cellSize?} (merged into the settings of the level; null drops one). Saved as navmesh.bin by edit.save
- `edit.open` — open a level for editing: {level}. Loads its manifest as a draft; returns a summary
- `edit.patch` — raw JSON-pointer operations on the draft: {ops:[{op:"add"|"replace"|"remove", path, value?}], label?}. Checked like every edit
- `edit.physics.constraint.remove` — remove a link: {id}
- `edit.physics.constraint.set` — add or change a link between two bodies: {id?, type:"rod"|"rope"|"spring"|"ball"|"hinge"|"fixed", a, b (node names), length?, stiffness?, damping?, maxForce?, anchor?:[x,y,z], axis?:[x,y,z], limits?:[min,max] radians}; the same id replaces
- `edit.physics.fracture.remove` — drop the pieces of a body: {node}
- `edit.physics.fracture.set` — make a body break into authored pieces: {node, pieces:[node names], material?, toughness? (impulse it takes before it breaks)}
- `edit.physics.get` — the level's physics block, or a summary: {summary?} counts materials, constraints, fractured bodies and the capabilities
- `edit.physics.material.remove` — remove a material: {name}
- `edit.physics.material.set` — add or change a material: {name, values:{density?, friction?, kineticFriction?, restitution?, rollingFriction?, ...}}
- `edit.physics.set` — set a key of the physics block: {key, value} (capabilities, gravity, combine, pairs, or a capability's values); a null value removes it
- `edit.redo` — redo the edit that was undone
- `edit.reload` — reload the open level from the draft (after edit commands with live off)
- `edit.save` — write the draft to the level's manifest.json (through the editor's save hook). Refused while the draft is invalid
- `edit.spawn.add` — add a spawn point: {id, position:[x,y,z], yaw?}
- `edit.spawn.remove` — remove a spawn point: {id}
- `edit.spawn.set` — change a spawn point: {id, position?, yaw?}
- `edit.streaming.cell` — add, replace or (cell null) remove a streaming cell: {id, cell:{bounds:[minX,minY,minZ,maxX,maxY,maxZ], file, size?, priority?, lod?}}
- `edit.streaming.field` — change one streaming setting: {key: loadRadius|unloadRadius|lodRadius|cell|texturesProgressive, value} (null removes an optional one)
- `edit.streaming.set` — set the streaming block (PLAN-STREAMING.md 4.1) as a whole, or null to remove it: {streaming}
- `edit.tags.set` — set the free tags (the chooser of the game reads them), or null to remove: {tags}
- `edit.undo` — undo the last edit
- `edit.validate` — check the draft: the schema problems, and what the loader could not wire on the last load
- `edit.zone.add` — add a zone: {name, shape:{kind:"box"|"cylinder"|"polygon", ...}, priority?, tags?}
- `edit.zone.remove` — remove a zone: {name}
- `edit.zone.set` — change a zone: {name, shape?, priority?, tags?}
