Editing a level by commands
Skill ferret-level-editor · download all skills · SKILL.md
When to use#
Putting entities in a level, adding zones, spawns, animation graphs, physics settings, or fixing a manifest without hand-editing JSON.
The model#
@ferret/editor edits a draft of a level's manifest through commands on world.commands. Every edit is a JSON-pointer patch (add, replace, remove) with its undo; a person in the editor and an agent share one undo history. Nothing is written until edit.save, which is refused while the draft is invalid.
Steps#
edit.open {level}(draft;livereloads the level after each edit).- Read with
edit.get {path?}(a JSON pointer such as/entities/0/params). - Change with the typed commands:
edit.entity.add|set|remove|duplicate,edit.spawn.*,edit.zone.*,edit.collider.set,edit.navmesh.rebuild,edit.anim.*,edit.physics.*(material, constraint, fracture, set),edit.material.*(below). Useedit.patch {ops}only when no typed command fits. edit.validate, thenedit.diffto see exactly what changed.- Look: the model viewer (
pnpm viewer,pnpm viewer:headless) relays commands and serves screenshots of the active camera. edit.save.edit.undo/edit.redo/edit.historywhile working.
Materials, live#
The look of a glTF material is changed on the running level with no reload (the next frame shows it; edit.undo/edit.redo, edit.diff, edit.save into the manifest's materialLooks). Never by the bare material name (it stands in twenty places): two scopes, then the glTF material name inside the model. type (default): a model's uid, all its instances. instance: one object's uid, wins over the type.
edit.material.list {scope?, filter?, limit?}: addresses{uid, via, meshes, materials, ambiguous?, look};unresolved= draft uids nothing answers to.edit.material.get {scope?, uid, material?}: the draft's looks and what the scene shows now.edit.material.set {scope?, uid, material, values}: merged,nullremoves one value.values:baseColor[r,g,b(,a)] linear 0..1,metallic,roughness,emissive,emissiveStrength,normalScale,alpha{mode, cutoff},doubleSided,maps{baseColor|normal|orm|emissive|opacity}. Refused: an unknown uid, a material the model lacks, an ambiguous address (two things answer to it: give the objects a uid in the export).edit.material.remove {scope?, uid, material?}.
Example: edit.material.set {scope:"instance", uid:"StaticMeshActor_12", material:"MI_Wood", values:{roughness:0.7}}, then a screenshot. Where uids come from, and the limits: concepts/levels.md ("Material looks").
Check afterwards#
edit.validate is empty; edit.colliders.missing lists no large non-solid mesh you meant to be solid; a screenshot shows the level; the level plays.
What usually goes wrong#
- Node names that do not exist in the glTF (the loader cannot wire them:
edit.validatereports it). - Removing a state or graph still used.
- Forgetting
edit.navmesh.rebuildafter moving solid meshes. - Editing with
liveoff and not callingedit.reload. - A look addressed by the bare material name (the same name stands in twenty places): always a type uid or an instance uid from
edit.material.list, and the material name inside it.
Files#
reference/levels.md— The level manifest, the level registry and travel, environment, and the .ferret package format.reference/commands.md— The debug command channel: how a tool, the inspector or an AI agent drives a running game, and the commands each package registers.reference/api-editor.md— every export of@ferret/editorwith signature and doc commentreference/commands.md— 105 commands of these packages with their arguments